diff options
Diffstat (limited to 'src/crankshaft/arm/lithium-codegen-arm.cc')
-rw-r--r-- | src/crankshaft/arm/lithium-codegen-arm.cc | 71 |
1 files changed, 38 insertions, 33 deletions
diff --git a/src/crankshaft/arm/lithium-codegen-arm.cc b/src/crankshaft/arm/lithium-codegen-arm.cc index e092a9e0..11c70fb5 100644 --- a/src/crankshaft/arm/lithium-codegen-arm.cc +++ b/src/crankshaft/arm/lithium-codegen-arm.cc @@ -5,6 +5,7 @@ #include "src/crankshaft/arm/lithium-codegen-arm.h" #include "src/base/bits.h" +#include "src/builtins/builtins-constructor.h" #include "src/code-factory.h" #include "src/code-stubs.h" #include "src/crankshaft/arm/lithium-gap-resolver-arm.h" @@ -164,15 +165,18 @@ void LCodeGen::DoPrologue(LPrologue* instr) { __ CallRuntime(Runtime::kNewScriptContext); deopt_mode = Safepoint::kLazyDeopt; } else { - if (slots <= FastNewFunctionContextStub::kMaximumSlots) { - FastNewFunctionContextStub stub(isolate()); + if (slots <= + ConstructorBuiltinsAssembler::MaximumFunctionContextSlots()) { + Callable callable = CodeFactory::FastNewFunctionContext( + isolate(), info()->scope()->scope_type()); __ mov(FastNewFunctionContextDescriptor::SlotsRegister(), Operand(slots)); - __ CallStub(&stub); - // Result of FastNewFunctionContextStub is always in new space. + __ Call(callable.code(), RelocInfo::CODE_TARGET); + // Result of the FastNewFunctionContext builtin is always in new space. need_write_barrier = false; } else { __ push(r1); + __ Push(Smi::FromInt(info()->scope()->scope_type())); __ CallRuntime(Runtime::kNewFunctionContext); } } @@ -266,7 +270,7 @@ bool LCodeGen::GenerateDeferredCode() { DCHECK(!frame_is_built_); DCHECK(info()->IsStub()); frame_is_built_ = true; - __ Move(scratch0(), Smi::FromInt(StackFrame::STUB)); + __ mov(scratch0(), Operand(StackFrame::TypeToMarker(StackFrame::STUB))); __ PushCommonFrame(scratch0()); Comment(";;; Deferred code"); } @@ -340,7 +344,7 @@ bool LCodeGen::GenerateJumpTable() { // This variant of deopt can only be used with stubs. Since we don't // have a function pointer to install in the stack frame that we're // building, install a special marker there instead. - __ mov(ip, Operand(Smi::FromInt(StackFrame::STUB))); + __ mov(ip, Operand(StackFrame::TypeToMarker(StackFrame::STUB))); __ push(ip); DCHECK(info()->IsStub()); } @@ -2126,12 +2130,6 @@ void LCodeGen::DoBranch(LBranch* instr) { __ b(eq, instr->TrueLabel(chunk_)); } - if (expected & ToBooleanHint::kSimdValue) { - // SIMD value -> true. - __ CompareInstanceType(map, ip, SIMD128_VALUE_TYPE); - __ b(eq, instr->TrueLabel(chunk_)); - } - if (expected & ToBooleanHint::kHeapNumber) { // heap number -> false iff +0, -0, or NaN. DwVfpRegister dbl_scratch = double_scratch0(); @@ -2873,7 +2871,7 @@ void LCodeGen::DoLoadKeyedFixedArray(LLoadKeyed* instr) { // protector cell contains (Smi) Isolate::kProtectorValid. Otherwise // it needs to bail out. __ LoadRoot(result, Heap::kArrayProtectorRootIndex); - __ ldr(result, FieldMemOperand(result, Cell::kValueOffset)); + __ ldr(result, FieldMemOperand(result, PropertyCell::kValueOffset)); __ cmp(result, Operand(Smi::FromInt(Isolate::kProtectorValid))); DeoptimizeIf(ne, instr, DeoptimizeReason::kHole); } @@ -2937,7 +2935,8 @@ void LCodeGen::DoArgumentsElements(LArgumentsElements* instr) { __ ldr(scratch, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); __ ldr(result, MemOperand(scratch, CommonFrameConstants::kContextOrFrameTypeOffset)); - __ cmp(result, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); + __ cmp(result, + Operand(StackFrame::TypeToMarker(StackFrame::ARGUMENTS_ADAPTOR))); // Result is the frame pointer for the frame if not adapted and for the real // frame below the adaptor frame if adapted. @@ -3125,7 +3124,7 @@ void LCodeGen::DoContext(LContext* instr) { void LCodeGen::DoDeclareGlobals(LDeclareGlobals* instr) { DCHECK(ToRegister(instr->context()).is(cp)); - __ Move(scratch0(), instr->hydrogen()->pairs()); + __ Move(scratch0(), instr->hydrogen()->declarations()); __ push(scratch0()); __ mov(scratch0(), Operand(Smi::FromInt(instr->hydrogen()->flags()))); __ push(scratch0()); @@ -3501,7 +3500,8 @@ void LCodeGen::PrepareForTailCall(const ParameterCount& actual, __ ldr(scratch2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); __ ldr(scratch3, MemOperand(scratch2, StandardFrameConstants::kContextOffset)); - __ cmp(scratch3, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); + __ cmp(scratch3, + Operand(StackFrame::TypeToMarker(StackFrame::ARGUMENTS_ADAPTOR))); __ b(ne, &no_arguments_adaptor); // Drop current frame and load arguments count from arguments adaptor frame. @@ -4041,13 +4041,17 @@ void LCodeGen::DoDeferredMaybeGrowElements(LMaybeGrowElements* instr) { if (Smi::IsValid(int_key)) { __ mov(r3, Operand(Smi::FromInt(int_key))); } else { - // We should never get here at runtime because there is a smi check on - // the key before this point. - __ stop("expected smi"); + Abort(kArrayIndexConstantValueTooBig); } } else { - __ Move(r3, ToRegister(key)); - __ SmiTag(r3); + Label is_smi; + __ SmiTag(r3, ToRegister(key), SetCC); + // Deopt if the key is outside Smi range. The stub expects Smi and would + // bump the elements into dictionary mode (and trigger a deopt) anyways. + __ b(vc, &is_smi); + __ PopSafepointRegisters(); + DeoptimizeIf(al, instr, DeoptimizeReason::kOverflow); + __ bind(&is_smi); } GrowArrayElementsStub stub(isolate(), instr->hydrogen()->kind()); @@ -4755,6 +4759,13 @@ void LCodeGen::DoCheckValue(LCheckValue* instr) { void LCodeGen::DoDeferredInstanceMigration(LCheckMaps* instr, Register object) { + Label deopt, done; + // If the map is not deprecated the migration attempt does not make sense. + __ ldr(scratch0(), FieldMemOperand(object, HeapObject::kMapOffset)); + __ ldr(scratch0(), FieldMemOperand(scratch0(), Map::kBitField3Offset)); + __ tst(scratch0(), Operand(Map::Deprecated::kMask)); + __ b(eq, &deopt); + { PushSafepointRegistersScope scope(this); __ push(object); @@ -4765,7 +4776,12 @@ void LCodeGen::DoDeferredInstanceMigration(LCheckMaps* instr, Register object) { __ StoreToSafepointRegisterSlot(r0, scratch0()); } __ tst(scratch0(), Operand(kSmiTagMask)); - DeoptimizeIf(eq, instr, DeoptimizeReason::kInstanceMigrationFailed); + __ b(ne, &done); + + __ bind(&deopt); + DeoptimizeIf(al, instr, DeoptimizeReason::kInstanceMigrationFailed); + + __ bind(&done); } @@ -5116,17 +5132,6 @@ Condition LCodeGen::EmitTypeofIs(Label* true_label, Operand((1 << Map::kIsCallable) | (1 << Map::kIsUndetectable))); final_branch_condition = eq; -// clang-format off -#define SIMD128_TYPE(TYPE, Type, type, lane_count, lane_type) \ - } else if (String::Equals(type_name, factory->type##_string())) { \ - __ JumpIfSmi(input, false_label); \ - __ ldr(scratch, FieldMemOperand(input, HeapObject::kMapOffset)); \ - __ CompareRoot(scratch, Heap::k##Type##MapRootIndex); \ - final_branch_condition = eq; - SIMD128_TYPES(SIMD128_TYPE) -#undef SIMD128_TYPE - // clang-format on - } else { __ b(false_label); } |