diff options
Diffstat (limited to 'deps/v8/src/crankshaft/arm/lithium-codegen-arm.cc')
-rw-r--r-- | deps/v8/src/crankshaft/arm/lithium-codegen-arm.cc | 155 |
1 files changed, 26 insertions, 129 deletions
diff --git a/deps/v8/src/crankshaft/arm/lithium-codegen-arm.cc b/deps/v8/src/crankshaft/arm/lithium-codegen-arm.cc index f2cc4b447e..e092a9e040 100644 --- a/deps/v8/src/crankshaft/arm/lithium-codegen-arm.cc +++ b/deps/v8/src/crankshaft/arm/lithium-codegen-arm.cc @@ -253,8 +253,7 @@ bool LCodeGen::GenerateDeferredCode() { HValue* value = instructions_->at(code->instruction_index())->hydrogen_value(); - RecordAndWritePosition( - chunk()->graph()->SourcePositionToScriptPosition(value->position())); + RecordAndWritePosition(value->position()); Comment(";;; <@%d,#%d> " "-------------------- Deferred %s --------------------", @@ -2058,45 +2057,44 @@ void LCodeGen::DoBranch(LBranch* instr) { __ cmp(ip, Operand::Zero()); EmitBranch(instr, ne); } else { - ToBooleanICStub::Types expected = - instr->hydrogen()->expected_input_types(); + ToBooleanHints expected = instr->hydrogen()->expected_input_types(); // Avoid deopts in the case where we've never executed this path before. - if (expected.IsEmpty()) expected = ToBooleanICStub::Types::Generic(); + if (expected == ToBooleanHint::kNone) expected = ToBooleanHint::kAny; - if (expected.Contains(ToBooleanICStub::UNDEFINED)) { + if (expected & ToBooleanHint::kUndefined) { // undefined -> false. __ CompareRoot(reg, Heap::kUndefinedValueRootIndex); __ b(eq, instr->FalseLabel(chunk_)); } - if (expected.Contains(ToBooleanICStub::BOOLEAN)) { + if (expected & ToBooleanHint::kBoolean) { // Boolean -> its value. __ CompareRoot(reg, Heap::kTrueValueRootIndex); __ b(eq, instr->TrueLabel(chunk_)); __ CompareRoot(reg, Heap::kFalseValueRootIndex); __ b(eq, instr->FalseLabel(chunk_)); } - if (expected.Contains(ToBooleanICStub::NULL_TYPE)) { + if (expected & ToBooleanHint::kNull) { // 'null' -> false. __ CompareRoot(reg, Heap::kNullValueRootIndex); __ b(eq, instr->FalseLabel(chunk_)); } - if (expected.Contains(ToBooleanICStub::SMI)) { + if (expected & ToBooleanHint::kSmallInteger) { // Smis: 0 -> false, all other -> true. __ cmp(reg, Operand::Zero()); __ b(eq, instr->FalseLabel(chunk_)); __ JumpIfSmi(reg, instr->TrueLabel(chunk_)); - } else if (expected.NeedsMap()) { + } else if (expected & ToBooleanHint::kNeedsMap) { // If we need a map later and have a Smi -> deopt. __ SmiTst(reg); DeoptimizeIf(eq, instr, DeoptimizeReason::kSmi); } const Register map = scratch0(); - if (expected.NeedsMap()) { + if (expected & ToBooleanHint::kNeedsMap) { __ ldr(map, FieldMemOperand(reg, HeapObject::kMapOffset)); - if (expected.CanBeUndetectable()) { + if (expected & ToBooleanHint::kCanBeUndetectable) { // Undetectable -> false. __ ldrb(ip, FieldMemOperand(map, Map::kBitFieldOffset)); __ tst(ip, Operand(1 << Map::kIsUndetectable)); @@ -2104,13 +2102,13 @@ void LCodeGen::DoBranch(LBranch* instr) { } } - if (expected.Contains(ToBooleanICStub::SPEC_OBJECT)) { + if (expected & ToBooleanHint::kReceiver) { // spec object -> true. __ CompareInstanceType(map, ip, FIRST_JS_RECEIVER_TYPE); __ b(ge, instr->TrueLabel(chunk_)); } - if (expected.Contains(ToBooleanICStub::STRING)) { + if (expected & ToBooleanHint::kString) { // String value -> false iff empty. Label not_string; __ CompareInstanceType(map, ip, FIRST_NONSTRING_TYPE); @@ -2122,19 +2120,19 @@ void LCodeGen::DoBranch(LBranch* instr) { __ bind(¬_string); } - if (expected.Contains(ToBooleanICStub::SYMBOL)) { + if (expected & ToBooleanHint::kSymbol) { // Symbol value -> true. __ CompareInstanceType(map, ip, SYMBOL_TYPE); __ b(eq, instr->TrueLabel(chunk_)); } - if (expected.Contains(ToBooleanICStub::SIMD_VALUE)) { + if (expected & ToBooleanHint::kSimdValue) { // SIMD value -> true. __ CompareInstanceType(map, ip, SIMD128_VALUE_TYPE); __ b(eq, instr->TrueLabel(chunk_)); } - if (expected.Contains(ToBooleanICStub::HEAP_NUMBER)) { + if (expected & ToBooleanHint::kHeapNumber) { // heap number -> false iff +0, -0, or NaN. DwVfpRegister dbl_scratch = double_scratch0(); Label not_heap_number; @@ -2148,7 +2146,7 @@ void LCodeGen::DoBranch(LBranch* instr) { __ bind(¬_heap_number); } - if (!expected.IsGeneric()) { + if (expected != ToBooleanHint::kAny) { // We've seen something for the first time -> deopt. // This can only happen if we are not generic already. DeoptimizeIf(al, instr, DeoptimizeReason::kUnexpectedObject); @@ -2393,30 +2391,6 @@ void LCodeGen::DoHasInstanceTypeAndBranch(LHasInstanceTypeAndBranch* instr) { EmitBranch(instr, BranchCondition(instr->hydrogen())); } - -void LCodeGen::DoGetCachedArrayIndex(LGetCachedArrayIndex* instr) { - Register input = ToRegister(instr->value()); - Register result = ToRegister(instr->result()); - - __ AssertString(input); - - __ ldr(result, FieldMemOperand(input, String::kHashFieldOffset)); - __ IndexFromHash(result, result); -} - - -void LCodeGen::DoHasCachedArrayIndexAndBranch( - LHasCachedArrayIndexAndBranch* instr) { - Register input = ToRegister(instr->value()); - Register scratch = scratch0(); - - __ ldr(scratch, - FieldMemOperand(input, String::kHashFieldOffset)); - __ tst(scratch, Operand(String::kContainsCachedArrayIndexMask)); - EmitBranch(instr, eq); -} - - // Branches to a label or falls through with the answer in flags. Trashes // the temp registers, but not the input. void LCodeGen::EmitClassOfTest(Label* is_true, @@ -2585,35 +2559,6 @@ void LCodeGen::DoReturn(LReturn* instr) { } -template <class T> -void LCodeGen::EmitVectorLoadICRegisters(T* instr) { - Register vector_register = ToRegister(instr->temp_vector()); - Register slot_register = LoadDescriptor::SlotRegister(); - DCHECK(vector_register.is(LoadWithVectorDescriptor::VectorRegister())); - DCHECK(slot_register.is(r0)); - - AllowDeferredHandleDereference vector_structure_check; - Handle<TypeFeedbackVector> vector = instr->hydrogen()->feedback_vector(); - __ Move(vector_register, vector); - // No need to allocate this register. - FeedbackVectorSlot slot = instr->hydrogen()->slot(); - int index = vector->GetIndex(slot); - __ mov(slot_register, Operand(Smi::FromInt(index))); -} - - -void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) { - DCHECK(ToRegister(instr->context()).is(cp)); - DCHECK(ToRegister(instr->result()).is(r0)); - - EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr); - Handle<Code> ic = - CodeFactory::LoadGlobalICInOptimizedCode(isolate(), instr->typeof_mode()) - .code(); - CallCode(ic, RelocInfo::CODE_TARGET, instr); -} - - void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { Register context = ToRegister(instr->context()); Register result = ToRegister(instr->result()); @@ -2696,19 +2641,6 @@ void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { } -void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { - DCHECK(ToRegister(instr->context()).is(cp)); - DCHECK(ToRegister(instr->object()).is(LoadDescriptor::ReceiverRegister())); - DCHECK(ToRegister(instr->result()).is(r0)); - - // Name is always in r2. - __ mov(LoadDescriptor::NameRegister(), Operand(instr->name())); - EmitVectorLoadICRegisters<LLoadNamedGeneric>(instr); - Handle<Code> ic = CodeFactory::LoadICInOptimizedCode(isolate()).code(); - CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS); -} - - void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) { Register scratch = scratch0(); Register function = ToRegister(instr->function()); @@ -2938,11 +2870,11 @@ void LCodeGen::DoLoadKeyedFixedArray(LLoadKeyed* instr) { __ b(ne, &done); if (info()->IsStub()) { // A stub can safely convert the hole to undefined only if the array - // protector cell contains (Smi) Isolate::kArrayProtectorValid. Otherwise + // protector cell contains (Smi) Isolate::kProtectorValid. Otherwise // it needs to bail out. __ LoadRoot(result, Heap::kArrayProtectorRootIndex); __ ldr(result, FieldMemOperand(result, Cell::kValueOffset)); - __ cmp(result, Operand(Smi::FromInt(Isolate::kArrayProtectorValid))); + __ cmp(result, Operand(Smi::FromInt(Isolate::kProtectorValid))); DeoptimizeIf(ne, instr, DeoptimizeReason::kHole); } __ LoadRoot(result, Heap::kUndefinedValueRootIndex); @@ -2993,18 +2925,6 @@ MemOperand LCodeGen::PrepareKeyedOperand(Register key, } -void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { - DCHECK(ToRegister(instr->context()).is(cp)); - DCHECK(ToRegister(instr->object()).is(LoadDescriptor::ReceiverRegister())); - DCHECK(ToRegister(instr->key()).is(LoadDescriptor::NameRegister())); - - EmitVectorLoadICRegisters<LLoadKeyedGeneric>(instr); - - Handle<Code> ic = CodeFactory::KeyedLoadICInOptimizedCode(isolate()).code(); - CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS); -} - - void LCodeGen::DoArgumentsElements(LArgumentsElements* instr) { Register scratch = scratch0(); Register result = ToRegister(instr->result()); @@ -4539,8 +4459,7 @@ void LCodeGen::DoSmiUntag(LSmiUntag* instr) { void LCodeGen::EmitNumberUntagD(LNumberUntagD* instr, Register input_reg, DwVfpRegister result_reg, NumberUntagDMode mode) { - bool can_convert_undefined_to_nan = - instr->hydrogen()->can_convert_undefined_to_nan(); + bool can_convert_undefined_to_nan = instr->truncating(); bool deoptimize_on_minus_zero = instr->hydrogen()->deoptimize_on_minus_zero(); Register scratch = scratch0(); @@ -4617,34 +4536,12 @@ void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr) { __ cmp(scratch1, Operand(ip)); if (instr->truncating()) { - // Performs a truncating conversion of a floating point number as used by - // the JS bitwise operations. - Label no_heap_number, check_bools, check_false; - __ b(ne, &no_heap_number); + Label truncate; + __ b(eq, &truncate); + __ CompareInstanceType(scratch1, scratch1, ODDBALL_TYPE); + DeoptimizeIf(ne, instr, DeoptimizeReason::kNotANumberOrOddball); + __ bind(&truncate); __ TruncateHeapNumberToI(input_reg, scratch2); - __ b(&done); - - // Check for Oddballs. Undefined/False is converted to zero and True to one - // for truncating conversions. - __ bind(&no_heap_number); - __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); - __ cmp(scratch2, Operand(ip)); - __ b(ne, &check_bools); - __ mov(input_reg, Operand::Zero()); - __ b(&done); - - __ bind(&check_bools); - __ LoadRoot(ip, Heap::kTrueValueRootIndex); - __ cmp(scratch2, Operand(ip)); - __ b(ne, &check_false); - __ mov(input_reg, Operand(1)); - __ b(&done); - - __ bind(&check_false); - __ LoadRoot(ip, Heap::kFalseValueRootIndex); - __ cmp(scratch2, Operand(ip)); - DeoptimizeIf(ne, instr, DeoptimizeReason::kNotAHeapNumberUndefinedBoolean); - __ mov(input_reg, Operand::Zero()); } else { DeoptimizeIf(ne, instr, DeoptimizeReason::kNotAHeapNumber); @@ -5052,7 +4949,7 @@ void LCodeGen::DoDeferredAllocate(LAllocate* instr) { // TODO(3095996): Get rid of this. For now, we need to make the // result register contain a valid pointer because it is already // contained in the register pointer map. - __ mov(result, Operand(Smi::FromInt(0))); + __ mov(result, Operand(Smi::kZero)); PushSafepointRegistersScope scope(this); if (instr->size()->IsRegister()) { @@ -5386,7 +5283,7 @@ void LCodeGen::DoForInCacheArray(LForInCacheArray* instr) { Register result = ToRegister(instr->result()); Label load_cache, done; __ EnumLength(result, map); - __ cmp(result, Operand(Smi::FromInt(0))); + __ cmp(result, Operand(Smi::kZero)); __ b(ne, &load_cache); __ mov(result, Operand(isolate()->factory()->empty_fixed_array())); __ jmp(&done); |