Chromium Code Reviews| Index: src/ia32/lithium-codegen-ia32.cc |
| diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc |
| index 66669a88b244673b50428b5863a4fae306ff8f9b..b40444367bcda979cb8a644fa38179d1a7d8a16a 100644 |
| --- a/src/ia32/lithium-codegen-ia32.cc |
| +++ b/src/ia32/lithium-codegen-ia32.cc |
| @@ -428,15 +428,11 @@ void LCodeGen::AddToTranslation(Translation* translation, |
| void LCodeGen::CallCodeGeneric(Handle<Code> code, |
| RelocInfo::Mode mode, |
| LInstruction* instr, |
| - ContextMode context_mode, |
| SafepointMode safepoint_mode) { |
| ASSERT(instr != NULL); |
| LPointerMap* pointers = instr->pointer_map(); |
| RecordPosition(pointers->position()); |
| - if (context_mode == RESTORE_CONTEXT) { |
| - __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
| - } |
| __ call(code, mode); |
| RegisterLazyDeoptimization(instr, safepoint_mode); |
| @@ -452,24 +448,19 @@ void LCodeGen::CallCodeGeneric(Handle<Code> code, |
| void LCodeGen::CallCode(Handle<Code> code, |
| RelocInfo::Mode mode, |
| - LInstruction* instr, |
| - ContextMode context_mode) { |
| - CallCodeGeneric(code, mode, instr, context_mode, RECORD_SIMPLE_SAFEPOINT); |
| + LInstruction* instr) { |
| + CallCodeGeneric(code, mode, instr, RECORD_SIMPLE_SAFEPOINT); |
| } |
| void LCodeGen::CallRuntime(const Runtime::Function* fun, |
| int argc, |
| - LInstruction* instr, |
| - ContextMode context_mode) { |
| + LInstruction* instr) { |
| ASSERT(instr != NULL); |
| ASSERT(instr->HasPointerMap()); |
| LPointerMap* pointers = instr->pointer_map(); |
| RecordPosition(pointers->position()); |
| - if (context_mode == RESTORE_CONTEXT) { |
| - __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
| - } |
| __ CallRuntime(fun, argc); |
| RegisterLazyDeoptimization(instr, RECORD_SIMPLE_SAFEPOINT); |
| @@ -478,8 +469,18 @@ void LCodeGen::CallRuntime(const Runtime::Function* fun, |
| void LCodeGen::CallRuntimeFromDeferred(Runtime::FunctionId id, |
| int argc, |
| - LInstruction* instr) { |
| - __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
| + LInstruction* instr, |
| + LOperand* context) { |
| + ASSERT(context->IsRegister() || context->IsStackSlot()); |
| + if (context->IsRegister()) { |
| + if (!ToRegister(context).is(esi)) { |
| + __ mov(esi, ToRegister(context)); |
| + } |
| + } else { |
| + // Context is stack slot. |
| + __ mov(esi, ToOperand(context)); |
| + } |
| + |
| __ CallRuntimeSaveDoubles(id); |
| RecordSafepointWithRegisters( |
| instr->pointer_map(), argc, Safepoint::kNoDeoptimizationIndex); |
| @@ -748,38 +749,38 @@ void LCodeGen::DoCallStub(LCallStub* instr) { |
| switch (instr->hydrogen()->major_key()) { |
| case CodeStub::RegExpConstructResult: { |
| RegExpConstructResultStub stub; |
| - CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr, CONTEXT_ADJUSTED); |
| + CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| break; |
| } |
| case CodeStub::RegExpExec: { |
| RegExpExecStub stub; |
| - CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr, CONTEXT_ADJUSTED); |
| + CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| break; |
| } |
| case CodeStub::SubString: { |
| SubStringStub stub; |
| - CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr, CONTEXT_ADJUSTED); |
| + CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| break; |
| } |
| case CodeStub::NumberToString: { |
| NumberToStringStub stub; |
| - CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr, CONTEXT_ADJUSTED); |
| + CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| break; |
| } |
| case CodeStub::StringAdd: { |
| StringAddStub stub(NO_STRING_ADD_FLAGS); |
| - CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr, CONTEXT_ADJUSTED); |
| + CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| break; |
| } |
| case CodeStub::StringCompare: { |
| StringCompareStub stub; |
| - CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr, CONTEXT_ADJUSTED); |
| + CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| break; |
| } |
| case CodeStub::TranscendentalCache: { |
| TranscendentalCacheStub stub(instr->transcendental_type(), |
| TranscendentalCacheStub::TAGGED); |
| - CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr, CONTEXT_ADJUSTED); |
| + CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| break; |
| } |
| default: |
| @@ -1256,8 +1257,9 @@ void LCodeGen::DoBitNotI(LBitNotI* instr) { |
| void LCodeGen::DoThrow(LThrow* instr) { |
| - __ push(ToOperand(instr->InputAt(0))); |
| - CallRuntime(Runtime::kThrow, 1, instr, RESTORE_CONTEXT); |
| + __ push(ToOperand(instr->value())); |
| + ASSERT(ToRegister(instr->context()).is(esi)); |
| + CallRuntime(Runtime::kThrow, 1, instr); |
| if (FLAG_debug_code) { |
| Comment("Unreachable code."); |
| @@ -1327,12 +1329,13 @@ void LCodeGen::DoArithmeticD(LArithmeticD* instr) { |
| void LCodeGen::DoArithmeticT(LArithmeticT* instr) { |
| - ASSERT(ToRegister(instr->InputAt(0)).is(edx)); |
| - ASSERT(ToRegister(instr->InputAt(1)).is(eax)); |
| + ASSERT(ToRegister(instr->context()).is(esi)); |
| + ASSERT(ToRegister(instr->left()).is(edx)); |
| + ASSERT(ToRegister(instr->right()).is(eax)); |
| ASSERT(ToRegister(instr->result()).is(eax)); |
| BinaryOpStub stub(instr->op(), NO_OVERWRITE); |
| - CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr, RESTORE_CONTEXT); |
| + CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| } |
| @@ -1972,7 +1975,7 @@ void LCodeGen::DoInstanceOf(LInstanceOf* instr) { |
| // Object and function are in fixed registers defined by the stub. |
| ASSERT(ToRegister(instr->context()).is(esi)); |
| InstanceofStub stub(InstanceofStub::kArgsInRegisters); |
| - CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr, CONTEXT_ADJUSTED); |
| + CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| Label true_value, done; |
| __ test(eax, Operand(eax)); |
| @@ -2006,7 +2009,7 @@ void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) { |
| deferred = new DeferredInstanceOfKnownGlobal(this, instr); |
| Label done, false_result; |
| - Register object = ToRegister(instr->InputAt(0)); |
| + Register object = ToRegister(instr->InputAt(1)); |
| Register temp = ToRegister(instr->TempAt(0)); |
| // A Smi is not an instance of anything. |
| @@ -2068,14 +2071,13 @@ void LCodeGen::DoDeferredLInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr, |
| Register temp = ToRegister(instr->TempAt(0)); |
| ASSERT(MacroAssembler::SafepointRegisterStackIndex(temp) == 0); |
| __ mov(InstanceofStub::right(), Immediate(instr->function())); |
| - static const int kAdditionalDelta = 16; |
| + static const int kAdditionalDelta = 13; |
| int delta = masm_->SizeOfCodeGeneratedSince(map_check) + kAdditionalDelta; |
| __ mov(temp, Immediate(delta)); |
| __ StoreToSafepointRegisterSlot(temp, temp); |
| CallCodeGeneric(stub.GetCode(), |
| RelocInfo::CODE_TARGET, |
| instr, |
| - RESTORE_CONTEXT, |
| RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS); |
| // Put the result value into the eax slot and restore all registers. |
| __ StoreToSafepointRegisterSlot(eax, eax); |
| @@ -2106,7 +2108,7 @@ void LCodeGen::DoCmpT(LCmpT* instr) { |
| Token::Value op = instr->op(); |
| Handle<Code> ic = CompareIC::GetUninitialized(op); |
| - CallCode(ic, RelocInfo::CODE_TARGET, instr, RESTORE_CONTEXT); |
| + CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| Condition condition = ComputeCompareCondition(op); |
| if (op == Token::GT || op == Token::LTE) { |
| @@ -2158,7 +2160,7 @@ void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) { |
| RelocInfo::Mode mode = instr->for_typeof() ? RelocInfo::CODE_TARGET : |
| RelocInfo::CODE_TARGET_CONTEXT; |
| Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); |
| - CallCode(ic, mode, instr, CONTEXT_ADJUSTED); |
| + CallCode(ic, mode, instr); |
| } |
| @@ -2189,7 +2191,7 @@ void LCodeGen::DoStoreGlobalGeneric(LStoreGlobalGeneric* instr) { |
| Handle<Code> ic = instr->strict_mode() |
| ? isolate()->builtins()->StoreIC_Initialize_Strict() |
| : isolate()->builtins()->StoreIC_Initialize(); |
| - CallCode(ic, RelocInfo::CODE_TARGET_CONTEXT, instr, CONTEXT_ADJUSTED); |
| + CallCode(ic, RelocInfo::CODE_TARGET_CONTEXT, instr); |
| } |
| @@ -2261,7 +2263,7 @@ void LCodeGen::DoLoadNamedFieldPolymorphic(LLoadNamedFieldPolymorphic* instr) { |
| ASSERT(instr->hydrogen()->need_generic()); |
| __ mov(ecx, name); |
| Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); |
| - CallCode(ic, RelocInfo::CODE_TARGET, instr, RESTORE_CONTEXT); |
| + CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| } else { |
| Label done; |
| for (int i = 0; i < map_count - 1; ++i) { |
| @@ -2283,7 +2285,7 @@ void LCodeGen::DoLoadNamedFieldPolymorphic(LLoadNamedFieldPolymorphic* instr) { |
| __ bind(&generic); |
| __ mov(ecx, name); |
| Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); |
| - CallCode(ic, RelocInfo::CODE_TARGET, instr, RESTORE_CONTEXT); |
| + CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| } else { |
| DeoptimizeIf(not_equal, instr->environment()); |
| EmitLoadFieldOrConstantFunction(result, object, map, name); |
| @@ -2300,7 +2302,7 @@ void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { |
| __ mov(ecx, instr->name()); |
| Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); |
| - CallCode(ic, RelocInfo::CODE_TARGET, instr, CONTEXT_ADJUSTED); |
| + CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| } |
| @@ -2499,7 +2501,7 @@ void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { |
| ASSERT(ToRegister(instr->key()).is(eax)); |
| Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); |
| - CallCode(ic, RelocInfo::CODE_TARGET, instr, CONTEXT_ADJUSTED); |
| + CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| } |
| @@ -2729,7 +2731,7 @@ void LCodeGen::DoCallConstantFunction(LCallConstantFunction* instr) { |
| void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr) { |
| - Register input_reg = ToRegister(instr->InputAt(0)); |
| + Register input_reg = ToRegister(instr->value()); |
| __ cmp(FieldOperand(input_reg, HeapObject::kMapOffset), |
| factory()->heap_number_map()); |
| DeoptimizeIf(not_equal, instr->environment()); |
| @@ -2760,7 +2762,8 @@ void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr) { |
| // Slow case: Call the runtime system to do the number allocation. |
| __ bind(&slow); |
| - CallRuntimeFromDeferred(Runtime::kAllocateHeapNumber, 0, instr); |
| + CallRuntimeFromDeferred(Runtime::kAllocateHeapNumber, 0, |
| + instr, instr->context()); |
| // Set the pointer to the new heap number in tmp. |
| if (!tmp.is(eax)) __ mov(tmp, eax); |
| @@ -2781,7 +2784,7 @@ void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr) { |
| void LCodeGen::EmitIntegerMathAbs(LUnaryMathOperation* instr) { |
| - Register input_reg = ToRegister(instr->InputAt(0)); |
| + Register input_reg = ToRegister(instr->value()); |
| __ test(input_reg, Operand(input_reg)); |
| Label is_positive; |
| __ j(not_sign, &is_positive); |
| @@ -2806,12 +2809,12 @@ void LCodeGen::DoMathAbs(LUnaryMathOperation* instr) { |
| LUnaryMathOperation* instr_; |
| }; |
| - ASSERT(instr->InputAt(0)->Equals(instr->result())); |
| + ASSERT(instr->value()->Equals(instr->result())); |
| Representation r = instr->hydrogen()->value()->representation(); |
| if (r.IsDouble()) { |
| XMMRegister scratch = xmm0; |
| - XMMRegister input_reg = ToDoubleRegister(instr->InputAt(0)); |
| + XMMRegister input_reg = ToDoubleRegister(instr->value()); |
| __ xorps(scratch, scratch); |
| __ subsd(scratch, input_reg); |
| __ pand(input_reg, scratch); |
| @@ -2820,7 +2823,7 @@ void LCodeGen::DoMathAbs(LUnaryMathOperation* instr) { |
| } else { // Tagged case. |
| DeferredMathAbsTaggedHeapNumber* deferred = |
| new DeferredMathAbsTaggedHeapNumber(this, instr); |
| - Register input_reg = ToRegister(instr->InputAt(0)); |
| + Register input_reg = ToRegister(instr->value()); |
| // Smi check. |
| __ JumpIfNotSmi(input_reg, deferred->entry()); |
| EmitIntegerMathAbs(instr); |
| @@ -2832,7 +2835,7 @@ void LCodeGen::DoMathAbs(LUnaryMathOperation* instr) { |
| void LCodeGen::DoMathFloor(LUnaryMathOperation* instr) { |
| XMMRegister xmm_scratch = xmm0; |
| Register output_reg = ToRegister(instr->result()); |
| - XMMRegister input_reg = ToDoubleRegister(instr->InputAt(0)); |
| + XMMRegister input_reg = ToDoubleRegister(instr->value()); |
| __ xorps(xmm_scratch, xmm_scratch); // Zero the register. |
| __ ucomisd(input_reg, xmm_scratch); |
| @@ -2854,7 +2857,7 @@ void LCodeGen::DoMathFloor(LUnaryMathOperation* instr) { |
| void LCodeGen::DoMathRound(LUnaryMathOperation* instr) { |
| XMMRegister xmm_scratch = xmm0; |
| Register output_reg = ToRegister(instr->result()); |
| - XMMRegister input_reg = ToDoubleRegister(instr->InputAt(0)); |
| + XMMRegister input_reg = ToDoubleRegister(instr->value()); |
| Label below_half, done; |
| // xmm_scratch = 0.5 |
| @@ -2899,7 +2902,7 @@ void LCodeGen::DoMathRound(LUnaryMathOperation* instr) { |
| void LCodeGen::DoMathSqrt(LUnaryMathOperation* instr) { |
| - XMMRegister input_reg = ToDoubleRegister(instr->InputAt(0)); |
| + XMMRegister input_reg = ToDoubleRegister(instr->value()); |
| ASSERT(ToDoubleRegister(instr->result()).is(input_reg)); |
| __ sqrtsd(input_reg, input_reg); |
| } |
| @@ -2907,7 +2910,7 @@ void LCodeGen::DoMathSqrt(LUnaryMathOperation* instr) { |
| void LCodeGen::DoMathPowHalf(LUnaryMathOperation* instr) { |
| XMMRegister xmm_scratch = xmm0; |
| - XMMRegister input_reg = ToDoubleRegister(instr->InputAt(0)); |
| + XMMRegister input_reg = ToDoubleRegister(instr->value()); |
| ASSERT(ToDoubleRegister(instr->result()).is(input_reg)); |
| __ xorps(xmm_scratch, xmm_scratch); |
| __ addsd(input_reg, xmm_scratch); // Convert -0 to +0. |
| @@ -2975,8 +2978,8 @@ void LCodeGen::DoPower(LPower* instr) { |
| void LCodeGen::DoMathLog(LUnaryMathOperation* instr) { |
| - ASSERT(instr->InputAt(0)->Equals(instr->result())); |
| - XMMRegister input_reg = ToDoubleRegister(instr->InputAt(0)); |
| + ASSERT(instr->value()->Equals(instr->result())); |
| + XMMRegister input_reg = ToDoubleRegister(instr->value()); |
| Label positive, done, zero; |
| __ xorps(xmm0, xmm0); |
| __ ucomisd(input_reg, xmm0); |
| @@ -3008,7 +3011,7 @@ void LCodeGen::DoMathCos(LUnaryMathOperation* instr) { |
| ASSERT(ToDoubleRegister(instr->result()).is(xmm1)); |
| TranscendentalCacheStub stub(TranscendentalCache::COS, |
| TranscendentalCacheStub::UNTAGGED); |
| - CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr, RESTORE_CONTEXT); |
| + CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| } |
| @@ -3016,7 +3019,7 @@ void LCodeGen::DoMathSin(LUnaryMathOperation* instr) { |
| ASSERT(ToDoubleRegister(instr->result()).is(xmm1)); |
| TranscendentalCacheStub stub(TranscendentalCache::SIN, |
| TranscendentalCacheStub::UNTAGGED); |
| - CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr, RESTORE_CONTEXT); |
| + CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| } |
| @@ -3076,7 +3079,7 @@ void LCodeGen::DoCallKeyed(LCallKeyed* instr) { |
| int arity = instr->arity(); |
| Handle<Code> ic = isolate()->stub_cache()-> |
| ComputeKeyedCallInitialize(arity, NOT_IN_LOOP); |
| - CallCode(ic, RelocInfo::CODE_TARGET, instr, CONTEXT_ADJUSTED); |
| + CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| } |
| @@ -3089,7 +3092,7 @@ void LCodeGen::DoCallNamed(LCallNamed* instr) { |
| Handle<Code> ic = |
| isolate()->stub_cache()->ComputeCallInitialize(arity, NOT_IN_LOOP, mode); |
| __ mov(ecx, instr->name()); |
| - CallCode(ic, mode, instr, CONTEXT_ADJUSTED); |
| + CallCode(ic, mode, instr); |
| } |
| @@ -3099,7 +3102,7 @@ void LCodeGen::DoCallFunction(LCallFunction* instr) { |
| int arity = instr->arity(); |
| CallFunctionStub stub(arity, NOT_IN_LOOP, RECEIVER_MIGHT_BE_IMPLICIT); |
| - CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr, CONTEXT_ADJUSTED); |
| + CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| __ Drop(1); |
| } |
| @@ -3113,7 +3116,7 @@ void LCodeGen::DoCallGlobal(LCallGlobal* instr) { |
| Handle<Code> ic = |
| isolate()->stub_cache()->ComputeCallInitialize(arity, NOT_IN_LOOP, mode); |
| __ mov(ecx, instr->name()); |
| - CallCode(ic, mode, instr, CONTEXT_ADJUSTED); |
| + CallCode(ic, mode, instr); |
| } |
| @@ -3131,12 +3134,12 @@ void LCodeGen::DoCallNew(LCallNew* instr) { |
| Handle<Code> builtin = isolate()->builtins()->JSConstructCall(); |
| __ Set(eax, Immediate(instr->arity())); |
| - CallCode(builtin, RelocInfo::CONSTRUCT_CALL, instr, CONTEXT_ADJUSTED); |
| + CallCode(builtin, RelocInfo::CONSTRUCT_CALL, instr); |
| } |
| void LCodeGen::DoCallRuntime(LCallRuntime* instr) { |
| - CallRuntime(instr->function(), instr->arity(), instr, RESTORE_CONTEXT); |
| + CallRuntime(instr->function(), instr->arity(), instr); |
| } |
| @@ -3179,7 +3182,7 @@ void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { |
| Handle<Code> ic = instr->strict_mode() |
| ? isolate()->builtins()->StoreIC_Initialize_Strict() |
| : isolate()->builtins()->StoreIC_Initialize(); |
| - CallCode(ic, RelocInfo::CODE_TARGET, instr, CONTEXT_ADJUSTED); |
| + CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| } |
| @@ -3269,7 +3272,7 @@ void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { |
| Handle<Code> ic = instr->strict_mode() |
| ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict() |
| : isolate()->builtins()->KeyedStoreIC_Initialize(); |
| - CallCode(ic, RelocInfo::CODE_TARGET, instr, CONTEXT_ADJUSTED); |
| + CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| } |
| @@ -3400,7 +3403,8 @@ void LCodeGen::DoDeferredStringCharCodeAt(LStringCharCodeAt* instr) { |
| __ SmiTag(index); |
| __ push(index); |
| } |
| - CallRuntimeFromDeferred(Runtime::kStringCharCodeAt, 2, instr); |
| + CallRuntimeFromDeferred(Runtime::kStringCharCodeAt, 2, |
| + instr, instr->context()); |
| if (FLAG_debug_code) { |
| __ AbortIfNotSmi(eax); |
| } |
| @@ -3451,7 +3455,7 @@ void LCodeGen::DoDeferredStringCharFromCode(LStringCharFromCode* instr) { |
| PushSafepointRegistersScope scope(this); |
| __ SmiTag(char_code); |
| __ push(char_code); |
| - CallRuntimeFromDeferred(Runtime::kCharFromCode, 1, instr); |
| + CallRuntimeFromDeferred(Runtime::kCharFromCode, 1, instr, instr->context()); |
| __ StoreToSafepointRegisterSlot(result, eax); |
| } |
| @@ -3475,7 +3479,7 @@ void LCodeGen::DoStringAdd(LStringAdd* instr) { |
| __ push(ToOperand(instr->right())); |
| } |
| StringAddStub stub(NO_STRING_CHECK_IN_STUB); |
| - CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr, RESTORE_CONTEXT); |
| + CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| } |
| @@ -3536,8 +3540,10 @@ void LCodeGen::DoDeferredNumberTagI(LNumberTagI* instr) { |
| // register is stored, as this register is in the pointer map, but contains an |
| // integer value. |
| __ StoreToSafepointRegisterSlot(reg, Immediate(0)); |
| - |
| - CallRuntimeFromDeferred(Runtime::kAllocateHeapNumber, 0, instr); |
| + __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
|
Kevin Millikin (Chromium)
2011/06/29 08:36:20
This needs a comment that we're potentially passin
William Hesse
2011/06/29 10:30:21
Done.
|
| + __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber); |
| + RecordSafepointWithRegisters( |
| + instr->pointer_map(), 0, Safepoint::kNoDeoptimizationIndex); |
| if (!reg.is(eax)) __ mov(reg, eax); |
| // Done. Put the value in xmm0 into the value of the allocated heap |
| @@ -3581,7 +3587,10 @@ void LCodeGen::DoDeferredNumberTagD(LNumberTagD* instr) { |
| __ Set(reg, Immediate(0)); |
| PushSafepointRegistersScope scope(this); |
| - CallRuntimeFromDeferred(Runtime::kAllocateHeapNumber, 0, instr); |
| + __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
| + __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber); |
| + RecordSafepointWithRegisters(instr->pointer_map(), 0, |
| + Safepoint::kNoDeoptimizationIndex); |
| __ StoreToSafepointRegisterSlot(reg, eax); |
| } |
| @@ -4051,6 +4060,7 @@ void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) { |
| void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) { |
| + ASSERT(ToRegister(instr->context()).is(esi)); |
| // Setup the parameters to the stub/runtime call. |
| __ mov(eax, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
| __ push(FieldOperand(eax, JSFunction::kLiteralsOffset)); |
| @@ -4064,16 +4074,17 @@ void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) { |
| FastCloneShallowArrayStub::Mode mode = |
| FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS; |
| FastCloneShallowArrayStub stub(mode, length); |
| - CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr, RESTORE_CONTEXT); |
| + CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| } else if (instr->hydrogen()->depth() > 1) { |
| - CallRuntime(Runtime::kCreateArrayLiteral, 3, instr, RESTORE_CONTEXT); |
| + CallRuntime(Runtime::kCreateArrayLiteral, 3, instr); |
| } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) { |
| - CallRuntime(Runtime::kCreateArrayLiteralShallow, 3, instr, RESTORE_CONTEXT); |
| + CallRuntime(Runtime::kCreateArrayLiteralShallow, 3, |
| + instr); |
| } else { |
| FastCloneShallowArrayStub::Mode mode = |
| FastCloneShallowArrayStub::CLONE_ELEMENTS; |
| FastCloneShallowArrayStub stub(mode, length); |
| - CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr, RESTORE_CONTEXT); |
| + CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| } |
| } |
| @@ -4095,12 +4106,11 @@ void LCodeGen::DoObjectLiteral(LObjectLiteral* instr) { |
| // Pick the right runtime function to call. |
| if (instr->hydrogen()->depth() > 1) { |
| - CallRuntime(Runtime::kCreateObjectLiteral, 4, instr, CONTEXT_ADJUSTED); |
| + CallRuntime(Runtime::kCreateObjectLiteral, 4, instr); |
| } else { |
| CallRuntime(Runtime::kCreateObjectLiteralShallow, |
| 4, |
| - instr, |
| - CONTEXT_ADJUSTED); |
| + instr); |
| } |
| } |
| @@ -4108,17 +4118,19 @@ void LCodeGen::DoObjectLiteral(LObjectLiteral* instr) { |
| void LCodeGen::DoToFastProperties(LToFastProperties* instr) { |
| ASSERT(ToRegister(instr->InputAt(0)).is(eax)); |
| __ push(eax); |
| - CallRuntime(Runtime::kToFastProperties, 1, instr, CONTEXT_ADJUSTED); |
| + CallRuntime(Runtime::kToFastProperties, 1, instr); |
| } |
| void LCodeGen::DoRegExpLiteral(LRegExpLiteral* instr) { |
| + ASSERT(ToRegister(instr->context()).is(esi)); |
| Label materialized; |
| // Registers will be used as follows: |
| // edi = JS function. |
| // ecx = literals array. |
| // ebx = regexp literal. |
| // eax = regexp literal clone. |
| + // esi = context. |
| __ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
| __ mov(ecx, FieldOperand(edi, JSFunction::kLiteralsOffset)); |
| int literal_offset = FixedArray::kHeaderSize + |
| @@ -4133,7 +4145,7 @@ void LCodeGen::DoRegExpLiteral(LRegExpLiteral* instr) { |
| __ push(Immediate(Smi::FromInt(instr->hydrogen()->literal_index()))); |
| __ push(Immediate(instr->hydrogen()->pattern())); |
| __ push(Immediate(instr->hydrogen()->flags())); |
| - CallRuntime(Runtime::kMaterializeRegExpLiteral, 4, instr, RESTORE_CONTEXT); |
| + CallRuntime(Runtime::kMaterializeRegExpLiteral, 4, instr); |
| __ mov(ebx, eax); |
| __ bind(&materialized); |
| @@ -4145,7 +4157,7 @@ void LCodeGen::DoRegExpLiteral(LRegExpLiteral* instr) { |
| __ bind(&runtime_allocate); |
| __ push(ebx); |
| __ push(Immediate(Smi::FromInt(size))); |
| - CallRuntime(Runtime::kAllocateInNewSpace, 1, instr, RESTORE_CONTEXT); |
| + CallRuntime(Runtime::kAllocateInNewSpace, 1, instr); |
| __ pop(ebx); |
| __ bind(&allocated); |
| @@ -4165,6 +4177,7 @@ void LCodeGen::DoRegExpLiteral(LRegExpLiteral* instr) { |
| void LCodeGen::DoFunctionLiteral(LFunctionLiteral* instr) { |
| + ASSERT(ToRegister(instr->context()).is(esi)); |
| // Use the fast case closure allocation code that allocates in new |
| // space for nested functions that don't need literals cloning. |
| Handle<SharedFunctionInfo> shared_info = instr->shared_info(); |
| @@ -4173,26 +4186,26 @@ void LCodeGen::DoFunctionLiteral(LFunctionLiteral* instr) { |
| FastNewClosureStub stub( |
| shared_info->strict_mode() ? kStrictMode : kNonStrictMode); |
| __ push(Immediate(shared_info)); |
| - CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr, RESTORE_CONTEXT); |
| + CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| } else { |
| __ push(Operand(ebp, StandardFrameConstants::kContextOffset)); |
| __ push(Immediate(shared_info)); |
| __ push(Immediate(pretenure |
| ? factory()->true_value() |
| : factory()->false_value())); |
| - CallRuntime(Runtime::kNewClosure, 3, instr, RESTORE_CONTEXT); |
| + CallRuntime(Runtime::kNewClosure, 3, instr); |
| } |
| } |
| void LCodeGen::DoTypeof(LTypeof* instr) { |
| - LOperand* input = instr->InputAt(0); |
| + LOperand* input = instr->InputAt(1); |
| if (input->IsConstantOperand()) { |
| __ push(ToImmediate(input)); |
| } else { |
| __ push(ToOperand(input)); |
| } |
| - CallRuntime(Runtime::kTypeof, 1, instr, RESTORE_CONTEXT); |
| + CallRuntime(Runtime::kTypeof, 1, instr); |
| } |
| @@ -4376,7 +4389,6 @@ void LCodeGen::DoDeleteProperty(LDeleteProperty* instr) { |
| SafepointGenerator safepoint_generator(this, |
| pointers, |
| env->deoptimization_index()); |
| - __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
| __ push(Immediate(Smi::FromInt(strict_mode_flag()))); |
| __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION, safepoint_generator); |
| } |
| @@ -4384,7 +4396,7 @@ void LCodeGen::DoDeleteProperty(LDeleteProperty* instr) { |
| void LCodeGen::DoDeferredStackCheck(LStackCheck* instr) { |
| PushSafepointRegistersScope scope(this); |
| - CallRuntimeFromDeferred(Runtime::kStackGuard, 0, instr); |
| + CallRuntimeFromDeferred(Runtime::kStackGuard, 0, instr, instr->context()); |
| } |
| @@ -4398,6 +4410,7 @@ void LCodeGen::DoStackCheck(LStackCheck* instr) { |
| LStackCheck* instr_; |
| }; |
| + // TODO(whesse): Fix with context. |
| if (instr->hydrogen()->is_function_entry()) { |
| // Perform stack overflow check. |
| Label done; |
| @@ -4406,8 +4419,10 @@ void LCodeGen::DoStackCheck(LStackCheck* instr) { |
| __ cmp(esp, Operand::StaticVariable(stack_limit)); |
| __ j(above_equal, &done, Label::kNear); |
| + ASSERT(instr->context()->IsRegister()); |
| + ASSERT(ToRegister(instr->context()).is(esi)); |
| StackCheckStub stub; |
| - CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr, RESTORE_CONTEXT); |
| + CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| __ bind(&done); |
| } else { |
| ASSERT(instr->hydrogen()->is_backwards_branch()); |
| @@ -4465,6 +4480,7 @@ void LCodeGen::DoIn(LIn* instr) { |
| SafepointGenerator safepoint_generator(this, |
| pointers, |
| env->deoptimization_index()); |
| + // TODO(whesse): FIX. |
| __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
| __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); |
| } |