Commit dfda85a9 authored by haitao.feng@intel.com's avatar haitao.feng@intel.com

Introduce PopReturnAddressTo and PushReturnAddressFrom macro-assembler instructions for X64

R=danno@chromium.org

Review URL: https://codereview.chromium.org/21477002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16034 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 5230c19d
...@@ -59,9 +59,9 @@ void Builtins::Generate_Adaptor(MacroAssembler* masm, ...@@ -59,9 +59,9 @@ void Builtins::Generate_Adaptor(MacroAssembler* masm,
int num_extra_args = 0; int num_extra_args = 0;
if (extra_args == NEEDS_CALLED_FUNCTION) { if (extra_args == NEEDS_CALLED_FUNCTION) {
num_extra_args = 1; num_extra_args = 1;
__ pop(kScratchRegister); // Save return address. __ PopReturnAddressTo(kScratchRegister);
__ push(rdi); __ push(rdi);
__ push(kScratchRegister); // Restore return address. __ PushReturnAddressFrom(kScratchRegister);
} else { } else {
ASSERT(extra_args == NO_EXTRA_ARGUMENTS); ASSERT(extra_args == NO_EXTRA_ARGUMENTS);
} }
...@@ -429,10 +429,10 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm, ...@@ -429,10 +429,10 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
} }
// Remove caller arguments from the stack and return. // Remove caller arguments from the stack and return.
__ pop(rcx); __ PopReturnAddressTo(rcx);
SmiIndex index = masm->SmiToIndex(rbx, rbx, kPointerSizeLog2); SmiIndex index = masm->SmiToIndex(rbx, rbx, kPointerSizeLog2);
__ lea(rsp, Operand(rsp, index.reg, index.scale, 1 * kPointerSize)); __ lea(rsp, Operand(rsp, index.reg, index.scale, 1 * kPointerSize));
__ push(rcx); __ PushReturnAddressFrom(rcx);
Counters* counters = masm->isolate()->counters(); Counters* counters = masm->isolate()->counters();
__ IncrementCounter(counters->constructed_objects(), 1); __ IncrementCounter(counters->constructed_objects(), 1);
__ ret(0); __ ret(0);
...@@ -772,9 +772,9 @@ void Builtins::Generate_FunctionCall(MacroAssembler* masm) { ...@@ -772,9 +772,9 @@ void Builtins::Generate_FunctionCall(MacroAssembler* masm) {
{ Label done; { Label done;
__ testq(rax, rax); __ testq(rax, rax);
__ j(not_zero, &done); __ j(not_zero, &done);
__ pop(rbx); __ PopReturnAddressTo(rbx);
__ Push(masm->isolate()->factory()->undefined_value()); __ Push(masm->isolate()->factory()->undefined_value());
__ push(rbx); __ PushReturnAddressFrom(rbx);
__ incq(rax); __ incq(rax);
__ bind(&done); __ bind(&done);
} }
...@@ -895,9 +895,9 @@ void Builtins::Generate_FunctionCall(MacroAssembler* masm) { ...@@ -895,9 +895,9 @@ void Builtins::Generate_FunctionCall(MacroAssembler* masm) {
__ cmpq(rdx, Immediate(1)); __ cmpq(rdx, Immediate(1));
__ j(not_equal, &non_proxy); __ j(not_equal, &non_proxy);
__ pop(rdx); // return address __ PopReturnAddressTo(rdx);
__ push(rdi); // re-add proxy object as additional argument __ push(rdi); // re-add proxy object as additional argument
__ push(rdx); __ PushReturnAddressFrom(rdx);
__ incq(rax); __ incq(rax);
__ GetBuiltinEntry(rdx, Builtins::CALL_FUNCTION_PROXY); __ GetBuiltinEntry(rdx, Builtins::CALL_FUNCTION_PROXY);
__ jmp(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), __ jmp(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
...@@ -1182,9 +1182,9 @@ void Builtins::Generate_StringConstructCode(MacroAssembler* masm) { ...@@ -1182,9 +1182,9 @@ void Builtins::Generate_StringConstructCode(MacroAssembler* masm) {
__ testq(rax, rax); __ testq(rax, rax);
__ j(zero, &no_arguments); __ j(zero, &no_arguments);
__ movq(rbx, Operand(rsp, rax, times_pointer_size, 0)); __ movq(rbx, Operand(rsp, rax, times_pointer_size, 0));
__ pop(rcx); __ PopReturnAddressTo(rcx);
__ lea(rsp, Operand(rsp, rax, times_pointer_size, kPointerSize)); __ lea(rsp, Operand(rsp, rax, times_pointer_size, kPointerSize));
__ push(rcx); __ PushReturnAddressFrom(rcx);
__ movq(rax, rbx); __ movq(rax, rbx);
// Lookup the argument in the number to string cache. // Lookup the argument in the number to string cache.
...@@ -1268,9 +1268,9 @@ void Builtins::Generate_StringConstructCode(MacroAssembler* masm) { ...@@ -1268,9 +1268,9 @@ void Builtins::Generate_StringConstructCode(MacroAssembler* masm) {
// stack, and jump back to the case where the argument is a string. // stack, and jump back to the case where the argument is a string.
__ bind(&no_arguments); __ bind(&no_arguments);
__ LoadRoot(rbx, Heap::kempty_stringRootIndex); __ LoadRoot(rbx, Heap::kempty_stringRootIndex);
__ pop(rcx); __ PopReturnAddressTo(rcx);
__ lea(rsp, Operand(rsp, kPointerSize)); __ lea(rsp, Operand(rsp, kPointerSize));
__ push(rcx); __ PushReturnAddressFrom(rcx);
__ jmp(&argument_is_string); __ jmp(&argument_is_string);
// At this point the argument is already a string. Call runtime to // At this point the argument is already a string. Call runtime to
...@@ -1313,10 +1313,10 @@ static void LeaveArgumentsAdaptorFrame(MacroAssembler* masm) { ...@@ -1313,10 +1313,10 @@ static void LeaveArgumentsAdaptorFrame(MacroAssembler* masm) {
__ pop(rbp); __ pop(rbp);
// Remove caller arguments from the stack. // Remove caller arguments from the stack.
__ pop(rcx); __ PopReturnAddressTo(rcx);
SmiIndex index = masm->SmiToIndex(rbx, rbx, kPointerSizeLog2); SmiIndex index = masm->SmiToIndex(rbx, rbx, kPointerSizeLog2);
__ lea(rsp, Operand(rsp, index.reg, index.scale, 1 * kPointerSize)); __ lea(rsp, Operand(rsp, index.reg, index.scale, 1 * kPointerSize));
__ push(rcx); __ PushReturnAddressFrom(rcx);
} }
......
...@@ -430,12 +430,12 @@ void FastNewClosureStub::Generate(MacroAssembler* masm) { ...@@ -430,12 +430,12 @@ void FastNewClosureStub::Generate(MacroAssembler* masm) {
// Create a new closure through the slower runtime call. // Create a new closure through the slower runtime call.
__ bind(&gc); __ bind(&gc);
__ pop(rcx); // Temporarily remove return address. __ PopReturnAddressTo(rcx);
__ pop(rdx); __ pop(rdx);
__ push(rsi); __ push(rsi);
__ push(rdx); __ push(rdx);
__ PushRoot(Heap::kFalseValueRootIndex); __ PushRoot(Heap::kFalseValueRootIndex);
__ push(rcx); // Restore return address. __ PushReturnAddressFrom(rcx);
__ TailCallRuntime(Runtime::kNewClosure, 3, 1); __ TailCallRuntime(Runtime::kNewClosure, 3, 1);
} }
...@@ -694,13 +694,13 @@ void BinaryOpStub::Initialize() {} ...@@ -694,13 +694,13 @@ void BinaryOpStub::Initialize() {}
void BinaryOpStub::GenerateTypeTransition(MacroAssembler* masm) { void BinaryOpStub::GenerateTypeTransition(MacroAssembler* masm) {
__ pop(rcx); // Save return address. __ PopReturnAddressTo(rcx);
__ push(rdx); __ push(rdx);
__ push(rax); __ push(rax);
// Left and right arguments are now on top. // Left and right arguments are now on top.
__ Push(Smi::FromInt(MinorKey())); __ Push(Smi::FromInt(MinorKey()));
__ push(rcx); // Push return address. __ PushReturnAddressFrom(rcx);
// Patch the caller to an appropriate specialized stub and return the // Patch the caller to an appropriate specialized stub and return the
// operation result to the caller of the stub. // operation result to the caller of the stub.
...@@ -982,10 +982,10 @@ static void BinaryOpStub_GenerateRegisterArgsPushUnderReturn( ...@@ -982,10 +982,10 @@ static void BinaryOpStub_GenerateRegisterArgsPushUnderReturn(
MacroAssembler* masm) { MacroAssembler* masm) {
// Push arguments, but ensure they are under the return address // Push arguments, but ensure they are under the return address
// for a tail call. // for a tail call.
__ pop(rcx); __ PopReturnAddressTo(rcx);
__ push(rdx); __ push(rdx);
__ push(rax); __ push(rax);
__ push(rcx); __ PushReturnAddressFrom(rcx);
} }
...@@ -2153,10 +2153,10 @@ void StoreArrayLengthStub::Generate(MacroAssembler* masm) { ...@@ -2153,10 +2153,10 @@ void StoreArrayLengthStub::Generate(MacroAssembler* masm) {
__ JumpIfNotSmi(value, &miss); __ JumpIfNotSmi(value, &miss);
// Prepare tail call to StoreIC_ArrayLength. // Prepare tail call to StoreIC_ArrayLength.
__ pop(scratch); __ PopReturnAddressTo(scratch);
__ push(receiver); __ push(receiver);
__ push(value); __ push(value);
__ push(scratch); // return address __ PushReturnAddressFrom(scratch);
ExternalReference ref = ExternalReference ref =
ExternalReference(IC_Utility(IC::kStoreIC_ArrayLength), masm->isolate()); ExternalReference(IC_Utility(IC::kStoreIC_ArrayLength), masm->isolate());
...@@ -2222,9 +2222,9 @@ void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { ...@@ -2222,9 +2222,9 @@ void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) {
// Slow-case: Handle non-smi or out-of-bounds access to arguments // Slow-case: Handle non-smi or out-of-bounds access to arguments
// by calling the runtime system. // by calling the runtime system.
__ bind(&slow); __ bind(&slow);
__ pop(rbx); // Return address. __ PopReturnAddressTo(rbx);
__ push(rdx); __ push(rdx);
__ push(rbx); __ PushReturnAddressFrom(rbx);
__ TailCallRuntime(Runtime::kGetArgumentsProperty, 1, 1); __ TailCallRuntime(Runtime::kGetArgumentsProperty, 1, 1);
} }
...@@ -3484,7 +3484,7 @@ void ICCompareStub::GenerateGeneric(MacroAssembler* masm) { ...@@ -3484,7 +3484,7 @@ void ICCompareStub::GenerateGeneric(MacroAssembler* masm) {
} }
// Push arguments below the return address to prepare jump to builtin. // Push arguments below the return address to prepare jump to builtin.
__ pop(rcx); __ PopReturnAddressTo(rcx);
__ push(rdx); __ push(rdx);
__ push(rax); __ push(rax);
...@@ -3497,8 +3497,7 @@ void ICCompareStub::GenerateGeneric(MacroAssembler* masm) { ...@@ -3497,8 +3497,7 @@ void ICCompareStub::GenerateGeneric(MacroAssembler* masm) {
__ Push(Smi::FromInt(NegativeComparisonResult(cc))); __ Push(Smi::FromInt(NegativeComparisonResult(cc)));
} }
// Restore return address on the stack. __ PushReturnAddressFrom(rcx);
__ push(rcx);
// Call the native; it returns -1 (less), 0 (equal), or 1 (greater) // Call the native; it returns -1 (less), 0 (equal), or 1 (greater)
// tagged as a small integer. // tagged as a small integer.
...@@ -3667,9 +3666,9 @@ void CallFunctionStub::Generate(MacroAssembler* masm) { ...@@ -3667,9 +3666,9 @@ void CallFunctionStub::Generate(MacroAssembler* masm) {
// Check for function proxy. // Check for function proxy.
__ CmpInstanceType(rcx, JS_FUNCTION_PROXY_TYPE); __ CmpInstanceType(rcx, JS_FUNCTION_PROXY_TYPE);
__ j(not_equal, &non_function); __ j(not_equal, &non_function);
__ pop(rcx); __ PopReturnAddressTo(rcx);
__ push(rdi); // put proxy as additional argument under return address __ push(rdi); // put proxy as additional argument under return address
__ push(rcx); __ PushReturnAddressFrom(rcx);
__ Set(rax, argc_ + 1); __ Set(rax, argc_ + 1);
__ Set(rbx, 0); __ Set(rbx, 0);
__ SetCallKind(rcx, CALL_AS_METHOD); __ SetCallKind(rcx, CALL_AS_METHOD);
...@@ -4347,9 +4346,9 @@ void InstanceofStub::Generate(MacroAssembler* masm) { ...@@ -4347,9 +4346,9 @@ void InstanceofStub::Generate(MacroAssembler* masm) {
__ bind(&slow); __ bind(&slow);
if (HasCallSiteInlineCheck()) { if (HasCallSiteInlineCheck()) {
// Remove extra value from the stack. // Remove extra value from the stack.
__ pop(rcx); __ PopReturnAddressTo(rcx);
__ pop(rax); __ pop(rax);
__ push(rcx); __ PushReturnAddressFrom(rcx);
} }
__ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION);
} }
...@@ -4820,10 +4819,10 @@ void StringAddStub::GenerateRegisterArgsPush(MacroAssembler* masm) { ...@@ -4820,10 +4819,10 @@ void StringAddStub::GenerateRegisterArgsPush(MacroAssembler* masm) {
void StringAddStub::GenerateRegisterArgsPop(MacroAssembler* masm, void StringAddStub::GenerateRegisterArgsPop(MacroAssembler* masm,
Register temp) { Register temp) {
__ pop(temp); __ PopReturnAddressTo(temp);
__ pop(rdx); __ pop(rdx);
__ pop(rax); __ pop(rax);
__ push(temp); __ PushReturnAddressFrom(temp);
} }
...@@ -5527,9 +5526,9 @@ void StringCompareStub::Generate(MacroAssembler* masm) { ...@@ -5527,9 +5526,9 @@ void StringCompareStub::Generate(MacroAssembler* masm) {
// Inline comparison of ASCII strings. // Inline comparison of ASCII strings.
__ IncrementCounter(counters->string_compare_native(), 1); __ IncrementCounter(counters->string_compare_native(), 1);
// Drop arguments from the stack // Drop arguments from the stack
__ pop(rcx); __ PopReturnAddressTo(rcx);
__ addq(rsp, Immediate(2 * kPointerSize)); __ addq(rsp, Immediate(2 * kPointerSize));
__ push(rcx); __ PushReturnAddressFrom(rcx);
GenerateCompareFlatAsciiStrings(masm, rdx, rax, rcx, rbx, rdi, r8); GenerateCompareFlatAsciiStrings(masm, rdx, rax, rcx, rbx, rdi, r8);
// Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater)
...@@ -5798,10 +5797,10 @@ void ICCompareStub::GenerateStrings(MacroAssembler* masm) { ...@@ -5798,10 +5797,10 @@ void ICCompareStub::GenerateStrings(MacroAssembler* masm) {
// Handle more complex cases in runtime. // Handle more complex cases in runtime.
__ bind(&runtime); __ bind(&runtime);
__ pop(tmp1); // Return address. __ PopReturnAddressTo(tmp1);
__ push(left); __ push(left);
__ push(right); __ push(right);
__ push(tmp1); __ PushReturnAddressFrom(tmp1);
if (equality) { if (equality) {
__ TailCallRuntime(Runtime::kStringEquals, 2, 1); __ TailCallRuntime(Runtime::kStringEquals, 2, 1);
} else { } else {
...@@ -6409,16 +6408,14 @@ void StoreArrayLiteralElementStub::Generate(MacroAssembler* masm) { ...@@ -6409,16 +6408,14 @@ void StoreArrayLiteralElementStub::Generate(MacroAssembler* masm) {
// the runtime. // the runtime.
__ bind(&slow_elements); __ bind(&slow_elements);
__ pop(rdi); // Pop return address and remember to put back later for tail __ PopReturnAddressTo(rdi);
// call.
__ push(rbx); __ push(rbx);
__ push(rcx); __ push(rcx);
__ push(rax); __ push(rax);
__ movq(rbx, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); __ movq(rbx, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
__ push(FieldOperand(rbx, JSFunction::kLiteralsOffset)); __ push(FieldOperand(rbx, JSFunction::kLiteralsOffset));
__ push(rdx); __ push(rdx);
__ push(rdi); // Return return address so that tail call returns to right __ PushReturnAddressFrom(rdi);
// place.
__ TailCallRuntime(Runtime::kStoreArrayLiteralElement, 5, 1); __ TailCallRuntime(Runtime::kStoreArrayLiteralElement, 5, 1);
// Array literal has ElementsKind of FAST_*_ELEMENTS and value is an object. // Array literal has ElementsKind of FAST_*_ELEMENTS and value is an object.
...@@ -6465,7 +6462,7 @@ void StubFailureTrampolineStub::Generate(MacroAssembler* masm) { ...@@ -6465,7 +6462,7 @@ void StubFailureTrampolineStub::Generate(MacroAssembler* masm) {
StubFailureTrampolineFrame::kCallerStackParameterCountFrameOffset; StubFailureTrampolineFrame::kCallerStackParameterCountFrameOffset;
__ movq(rbx, MemOperand(rbp, parameter_count_offset)); __ movq(rbx, MemOperand(rbp, parameter_count_offset));
masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE);
__ pop(rcx); __ PopReturnAddressTo(rcx);
int additional_offset = function_mode_ == JS_FUNCTION_STUB_MODE int additional_offset = function_mode_ == JS_FUNCTION_STUB_MODE
? kPointerSize ? kPointerSize
: 0; : 0;
......
...@@ -4816,7 +4816,7 @@ void FullCodeGenerator::EnterFinallyBlock() { ...@@ -4816,7 +4816,7 @@ void FullCodeGenerator::EnterFinallyBlock() {
ASSERT(!result_register().is(rdx)); ASSERT(!result_register().is(rdx));
ASSERT(!result_register().is(rcx)); ASSERT(!result_register().is(rcx));
// Cook return address on top of stack (smi encoded Code* delta) // Cook return address on top of stack (smi encoded Code* delta)
__ pop(rdx); __ PopReturnAddressTo(rdx);
__ Move(rcx, masm_->CodeObject()); __ Move(rcx, masm_->CodeObject());
__ subq(rdx, rcx); __ subq(rdx, rcx);
__ Integer32ToSmi(rdx, rdx); __ Integer32ToSmi(rdx, rdx);
......
...@@ -570,10 +570,10 @@ void KeyedLoadIC::GenerateIndexedInterceptor(MacroAssembler* masm) { ...@@ -570,10 +570,10 @@ void KeyedLoadIC::GenerateIndexedInterceptor(MacroAssembler* masm) {
__ j(not_zero, &slow); __ j(not_zero, &slow);
// Everything is fine, call runtime. // Everything is fine, call runtime.
__ pop(rcx); __ PopReturnAddressTo(rcx);
__ push(rdx); // receiver __ push(rdx); // receiver
__ push(rax); // key __ push(rax); // key
__ push(rcx); // return address __ PushReturnAddressFrom(rcx);
// Perform tail call to the entry. // Perform tail call to the entry.
__ TailCallExternalReference( __ TailCallExternalReference(
...@@ -1369,10 +1369,10 @@ void LoadIC::GenerateMiss(MacroAssembler* masm) { ...@@ -1369,10 +1369,10 @@ void LoadIC::GenerateMiss(MacroAssembler* masm) {
Counters* counters = masm->isolate()->counters(); Counters* counters = masm->isolate()->counters();
__ IncrementCounter(counters->load_miss(), 1); __ IncrementCounter(counters->load_miss(), 1);
__ pop(rbx); __ PopReturnAddressTo(rbx);
__ push(rax); // receiver __ push(rax); // receiver
__ push(rcx); // name __ push(rcx); // name
__ push(rbx); // return address __ PushReturnAddressFrom(rbx);
// Perform tail call to the entry. // Perform tail call to the entry.
ExternalReference ref = ExternalReference ref =
...@@ -1388,10 +1388,10 @@ void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { ...@@ -1388,10 +1388,10 @@ void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) {
// -- rsp[0] : return address // -- rsp[0] : return address
// ----------------------------------- // -----------------------------------
__ pop(rbx); __ PopReturnAddressTo(rbx);
__ push(rax); // receiver __ push(rax); // receiver
__ push(rcx); // name __ push(rcx); // name
__ push(rbx); // return address __ PushReturnAddressFrom(rbx);
// Perform tail call to the entry. // Perform tail call to the entry.
__ TailCallRuntime(Runtime::kGetProperty, 2, 1); __ TailCallRuntime(Runtime::kGetProperty, 2, 1);
...@@ -1408,10 +1408,10 @@ void KeyedLoadIC::GenerateMiss(MacroAssembler* masm, ICMissMode miss_mode) { ...@@ -1408,10 +1408,10 @@ void KeyedLoadIC::GenerateMiss(MacroAssembler* masm, ICMissMode miss_mode) {
Counters* counters = masm->isolate()->counters(); Counters* counters = masm->isolate()->counters();
__ IncrementCounter(counters->keyed_load_miss(), 1); __ IncrementCounter(counters->keyed_load_miss(), 1);
__ pop(rbx); __ PopReturnAddressTo(rbx);
__ push(rdx); // receiver __ push(rdx); // receiver
__ push(rax); // name __ push(rax); // name
__ push(rbx); // return address __ PushReturnAddressFrom(rbx);
// Perform tail call to the entry. // Perform tail call to the entry.
ExternalReference ref = miss_mode == MISS_FORCE_GENERIC ExternalReference ref = miss_mode == MISS_FORCE_GENERIC
...@@ -1429,10 +1429,10 @@ void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { ...@@ -1429,10 +1429,10 @@ void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) {
// -- rsp[0] : return address // -- rsp[0] : return address
// ----------------------------------- // -----------------------------------
__ pop(rbx); __ PopReturnAddressTo(rbx);
__ push(rdx); // receiver __ push(rdx); // receiver
__ push(rax); // name __ push(rax); // name
__ push(rbx); // return address __ PushReturnAddressFrom(rbx);
// Perform tail call to the entry. // Perform tail call to the entry.
__ TailCallRuntime(Runtime::kKeyedGetProperty, 2, 1); __ TailCallRuntime(Runtime::kKeyedGetProperty, 2, 1);
...@@ -1468,11 +1468,11 @@ void StoreIC::GenerateMiss(MacroAssembler* masm) { ...@@ -1468,11 +1468,11 @@ void StoreIC::GenerateMiss(MacroAssembler* masm) {
// -- rsp[0] : return address // -- rsp[0] : return address
// ----------------------------------- // -----------------------------------
__ pop(rbx); __ PopReturnAddressTo(rbx);
__ push(rdx); // receiver __ push(rdx); // receiver
__ push(rcx); // name __ push(rcx); // name
__ push(rax); // value __ push(rax); // value
__ push(rbx); // return address __ PushReturnAddressFrom(rbx);
// Perform tail call to the entry. // Perform tail call to the entry.
ExternalReference ref = ExternalReference ref =
...@@ -1512,13 +1512,13 @@ void StoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm, ...@@ -1512,13 +1512,13 @@ void StoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm,
// -- rdx : receiver // -- rdx : receiver
// -- rsp[0] : return address // -- rsp[0] : return address
// ----------------------------------- // -----------------------------------
__ pop(rbx); __ PopReturnAddressTo(rbx);
__ push(rdx); __ push(rdx);
__ push(rcx); __ push(rcx);
__ push(rax); __ push(rax);
__ Push(Smi::FromInt(NONE)); // PropertyAttributes __ Push(Smi::FromInt(NONE)); // PropertyAttributes
__ Push(Smi::FromInt(strict_mode)); __ Push(Smi::FromInt(strict_mode));
__ push(rbx); // return address __ PushReturnAddressFrom(rbx);
// Do tail-call to runtime routine. // Do tail-call to runtime routine.
__ TailCallRuntime(Runtime::kSetProperty, 5, 1); __ TailCallRuntime(Runtime::kSetProperty, 5, 1);
...@@ -1534,13 +1534,13 @@ void KeyedStoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm, ...@@ -1534,13 +1534,13 @@ void KeyedStoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm,
// -- rsp[0] : return address // -- rsp[0] : return address
// ----------------------------------- // -----------------------------------
__ pop(rbx); __ PopReturnAddressTo(rbx);
__ push(rdx); // receiver __ push(rdx); // receiver
__ push(rcx); // key __ push(rcx); // key
__ push(rax); // value __ push(rax); // value
__ Push(Smi::FromInt(NONE)); // PropertyAttributes __ Push(Smi::FromInt(NONE)); // PropertyAttributes
__ Push(Smi::FromInt(strict_mode)); // Strict mode. __ Push(Smi::FromInt(strict_mode)); // Strict mode.
__ push(rbx); // return address __ PushReturnAddressFrom(rbx);
// Do tail-call to runtime routine. // Do tail-call to runtime routine.
__ TailCallRuntime(Runtime::kSetProperty, 5, 1); __ TailCallRuntime(Runtime::kSetProperty, 5, 1);
...@@ -1555,11 +1555,11 @@ void StoreIC::GenerateSlow(MacroAssembler* masm) { ...@@ -1555,11 +1555,11 @@ void StoreIC::GenerateSlow(MacroAssembler* masm) {
// -- rsp[0] : return address // -- rsp[0] : return address
// ----------------------------------- // -----------------------------------
__ pop(rbx); __ PopReturnAddressTo(rbx);
__ push(rdx); // receiver __ push(rdx); // receiver
__ push(rcx); // key __ push(rcx); // key
__ push(rax); // value __ push(rax); // value
__ push(rbx); // return address __ PushReturnAddressFrom(rbx);
// Do tail-call to runtime routine. // Do tail-call to runtime routine.
ExternalReference ref(IC_Utility(kStoreIC_Slow), masm->isolate()); ExternalReference ref(IC_Utility(kStoreIC_Slow), masm->isolate());
...@@ -1575,11 +1575,11 @@ void KeyedStoreIC::GenerateSlow(MacroAssembler* masm) { ...@@ -1575,11 +1575,11 @@ void KeyedStoreIC::GenerateSlow(MacroAssembler* masm) {
// -- rsp[0] : return address // -- rsp[0] : return address
// ----------------------------------- // -----------------------------------
__ pop(rbx); __ PopReturnAddressTo(rbx);
__ push(rdx); // receiver __ push(rdx); // receiver
__ push(rcx); // key __ push(rcx); // key
__ push(rax); // value __ push(rax); // value
__ push(rbx); // return address __ PushReturnAddressFrom(rbx);
// Do tail-call to runtime routine. // Do tail-call to runtime routine.
ExternalReference ref(IC_Utility(kKeyedStoreIC_Slow), masm->isolate()); ExternalReference ref(IC_Utility(kKeyedStoreIC_Slow), masm->isolate());
...@@ -1595,11 +1595,11 @@ void KeyedStoreIC::GenerateMiss(MacroAssembler* masm, ICMissMode miss_mode) { ...@@ -1595,11 +1595,11 @@ void KeyedStoreIC::GenerateMiss(MacroAssembler* masm, ICMissMode miss_mode) {
// -- rsp[0] : return address // -- rsp[0] : return address
// ----------------------------------- // -----------------------------------
__ pop(rbx); __ PopReturnAddressTo(rbx);
__ push(rdx); // receiver __ push(rdx); // receiver
__ push(rcx); // key __ push(rcx); // key
__ push(rax); // value __ push(rax); // value
__ push(rbx); // return address __ PushReturnAddressFrom(rbx);
// Do tail-call to runtime routine. // Do tail-call to runtime routine.
ExternalReference ref = miss_mode == MISS_FORCE_GENERIC ExternalReference ref = miss_mode == MISS_FORCE_GENERIC
......
...@@ -2568,7 +2568,7 @@ void LCodeGen::DoReturn(LReturn* instr) { ...@@ -2568,7 +2568,7 @@ void LCodeGen::DoReturn(LReturn* instr) {
// The argument count parameter is a smi // The argument count parameter is a smi
__ SmiToInteger32(reg, reg); __ SmiToInteger32(reg, reg);
Register return_addr_reg = reg.is(rcx) ? rbx : rcx; Register return_addr_reg = reg.is(rcx) ? rbx : rcx;
__ pop(return_addr_reg); __ PopReturnAddressTo(return_addr_reg);
__ shl(reg, Immediate(kPointerSizeLog2)); __ shl(reg, Immediate(kPointerSizeLog2));
__ addq(rsp, reg); __ addq(rsp, reg);
__ jmp(return_addr_reg); __ jmp(return_addr_reg);
......
...@@ -2799,9 +2799,9 @@ void MacroAssembler::Ret(int bytes_dropped, Register scratch) { ...@@ -2799,9 +2799,9 @@ void MacroAssembler::Ret(int bytes_dropped, Register scratch) {
if (is_uint16(bytes_dropped)) { if (is_uint16(bytes_dropped)) {
ret(bytes_dropped); ret(bytes_dropped);
} else { } else {
pop(scratch); PopReturnAddressTo(scratch);
addq(rsp, Immediate(bytes_dropped)); addq(rsp, Immediate(bytes_dropped));
push(scratch); PushReturnAddressFrom(scratch);
ret(0); ret(0);
} }
} }
...@@ -3568,8 +3568,7 @@ void MacroAssembler::LeaveExitFrame(bool save_doubles) { ...@@ -3568,8 +3568,7 @@ void MacroAssembler::LeaveExitFrame(bool save_doubles) {
// from the caller stack. // from the caller stack.
lea(rsp, Operand(r15, 1 * kPointerSize)); lea(rsp, Operand(r15, 1 * kPointerSize));
// Push the return address to get ready to return. PushReturnAddressFrom(rcx);
push(rcx);
LeaveExitFrameEpilogue(); LeaveExitFrameEpilogue();
} }
......
...@@ -823,6 +823,8 @@ class MacroAssembler: public Assembler { ...@@ -823,6 +823,8 @@ class MacroAssembler: public Assembler {
void Drop(int stack_elements); void Drop(int stack_elements);
void Call(Label* target) { call(target); } void Call(Label* target) { call(target); }
void PushReturnAddressFrom(Register src) { push(src); }
void PopReturnAddressTo(Register dst) { pop(dst); }
// Control Flow // Control Flow
void Jump(Address destination, RelocInfo::Mode rmode); void Jump(Address destination, RelocInfo::Mode rmode);
......
...@@ -830,11 +830,11 @@ void BaseStoreStubCompiler::GenerateStoreTransition(MacroAssembler* masm, ...@@ -830,11 +830,11 @@ void BaseStoreStubCompiler::GenerateStoreTransition(MacroAssembler* masm,
object->map()->unused_property_fields() == 0) { object->map()->unused_property_fields() == 0) {
// The properties must be extended before we can store the value. // The properties must be extended before we can store the value.
// We jump to a runtime call that extends the properties array. // We jump to a runtime call that extends the properties array.
__ pop(scratch1); // Return address. __ PopReturnAddressTo(scratch1);
__ push(receiver_reg); __ push(receiver_reg);
__ Push(transition); __ Push(transition);
__ push(value_reg); __ push(value_reg);
__ push(scratch1); __ PushReturnAddressFrom(scratch1);
__ TailCallExternalReference( __ TailCallExternalReference(
ExternalReference(IC_Utility(IC::kSharedStoreIC_ExtendStorage), ExternalReference(IC_Utility(IC::kSharedStoreIC_ExtendStorage),
masm->isolate()), masm->isolate()),
...@@ -1284,7 +1284,7 @@ void BaseLoadStubCompiler::GenerateLoadCallback( ...@@ -1284,7 +1284,7 @@ void BaseLoadStubCompiler::GenerateLoadCallback(
Handle<ExecutableAccessorInfo> callback) { Handle<ExecutableAccessorInfo> callback) {
// Insert additional parameters into the stack frame above return address. // Insert additional parameters into the stack frame above return address.
ASSERT(!scratch4().is(reg)); ASSERT(!scratch4().is(reg));
__ pop(scratch4()); // Get return address to place it below. __ PopReturnAddressTo(scratch4());
__ push(receiver()); // receiver __ push(receiver()); // receiver
__ push(reg); // holder __ push(reg); // holder
...@@ -1324,7 +1324,7 @@ void BaseLoadStubCompiler::GenerateLoadCallback( ...@@ -1324,7 +1324,7 @@ void BaseLoadStubCompiler::GenerateLoadCallback(
ASSERT(!name_arg.is(scratch4())); ASSERT(!name_arg.is(scratch4()));
__ movq(name_arg, rsp); __ movq(name_arg, rsp);
__ push(scratch4()); // Restore return address. __ PushReturnAddressFrom(scratch4());
// v8::Arguments::values_ and handler for name. // v8::Arguments::values_ and handler for name.
const int kStackSpace = PropertyCallbackArguments::kArgsLength + 1; const int kStackSpace = PropertyCallbackArguments::kArgsLength + 1;
...@@ -1444,10 +1444,10 @@ void BaseLoadStubCompiler::GenerateLoadInterceptor( ...@@ -1444,10 +1444,10 @@ void BaseLoadStubCompiler::GenerateLoadInterceptor(
} else { // !compile_followup_inline } else { // !compile_followup_inline
// Call the runtime system to load the interceptor. // Call the runtime system to load the interceptor.
// Check that the maps haven't changed. // Check that the maps haven't changed.
__ pop(scratch2()); // save old return address __ PopReturnAddressTo(scratch2());
PushInterceptorArguments(masm(), receiver(), holder_reg, PushInterceptorArguments(masm(), receiver(), holder_reg,
this->name(), interceptor_holder); this->name(), interceptor_holder);
__ push(scratch2()); // restore old return address __ PushReturnAddressFrom(scratch2());
ExternalReference ref = ExternalReference( ExternalReference ref = ExternalReference(
IC_Utility(IC::kLoadPropertyWithInterceptorForLoad), isolate()); IC_Utility(IC::kLoadPropertyWithInterceptorForLoad), isolate());
...@@ -2650,12 +2650,12 @@ Handle<Code> StoreStubCompiler::CompileStoreCallback( ...@@ -2650,12 +2650,12 @@ Handle<Code> StoreStubCompiler::CompileStoreCallback(
HandlerFrontend(object, receiver(), holder, name, &success); HandlerFrontend(object, receiver(), holder, name, &success);
__ bind(&success); __ bind(&success);
__ pop(scratch1()); // remove the return address __ PopReturnAddressTo(scratch1());
__ push(receiver()); __ push(receiver());
__ Push(callback); // callback info __ Push(callback); // callback info
__ Push(name); __ Push(name);
__ push(value()); __ push(value());
__ push(scratch1()); // restore return address __ PushReturnAddressFrom(scratch1());
// Do tail-call to the runtime system. // Do tail-call to the runtime system.
ExternalReference store_callback_property = ExternalReference store_callback_property =
...@@ -2717,12 +2717,12 @@ void StoreStubCompiler::GenerateStoreViaSetter( ...@@ -2717,12 +2717,12 @@ void StoreStubCompiler::GenerateStoreViaSetter(
Handle<Code> StoreStubCompiler::CompileStoreInterceptor( Handle<Code> StoreStubCompiler::CompileStoreInterceptor(
Handle<JSObject> object, Handle<JSObject> object,
Handle<Name> name) { Handle<Name> name) {
__ pop(scratch1()); // remove the return address __ PopReturnAddressTo(scratch1());
__ push(receiver()); __ push(receiver());
__ push(this->name()); __ push(this->name());
__ push(value()); __ push(value());
__ Push(Smi::FromInt(strict_mode())); __ Push(Smi::FromInt(strict_mode()));
__ push(scratch1()); // restore return address __ PushReturnAddressFrom(scratch1());
// Do tail-call to the runtime system. // Do tail-call to the runtime system.
ExternalReference store_ic_property = ExternalReference store_ic_property =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment