From eab5bb5390fab79d063f29398377c6d181963dde Mon Sep 17 00:00:00 2001 From: verwaest Date: Thu, 7 May 2015 07:01:56 -0700 Subject: [PATCH] Allow loading holes from holey smi arrays BUG= Review URL: https://codereview.chromium.org/1134483002 Cr-Commit-Position: refs/heads/master@{#28298} --- src/arm/lithium-codegen-arm.cc | 3 ++- src/arm64/lithium-codegen-arm64.cc | 3 ++- src/hydrogen.cc | 4 +++- src/ia32/lithium-codegen-ia32.cc | 3 ++- src/mips/lithium-codegen-mips.cc | 3 ++- src/mips64/lithium-codegen-mips64.cc | 3 ++- src/ppc/lithium-codegen-ppc.cc | 3 ++- src/x64/lithium-codegen-x64.cc | 3 ++- src/x87/lithium-codegen-x87.cc | 3 ++- 9 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc index e91fddf..b9c7328 100644 --- a/src/arm/lithium-codegen-arm.cc +++ b/src/arm/lithium-codegen-arm.cc @@ -3349,7 +3349,8 @@ void LCodeGen::DoLoadKeyedFixedArray(LLoadKeyed* instr) { DeoptimizeIf(eq, instr, Deoptimizer::kHole); } } else if (instr->hydrogen()->hole_mode() == CONVERT_HOLE_TO_UNDEFINED) { - DCHECK(instr->hydrogen()->elements_kind() == FAST_HOLEY_ELEMENTS); + DCHECK(instr->hydrogen()->elements_kind() == FAST_HOLEY_SMI_ELEMENTS || + instr->hydrogen()->elements_kind() == FAST_HOLEY_ELEMENTS); Label done; __ LoadRoot(scratch, Heap::kTheHoleValueRootIndex); __ cmp(result, scratch); diff --git a/src/arm64/lithium-codegen-arm64.cc b/src/arm64/lithium-codegen-arm64.cc index c2a2ff3..e17570b 100644 --- a/src/arm64/lithium-codegen-arm64.cc +++ b/src/arm64/lithium-codegen-arm64.cc @@ -3629,7 +3629,8 @@ void LCodeGen::DoLoadKeyedFixed(LLoadKeyedFixed* instr) { Deoptimizer::kHole); } } else if (instr->hydrogen()->hole_mode() == CONVERT_HOLE_TO_UNDEFINED) { - DCHECK(instr->hydrogen()->elements_kind() == FAST_HOLEY_ELEMENTS); + DCHECK(instr->hydrogen()->elements_kind() == FAST_HOLEY_SMI_ELEMENTS || + instr->hydrogen()->elements_kind() == FAST_HOLEY_ELEMENTS); Label done; __ CompareRoot(result, Heap::kTheHoleValueRootIndex); __ B(ne, &done); diff --git a/src/hydrogen.cc b/src/hydrogen.cc index 2ac3d52..77890f6 100644 --- a/src/hydrogen.cc +++ b/src/hydrogen.cc @@ -7098,11 +7098,13 @@ LoadKeyedHoleMode HOptimizedGraphBuilder::BuildKeyedHoleMode(Handle map) { // Loads from a "stock" fast holey array can convert the hole to undefined // with impunity. LoadKeyedHoleMode load_mode = NEVER_RETURN_HOLE; + bool holey_smi_elements = + *map == isolate()->get_initial_js_array_map(FAST_HOLEY_SMI_ELEMENTS); bool holey_double_elements = *map == isolate()->get_initial_js_array_map(FAST_HOLEY_DOUBLE_ELEMENTS); bool holey_elements = *map == isolate()->get_initial_js_array_map(FAST_HOLEY_ELEMENTS); - if ((holey_double_elements || holey_elements) && + if ((holey_smi_elements || holey_double_elements || holey_elements) && isolate()->IsFastArrayConstructorPrototypeChainIntact()) { load_mode = holey_double_elements ? ALLOW_RETURN_HOLE : CONVERT_HOLE_TO_UNDEFINED; diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc index 3f1bab7..4ff65fb 100644 --- a/src/ia32/lithium-codegen-ia32.cc +++ b/src/ia32/lithium-codegen-ia32.cc @@ -3186,7 +3186,8 @@ void LCodeGen::DoLoadKeyedFixedArray(LLoadKeyed* instr) { DeoptimizeIf(equal, instr, Deoptimizer::kHole); } } else if (instr->hydrogen()->hole_mode() == CONVERT_HOLE_TO_UNDEFINED) { - DCHECK(instr->hydrogen()->elements_kind() == FAST_HOLEY_ELEMENTS); + DCHECK(instr->hydrogen()->elements_kind() == FAST_HOLEY_SMI_ELEMENTS || + instr->hydrogen()->elements_kind() == FAST_HOLEY_ELEMENTS); Label done; __ cmp(result, factory()->the_hole_value()); __ j(not_equal, &done); diff --git a/src/mips/lithium-codegen-mips.cc b/src/mips/lithium-codegen-mips.cc index b173e30..4378418 100644 --- a/src/mips/lithium-codegen-mips.cc +++ b/src/mips/lithium-codegen-mips.cc @@ -3286,7 +3286,8 @@ void LCodeGen::DoLoadKeyedFixedArray(LLoadKeyed* instr) { DeoptimizeIf(eq, instr, Deoptimizer::kHole, result, Operand(scratch)); } } else if (instr->hydrogen()->hole_mode() == CONVERT_HOLE_TO_UNDEFINED) { - DCHECK(instr->hydrogen()->elements_kind() == FAST_HOLEY_ELEMENTS); + DCHECK(instr->hydrogen()->elements_kind() == FAST_HOLEY_SMI_ELEMENTS || + instr->hydrogen()->elements_kind() == FAST_HOLEY_ELEMENTS); Label done; __ LoadRoot(scratch, Heap::kTheHoleValueRootIndex); __ Branch(&done, ne, result, Operand(scratch)); diff --git a/src/mips64/lithium-codegen-mips64.cc b/src/mips64/lithium-codegen-mips64.cc index 223370f..0373312 100644 --- a/src/mips64/lithium-codegen-mips64.cc +++ b/src/mips64/lithium-codegen-mips64.cc @@ -3335,7 +3335,8 @@ void LCodeGen::DoLoadKeyedFixedArray(LLoadKeyed* instr) { DeoptimizeIf(eq, instr, Deoptimizer::kHole, result, Operand(scratch)); } } else if (instr->hydrogen()->hole_mode() == CONVERT_HOLE_TO_UNDEFINED) { - DCHECK(instr->hydrogen()->elements_kind() == FAST_HOLEY_ELEMENTS); + DCHECK(instr->hydrogen()->elements_kind() == FAST_HOLEY_SMI_ELEMENTS || + instr->hydrogen()->elements_kind() == FAST_HOLEY_ELEMENTS); Label done; __ LoadRoot(scratch, Heap::kTheHoleValueRootIndex); __ Branch(&done, ne, result, Operand(scratch)); diff --git a/src/ppc/lithium-codegen-ppc.cc b/src/ppc/lithium-codegen-ppc.cc index dd6ada1..17232c7 100644 --- a/src/ppc/lithium-codegen-ppc.cc +++ b/src/ppc/lithium-codegen-ppc.cc @@ -3495,7 +3495,8 @@ void LCodeGen::DoLoadKeyedFixedArray(LLoadKeyed* instr) { DeoptimizeIf(eq, instr, Deoptimizer::kHole); } } else if (instr->hydrogen()->hole_mode() == CONVERT_HOLE_TO_UNDEFINED) { - DCHECK(instr->hydrogen()->elements_kind() == FAST_HOLEY_ELEMENTS); + DCHECK(instr->hydrogen()->elements_kind() == FAST_HOLEY_SMI_ELEMENTS || + instr->hydrogen()->elements_kind() == FAST_HOLEY_ELEMENTS); Label done; __ LoadRoot(scratch, Heap::kTheHoleValueRootIndex); __ cmp(result, scratch); diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc index eb8274b..e030826 100644 --- a/src/x64/lithium-codegen-x64.cc +++ b/src/x64/lithium-codegen-x64.cc @@ -3264,7 +3264,8 @@ void LCodeGen::DoLoadKeyedFixedArray(LLoadKeyed* instr) { DeoptimizeIf(equal, instr, Deoptimizer::kHole); } } else if (hinstr->hole_mode() == CONVERT_HOLE_TO_UNDEFINED) { - DCHECK(hinstr->elements_kind() == FAST_HOLEY_ELEMENTS); + DCHECK(hinstr->elements_kind() == FAST_HOLEY_SMI_ELEMENTS || + hinstr->elements_kind() == FAST_HOLEY_ELEMENTS); Label done; __ CompareRoot(result, Heap::kTheHoleValueRootIndex); __ j(not_equal, &done); diff --git a/src/x87/lithium-codegen-x87.cc b/src/x87/lithium-codegen-x87.cc index 86beee0..62c4c94 100644 --- a/src/x87/lithium-codegen-x87.cc +++ b/src/x87/lithium-codegen-x87.cc @@ -3454,7 +3454,8 @@ void LCodeGen::DoLoadKeyedFixedArray(LLoadKeyed* instr) { DeoptimizeIf(equal, instr, Deoptimizer::kHole); } } else if (instr->hydrogen()->hole_mode() == CONVERT_HOLE_TO_UNDEFINED) { - DCHECK(instr->hydrogen()->elements_kind() == FAST_HOLEY_ELEMENTS); + DCHECK(instr->hydrogen()->elements_kind() == FAST_HOLEY_SMI_ELEMENTS || + instr->hydrogen()->elements_kind() == FAST_HOLEY_ELEMENTS); Label done; __ cmp(result, factory()->the_hole_value()); __ j(not_equal, &done); -- 2.7.4