int num_extra_args = 0;
if (extra_args == NEEDS_CALLED_FUNCTION) {
num_extra_args = 1;
- __ pop(kScratchRegister); // Save return address.
+ __ PopReturnAddressTo(kScratchRegister);
__ push(rdi);
- __ push(kScratchRegister); // Restore return address.
+ __ PushReturnAddressFrom(kScratchRegister);
} else {
ASSERT(extra_args == NO_EXTRA_ARGUMENTS);
}
}
// Remove caller arguments from the stack and return.
- __ pop(rcx);
+ __ PopReturnAddressTo(rcx);
SmiIndex index = masm->SmiToIndex(rbx, rbx, kPointerSizeLog2);
__ lea(rsp, Operand(rsp, index.reg, index.scale, 1 * kPointerSize));
- __ push(rcx);
+ __ PushReturnAddressFrom(rcx);
Counters* counters = masm->isolate()->counters();
__ IncrementCounter(counters->constructed_objects(), 1);
__ ret(0);
{ Label done;
__ testq(rax, rax);
__ j(not_zero, &done);
- __ pop(rbx);
+ __ PopReturnAddressTo(rbx);
__ Push(masm->isolate()->factory()->undefined_value());
- __ push(rbx);
+ __ PushReturnAddressFrom(rbx);
__ incq(rax);
__ bind(&done);
}
__ cmpq(rdx, Immediate(1));
__ j(not_equal, &non_proxy);
- __ pop(rdx); // return address
+ __ PopReturnAddressTo(rdx);
__ push(rdi); // re-add proxy object as additional argument
- __ push(rdx);
+ __ PushReturnAddressFrom(rdx);
__ incq(rax);
__ GetBuiltinEntry(rdx, Builtins::CALL_FUNCTION_PROXY);
__ jmp(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
__ testq(rax, rax);
__ j(zero, &no_arguments);
__ movq(rbx, Operand(rsp, rax, times_pointer_size, 0));
- __ pop(rcx);
+ __ PopReturnAddressTo(rcx);
__ lea(rsp, Operand(rsp, rax, times_pointer_size, kPointerSize));
- __ push(rcx);
+ __ PushReturnAddressFrom(rcx);
__ movq(rax, rbx);
// Lookup the argument in the number to string cache.
// stack, and jump back to the case where the argument is a string.
__ bind(&no_arguments);
__ LoadRoot(rbx, Heap::kempty_stringRootIndex);
- __ pop(rcx);
+ __ PopReturnAddressTo(rcx);
__ lea(rsp, Operand(rsp, kPointerSize));
- __ push(rcx);
+ __ PushReturnAddressFrom(rcx);
__ jmp(&argument_is_string);
// At this point the argument is already a string. Call runtime to
__ pop(rbp);
// Remove caller arguments from the stack.
- __ pop(rcx);
+ __ PopReturnAddressTo(rcx);
SmiIndex index = masm->SmiToIndex(rbx, rbx, kPointerSizeLog2);
__ lea(rsp, Operand(rsp, index.reg, index.scale, 1 * kPointerSize));
- __ push(rcx);
+ __ PushReturnAddressFrom(rcx);
}
// Create a new closure through the slower runtime call.
__ bind(&gc);
- __ pop(rcx); // Temporarily remove return address.
+ __ PopReturnAddressTo(rcx);
__ pop(rdx);
__ push(rsi);
__ push(rdx);
__ PushRoot(Heap::kFalseValueRootIndex);
- __ push(rcx); // Restore return address.
+ __ PushReturnAddressFrom(rcx);
__ TailCallRuntime(Runtime::kNewClosure, 3, 1);
}
void BinaryOpStub::GenerateTypeTransition(MacroAssembler* masm) {
- __ pop(rcx); // Save return address.
+ __ PopReturnAddressTo(rcx);
__ push(rdx);
__ push(rax);
// Left and right arguments are now on top.
__ Push(Smi::FromInt(MinorKey()));
- __ push(rcx); // Push return address.
+ __ PushReturnAddressFrom(rcx);
// Patch the caller to an appropriate specialized stub and return the
// operation result to the caller of the stub.
MacroAssembler* masm) {
// Push arguments, but ensure they are under the return address
// for a tail call.
- __ pop(rcx);
+ __ PopReturnAddressTo(rcx);
__ push(rdx);
__ push(rax);
- __ push(rcx);
+ __ PushReturnAddressFrom(rcx);
}
__ JumpIfNotSmi(value, &miss);
// Prepare tail call to StoreIC_ArrayLength.
- __ pop(scratch);
+ __ PopReturnAddressTo(scratch);
__ push(receiver);
__ push(value);
- __ push(scratch); // return address
+ __ PushReturnAddressFrom(scratch);
ExternalReference ref =
ExternalReference(IC_Utility(IC::kStoreIC_ArrayLength), masm->isolate());
// Slow-case: Handle non-smi or out-of-bounds access to arguments
// by calling the runtime system.
__ bind(&slow);
- __ pop(rbx); // Return address.
+ __ PopReturnAddressTo(rbx);
__ push(rdx);
- __ push(rbx);
+ __ PushReturnAddressFrom(rbx);
__ TailCallRuntime(Runtime::kGetArgumentsProperty, 1, 1);
}
}
// Push arguments below the return address to prepare jump to builtin.
- __ pop(rcx);
+ __ PopReturnAddressTo(rcx);
__ push(rdx);
__ push(rax);
__ Push(Smi::FromInt(NegativeComparisonResult(cc)));
}
- // Restore return address on the stack.
- __ push(rcx);
+ __ PushReturnAddressFrom(rcx);
// Call the native; it returns -1 (less), 0 (equal), or 1 (greater)
// tagged as a small integer.
// Check for function proxy.
__ CmpInstanceType(rcx, JS_FUNCTION_PROXY_TYPE);
__ j(not_equal, &non_function);
- __ pop(rcx);
+ __ PopReturnAddressTo(rcx);
__ push(rdi); // put proxy as additional argument under return address
- __ push(rcx);
+ __ PushReturnAddressFrom(rcx);
__ Set(rax, argc_ + 1);
__ Set(rbx, 0);
__ SetCallKind(rcx, CALL_AS_METHOD);
__ bind(&slow);
if (HasCallSiteInlineCheck()) {
// Remove extra value from the stack.
- __ pop(rcx);
+ __ PopReturnAddressTo(rcx);
__ pop(rax);
- __ push(rcx);
+ __ PushReturnAddressFrom(rcx);
}
__ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION);
}
void StringAddStub::GenerateRegisterArgsPop(MacroAssembler* masm,
Register temp) {
- __ pop(temp);
+ __ PopReturnAddressTo(temp);
__ pop(rdx);
__ pop(rax);
- __ push(temp);
+ __ PushReturnAddressFrom(temp);
}
// Inline comparison of ASCII strings.
__ IncrementCounter(counters->string_compare_native(), 1);
// Drop arguments from the stack
- __ pop(rcx);
+ __ PopReturnAddressTo(rcx);
__ addq(rsp, Immediate(2 * kPointerSize));
- __ push(rcx);
+ __ PushReturnAddressFrom(rcx);
GenerateCompareFlatAsciiStrings(masm, rdx, rax, rcx, rbx, rdi, r8);
// Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater)
// Handle more complex cases in runtime.
__ bind(&runtime);
- __ pop(tmp1); // Return address.
+ __ PopReturnAddressTo(tmp1);
__ push(left);
__ push(right);
- __ push(tmp1);
+ __ PushReturnAddressFrom(tmp1);
if (equality) {
__ TailCallRuntime(Runtime::kStringEquals, 2, 1);
} else {
// the runtime.
__ bind(&slow_elements);
- __ pop(rdi); // Pop return address and remember to put back later for tail
- // call.
+ __ PopReturnAddressTo(rdi);
__ push(rbx);
__ push(rcx);
__ push(rax);
__ movq(rbx, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
__ push(FieldOperand(rbx, JSFunction::kLiteralsOffset));
__ push(rdx);
- __ push(rdi); // Return return address so that tail call returns to right
- // place.
+ __ PushReturnAddressFrom(rdi);
__ TailCallRuntime(Runtime::kStoreArrayLiteralElement, 5, 1);
// Array literal has ElementsKind of FAST_*_ELEMENTS and value is an object.
StubFailureTrampolineFrame::kCallerStackParameterCountFrameOffset;
__ movq(rbx, MemOperand(rbp, parameter_count_offset));
masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE);
- __ pop(rcx);
+ __ PopReturnAddressTo(rcx);
int additional_offset = function_mode_ == JS_FUNCTION_STUB_MODE
? kPointerSize
: 0;
ASSERT(!result_register().is(rdx));
ASSERT(!result_register().is(rcx));
// Cook return address on top of stack (smi encoded Code* delta)
- __ pop(rdx);
+ __ PopReturnAddressTo(rdx);
__ Move(rcx, masm_->CodeObject());
__ subq(rdx, rcx);
__ Integer32ToSmi(rdx, rdx);
__ j(not_zero, &slow);
// Everything is fine, call runtime.
- __ pop(rcx);
+ __ PopReturnAddressTo(rcx);
__ push(rdx); // receiver
__ push(rax); // key
- __ push(rcx); // return address
+ __ PushReturnAddressFrom(rcx);
// Perform tail call to the entry.
__ TailCallExternalReference(
Counters* counters = masm->isolate()->counters();
__ IncrementCounter(counters->load_miss(), 1);
- __ pop(rbx);
+ __ PopReturnAddressTo(rbx);
__ push(rax); // receiver
__ push(rcx); // name
- __ push(rbx); // return address
+ __ PushReturnAddressFrom(rbx);
// Perform tail call to the entry.
ExternalReference ref =
// -- rsp[0] : return address
// -----------------------------------
- __ pop(rbx);
+ __ PopReturnAddressTo(rbx);
__ push(rax); // receiver
__ push(rcx); // name
- __ push(rbx); // return address
+ __ PushReturnAddressFrom(rbx);
// Perform tail call to the entry.
__ TailCallRuntime(Runtime::kGetProperty, 2, 1);
Counters* counters = masm->isolate()->counters();
__ IncrementCounter(counters->keyed_load_miss(), 1);
- __ pop(rbx);
+ __ PopReturnAddressTo(rbx);
__ push(rdx); // receiver
__ push(rax); // name
- __ push(rbx); // return address
+ __ PushReturnAddressFrom(rbx);
// Perform tail call to the entry.
ExternalReference ref = miss_mode == MISS_FORCE_GENERIC
// -- rsp[0] : return address
// -----------------------------------
- __ pop(rbx);
+ __ PopReturnAddressTo(rbx);
__ push(rdx); // receiver
__ push(rax); // name
- __ push(rbx); // return address
+ __ PushReturnAddressFrom(rbx);
// Perform tail call to the entry.
__ TailCallRuntime(Runtime::kKeyedGetProperty, 2, 1);
// -- rsp[0] : return address
// -----------------------------------
- __ pop(rbx);
+ __ PopReturnAddressTo(rbx);
__ push(rdx); // receiver
__ push(rcx); // name
__ push(rax); // value
- __ push(rbx); // return address
+ __ PushReturnAddressFrom(rbx);
// Perform tail call to the entry.
ExternalReference ref =
// -- rdx : receiver
// -- rsp[0] : return address
// -----------------------------------
- __ pop(rbx);
+ __ PopReturnAddressTo(rbx);
__ push(rdx);
__ push(rcx);
__ push(rax);
__ Push(Smi::FromInt(NONE)); // PropertyAttributes
__ Push(Smi::FromInt(strict_mode));
- __ push(rbx); // return address
+ __ PushReturnAddressFrom(rbx);
// Do tail-call to runtime routine.
__ TailCallRuntime(Runtime::kSetProperty, 5, 1);
// -- rsp[0] : return address
// -----------------------------------
- __ pop(rbx);
+ __ PopReturnAddressTo(rbx);
__ push(rdx); // receiver
__ push(rcx); // key
__ push(rax); // value
__ Push(Smi::FromInt(NONE)); // PropertyAttributes
__ Push(Smi::FromInt(strict_mode)); // Strict mode.
- __ push(rbx); // return address
+ __ PushReturnAddressFrom(rbx);
// Do tail-call to runtime routine.
__ TailCallRuntime(Runtime::kSetProperty, 5, 1);
// -- rsp[0] : return address
// -----------------------------------
- __ pop(rbx);
+ __ PopReturnAddressTo(rbx);
__ push(rdx); // receiver
__ push(rcx); // key
__ push(rax); // value
- __ push(rbx); // return address
+ __ PushReturnAddressFrom(rbx);
// Do tail-call to runtime routine.
ExternalReference ref(IC_Utility(kStoreIC_Slow), masm->isolate());
// -- rsp[0] : return address
// -----------------------------------
- __ pop(rbx);
+ __ PopReturnAddressTo(rbx);
__ push(rdx); // receiver
__ push(rcx); // key
__ push(rax); // value
- __ push(rbx); // return address
+ __ PushReturnAddressFrom(rbx);
// Do tail-call to runtime routine.
ExternalReference ref(IC_Utility(kKeyedStoreIC_Slow), masm->isolate());
// -- rsp[0] : return address
// -----------------------------------
- __ pop(rbx);
+ __ PopReturnAddressTo(rbx);
__ push(rdx); // receiver
__ push(rcx); // key
__ push(rax); // value
- __ push(rbx); // return address
+ __ PushReturnAddressFrom(rbx);
// Do tail-call to runtime routine.
ExternalReference ref = miss_mode == MISS_FORCE_GENERIC
// The argument count parameter is a smi
__ SmiToInteger32(reg, reg);
Register return_addr_reg = reg.is(rcx) ? rbx : rcx;
- __ pop(return_addr_reg);
+ __ PopReturnAddressTo(return_addr_reg);
__ shl(reg, Immediate(kPointerSizeLog2));
__ addq(rsp, reg);
__ jmp(return_addr_reg);
if (is_uint16(bytes_dropped)) {
ret(bytes_dropped);
} else {
- pop(scratch);
+ PopReturnAddressTo(scratch);
addq(rsp, Immediate(bytes_dropped));
- push(scratch);
+ PushReturnAddressFrom(scratch);
ret(0);
}
}
// from the caller stack.
lea(rsp, Operand(r15, 1 * kPointerSize));
- // Push the return address to get ready to return.
- push(rcx);
+ PushReturnAddressFrom(rcx);
LeaveExitFrameEpilogue();
}
void Drop(int stack_elements);
void Call(Label* target) { call(target); }
+ void PushReturnAddressFrom(Register src) { push(src); }
+ void PopReturnAddressTo(Register dst) { pop(dst); }
// Control Flow
void Jump(Address destination, RelocInfo::Mode rmode);
object->map()->unused_property_fields() == 0) {
// The properties must be extended before we can store the value.
// We jump to a runtime call that extends the properties array.
- __ pop(scratch1); // Return address.
+ __ PopReturnAddressTo(scratch1);
__ push(receiver_reg);
__ Push(transition);
__ push(value_reg);
- __ push(scratch1);
+ __ PushReturnAddressFrom(scratch1);
__ TailCallExternalReference(
ExternalReference(IC_Utility(IC::kSharedStoreIC_ExtendStorage),
masm->isolate()),
Handle<ExecutableAccessorInfo> callback) {
// Insert additional parameters into the stack frame above return address.
ASSERT(!scratch4().is(reg));
- __ pop(scratch4()); // Get return address to place it below.
+ __ PopReturnAddressTo(scratch4());
__ push(receiver()); // receiver
__ push(reg); // holder
ASSERT(!name_arg.is(scratch4()));
__ movq(name_arg, rsp);
- __ push(scratch4()); // Restore return address.
+ __ PushReturnAddressFrom(scratch4());
// v8::Arguments::values_ and handler for name.
const int kStackSpace = PropertyCallbackArguments::kArgsLength + 1;
} else { // !compile_followup_inline
// Call the runtime system to load the interceptor.
// Check that the maps haven't changed.
- __ pop(scratch2()); // save old return address
+ __ PopReturnAddressTo(scratch2());
PushInterceptorArguments(masm(), receiver(), holder_reg,
this->name(), interceptor_holder);
- __ push(scratch2()); // restore old return address
+ __ PushReturnAddressFrom(scratch2());
ExternalReference ref = ExternalReference(
IC_Utility(IC::kLoadPropertyWithInterceptorForLoad), isolate());
HandlerFrontend(object, receiver(), holder, name, &success);
__ bind(&success);
- __ pop(scratch1()); // remove the return address
+ __ PopReturnAddressTo(scratch1());
__ push(receiver());
__ Push(callback); // callback info
__ Push(name);
__ push(value());
- __ push(scratch1()); // restore return address
+ __ PushReturnAddressFrom(scratch1());
// Do tail-call to the runtime system.
ExternalReference store_callback_property =
Handle<Code> StoreStubCompiler::CompileStoreInterceptor(
Handle<JSObject> object,
Handle<Name> name) {
- __ pop(scratch1()); // remove the return address
+ __ PopReturnAddressTo(scratch1());
__ push(receiver());
__ push(this->name());
__ push(value());
__ Push(Smi::FromInt(strict_mode()));
- __ push(scratch1()); // restore return address
+ __ PushReturnAddressFrom(scratch1());
// Do tail-call to the runtime system.
ExternalReference store_ic_property =