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

Introduce Push and Pop macro instructions for x64

R=verwaest@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20049 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 1a6f977d
......@@ -1769,14 +1769,14 @@ void Assembler::Nop(int n) {
}
void Assembler::pop(Register dst) {
void Assembler::popq(Register dst) {
EnsureSpace ensure_space(this);
emit_optional_rex_32(dst);
emit(0x58 | dst.low_bits());
}
void Assembler::pop(const Operand& dst) {
void Assembler::popq(const Operand& dst) {
EnsureSpace ensure_space(this);
emit_optional_rex_32(dst);
emit(0x8F);
......@@ -1790,14 +1790,14 @@ void Assembler::popfq() {
}
void Assembler::push(Register src) {
void Assembler::pushq(Register src) {
EnsureSpace ensure_space(this);
emit_optional_rex_32(src);
emit(0x50 | src.low_bits());
}
void Assembler::push(const Operand& src) {
void Assembler::pushq(const Operand& src) {
EnsureSpace ensure_space(this);
emit_optional_rex_32(src);
emit(0xFF);
......@@ -1805,7 +1805,7 @@ void Assembler::push(const Operand& src) {
}
void Assembler::push(Immediate value) {
void Assembler::pushq(Immediate value) {
EnsureSpace ensure_space(this);
if (is_int8(value.value_)) {
emit(0x6A);
......@@ -1817,7 +1817,7 @@ void Assembler::push(Immediate value) {
}
void Assembler::push_imm32(int32_t imm32) {
void Assembler::pushq_imm32(int32_t imm32) {
EnsureSpace ensure_space(this);
emit(0x68);
emitl(imm32);
......
......@@ -693,15 +693,15 @@ class Assembler : public AssemblerBase {
void pushfq();
void popfq();
void push(Immediate value);
void pushq(Immediate value);
// Push a 32 bit integer, and guarantee that it is actually pushed as a
// 32 bit value, the normal push will optimize the 8 bit case.
void push_imm32(int32_t imm32);
void push(Register src);
void push(const Operand& src);
void pushq_imm32(int32_t imm32);
void pushq(Register src);
void pushq(const Operand& src);
void pop(Register dst);
void pop(const Operand& dst);
void popq(Register dst);
void popq(const Operand& dst);
void enter(Immediate size);
void leave();
......
This diff is collapsed.
This diff is collapsed.
......@@ -305,19 +305,19 @@ class RecordWriteStub: public PlatformCodeStub {
// We don't have to save scratch0_orig_ because it was given to us as
// a scratch register. But if we had to switch to a different reg then
// we should save the new scratch0_.
if (!scratch0_.is(scratch0_orig_)) masm->push(scratch0_);
if (!scratch0_.is(scratch0_orig_)) masm->Push(scratch0_);
if (!rcx.is(scratch0_orig_) &&
!rcx.is(object_orig_) &&
!rcx.is(address_orig_)) {
masm->push(rcx);
masm->Push(rcx);
}
masm->push(scratch1_);
masm->Push(scratch1_);
if (!address_.is(address_orig_)) {
masm->push(address_);
masm->Push(address_);
masm->movp(address_, address_orig_);
}
if (!object_.is(object_orig_)) {
masm->push(object_);
masm->Push(object_);
masm->movp(object_, object_orig_);
}
}
......@@ -328,19 +328,19 @@ class RecordWriteStub: public PlatformCodeStub {
// one, since only one of them can alias with rcx.
if (!object_.is(object_orig_)) {
masm->movp(object_orig_, object_);
masm->pop(object_);
masm->Pop(object_);
}
if (!address_.is(address_orig_)) {
masm->movp(address_orig_, address_);
masm->pop(address_);
masm->Pop(address_);
}
masm->pop(scratch1_);
masm->Pop(scratch1_);
if (!rcx.is(scratch0_orig_) &&
!rcx.is(object_orig_) &&
!rcx.is(address_orig_)) {
masm->pop(rcx);
masm->Pop(rcx);
}
if (!scratch0_.is(scratch0_orig_)) masm->pop(scratch0_);
if (!scratch0_.is(scratch0_orig_)) masm->Pop(scratch0_);
}
// If we have to call into C then we need to save and restore all caller-
......
......@@ -66,13 +66,13 @@ UnaryMathFunction CreateExpFunction() {
// xmm0: raw double input.
XMMRegister input = xmm0;
XMMRegister result = xmm1;
__ push(rax);
__ push(rbx);
__ pushq(rax);
__ pushq(rbx);
MathExpGenerator::EmitMathExp(&masm, input, result, xmm2, rax, rbx);
__ pop(rbx);
__ pop(rax);
__ popq(rbx);
__ popq(rax);
__ movsd(xmm0, result);
__ Ret();
......@@ -381,7 +381,7 @@ void ElementsTransitionGenerator::GenerateDoubleToObject(
__ CompareRoot(r8, Heap::kEmptyFixedArrayRootIndex);
__ j(equal, &only_change_map);
__ push(rax);
__ Push(rax);
__ movp(r8, FieldOperand(rdx, JSObject::kElementsOffset));
__ SmiToInteger32(r9, FieldOperand(r8, FixedDoubleArray::kLengthOffset));
......@@ -404,7 +404,7 @@ void ElementsTransitionGenerator::GenerateDoubleToObject(
// Call into runtime if GC is required.
__ bind(&gc_required);
__ pop(rax);
__ Pop(rax);
__ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
__ jmp(fail);
......@@ -458,7 +458,7 @@ void ElementsTransitionGenerator::GenerateDoubleToObject(
kDontSaveFPRegs,
EMIT_REMEMBERED_SET,
OMIT_SMI_CHECK);
__ pop(rax);
__ Pop(rax);
__ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
__ bind(&only_change_map);
......@@ -640,10 +640,10 @@ static byte* GetNoCodeAgeSequence(uint32_t* length) {
// following boilerplate stack-building prologue that is found both in
// FUNCTION and OPTIMIZED_FUNCTION code:
CodePatcher patcher(sequence, kNoCodeAgeSequenceLength);
patcher.masm()->push(rbp);
patcher.masm()->pushq(rbp);
patcher.masm()->movp(rbp, rsp);
patcher.masm()->push(rsi);
patcher.masm()->push(rdi);
patcher.masm()->Push(rsi);
patcher.masm()->Push(rdi);
initialized = true;
}
return sequence;
......
......@@ -121,7 +121,7 @@ static void Generate_DebugBreakCallHelper(MacroAssembler* masm,
Register reg = { r };
ASSERT(!reg.is(kScratchRegister));
if ((object_regs & (1 << r)) != 0) {
__ push(reg);
__ Push(reg);
}
if ((non_object_regs & (1 << r)) != 0) {
__ PushInt64AsTwoSmis(reg);
......@@ -145,7 +145,7 @@ static void Generate_DebugBreakCallHelper(MacroAssembler* masm,
__ Set(reg, kDebugZapValue);
}
if ((object_regs & (1 << r)) != 0) {
__ pop(reg);
__ Pop(reg);
}
// Reconstruct the 64-bit value from two smis.
if ((non_object_regs & (1 << r)) != 0) {
......@@ -154,7 +154,7 @@ static void Generate_DebugBreakCallHelper(MacroAssembler* masm,
}
// Read current padding counter and skip corresponding number of words.
__ pop(kScratchRegister);
__ Pop(kScratchRegister);
__ SmiToInteger32(kScratchRegister, kScratchRegister);
__ lea(rsp, Operand(rsp, kScratchRegister, times_pointer_size, 0));
......@@ -329,8 +329,8 @@ void Debug::GenerateFrameDropperLiveEdit(MacroAssembler* masm) {
// We do not know our frame height, but set rsp based on rbp.
__ lea(rsp, Operand(rbp, -1 * kPointerSize));
__ pop(rdi); // Function.
__ pop(rbp);
__ Pop(rdi); // Function.
__ popq(rbp);
// Load context from the function.
__ movp(rsi, FieldOperand(rdi, JSFunction::kContextOffset));
......
......@@ -179,7 +179,7 @@ void Deoptimizer::EntryGenerator::Generate() {
// to restore all later.
for (int i = 0; i < kNumberOfRegisters; i++) {
Register r = Register::from_code(i);
__ push(r);
__ pushq(r);
}
const int kSavedRegistersAreaSize = kNumberOfRegisters * kRegisterSize +
......@@ -230,14 +230,14 @@ void Deoptimizer::EntryGenerator::Generate() {
// Fill in the input registers.
for (int i = kNumberOfRegisters -1; i >= 0; i--) {
int offset = (i * kPointerSize) + FrameDescription::registers_offset();
__ pop(Operand(rbx, offset));
__ Pop(Operand(rbx, offset));
}
// Fill in the double input registers.
int double_regs_offset = FrameDescription::double_registers_offset();
for (int i = 0; i < XMMRegister::NumAllocatableRegisters(); i++) {
int dst_offset = i * kDoubleSize + double_regs_offset;
__ pop(Operand(rbx, dst_offset));
__ popq(Operand(rbx, dst_offset));
}
// Remove the bailout id and return address from the stack.
......@@ -256,14 +256,14 @@ void Deoptimizer::EntryGenerator::Generate() {
__ jmp(&pop_loop_header);
Label pop_loop;
__ bind(&pop_loop);
__ pop(Operand(rdx, 0));
__ Pop(Operand(rdx, 0));
__ addq(rdx, Immediate(sizeof(intptr_t)));
__ bind(&pop_loop_header);
__ cmpq(rcx, rsp);
__ j(not_equal, &pop_loop);
// Compute the output frame in the deoptimizer.
__ push(rax);
__ pushq(rax);
__ PrepareCallCFunction(2);
__ movp(arg_reg_1, rax);
__ LoadAddress(arg_reg_2, ExternalReference::isolate_address(isolate()));
......@@ -272,7 +272,7 @@ void Deoptimizer::EntryGenerator::Generate() {
__ CallCFunction(
ExternalReference::compute_output_frames_function(isolate()), 2);
}
__ pop(rax);
__ popq(rax);
// Replace the current frame with the output frames.
Label outer_push_loop, inner_push_loop,
......@@ -290,7 +290,7 @@ void Deoptimizer::EntryGenerator::Generate() {
__ jmp(&inner_loop_header);
__ bind(&inner_push_loop);
__ subq(rcx, Immediate(sizeof(intptr_t)));
__ push(Operand(rbx, rcx, times_1, FrameDescription::frame_content_offset()));
__ Push(Operand(rbx, rcx, times_1, FrameDescription::frame_content_offset()));
__ bind(&inner_loop_header);
__ testq(rcx, rcx);
__ j(not_zero, &inner_push_loop);
......@@ -306,14 +306,14 @@ void Deoptimizer::EntryGenerator::Generate() {
}
// Push state, pc, and continuation from the last output frame.
__ push(Operand(rbx, FrameDescription::state_offset()));
__ push(Operand(rbx, FrameDescription::pc_offset()));
__ push(Operand(rbx, FrameDescription::continuation_offset()));
__ Push(Operand(rbx, FrameDescription::state_offset()));
__ Push(Operand(rbx, FrameDescription::pc_offset()));
__ Push(Operand(rbx, FrameDescription::continuation_offset()));
// Push the registers from the last output frame.
for (int i = 0; i < kNumberOfRegisters; i++) {
int offset = (i * kPointerSize) + FrameDescription::registers_offset();
__ push(Operand(rbx, offset));
__ Push(Operand(rbx, offset));
}
// Restore the registers from the stack.
......@@ -325,7 +325,7 @@ void Deoptimizer::EntryGenerator::Generate() {
ASSERT(i > 0);
r = Register::from_code(i - 1);
}
__ pop(r);
__ popq(r);
}
// Set up the roots register.
......@@ -343,7 +343,7 @@ void Deoptimizer::TableEntryGenerator::GeneratePrologue() {
for (int i = 0; i < count(); i++) {
int start = masm()->pc_offset();
USE(start);
__ push_imm32(i);
__ pushq_imm32(i);
__ jmp(&done);
ASSERT(masm()->pc_offset() - start == table_entry_size_);
}
......
This diff is collapsed.
......@@ -571,8 +571,8 @@ void KeyedLoadIC::GenerateIndexedInterceptor(MacroAssembler* masm) {
// Everything is fine, call runtime.
__ PopReturnAddressTo(rcx);
__ push(rdx); // receiver
__ push(rax); // key
__ Push(rdx); // receiver
__ Push(rax); // key
__ PushReturnAddressFrom(rcx);
// Perform tail call to the entry.
......@@ -1021,8 +1021,8 @@ void LoadIC::GenerateMiss(MacroAssembler* masm) {
__ IncrementCounter(counters->load_miss(), 1);
__ PopReturnAddressTo(rbx);
__ push(rax); // receiver
__ push(rcx); // name
__ Push(rax); // receiver
__ Push(rcx); // name
__ PushReturnAddressFrom(rbx);
// Perform tail call to the entry.
......@@ -1040,8 +1040,8 @@ void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) {
// -----------------------------------
__ PopReturnAddressTo(rbx);
__ push(rax); // receiver
__ push(rcx); // name
__ Push(rax); // receiver
__ Push(rcx); // name
__ PushReturnAddressFrom(rbx);
// Perform tail call to the entry.
......@@ -1060,8 +1060,8 @@ void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) {
__ IncrementCounter(counters->keyed_load_miss(), 1);
__ PopReturnAddressTo(rbx);
__ push(rdx); // receiver
__ push(rax); // name
__ Push(rdx); // receiver
__ Push(rax); // name
__ PushReturnAddressFrom(rbx);
// Perform tail call to the entry.
......@@ -1079,8 +1079,8 @@ void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) {
// -----------------------------------
__ PopReturnAddressTo(rbx);
__ push(rdx); // receiver
__ push(rax); // name
__ Push(rdx); // receiver
__ Push(rax); // name
__ PushReturnAddressFrom(rbx);
// Perform tail call to the entry.
......@@ -1115,9 +1115,9 @@ void StoreIC::GenerateMiss(MacroAssembler* masm) {
// -----------------------------------
__ PopReturnAddressTo(rbx);
__ push(rdx); // receiver
__ push(rcx); // name
__ push(rax); // value
__ Push(rdx); // receiver
__ Push(rcx); // name
__ Push(rax); // value
__ PushReturnAddressFrom(rbx);
// Perform tail call to the entry.
......@@ -1159,9 +1159,9 @@ void StoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm,
// -- rsp[0] : return address
// -----------------------------------
__ PopReturnAddressTo(rbx);
__ push(rdx);
__ push(rcx);
__ push(rax);
__ Push(rdx);
__ Push(rcx);
__ Push(rax);
__ Push(Smi::FromInt(NONE)); // PropertyAttributes
__ Push(Smi::FromInt(strict_mode));
__ PushReturnAddressFrom(rbx);
......@@ -1181,9 +1181,9 @@ void KeyedStoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm,
// -----------------------------------
__ PopReturnAddressTo(rbx);
__ push(rdx); // receiver
__ push(rcx); // key
__ push(rax); // value
__ Push(rdx); // receiver
__ Push(rcx); // key
__ Push(rax); // value
__ Push(Smi::FromInt(NONE)); // PropertyAttributes
__ Push(Smi::FromInt(strict_mode)); // Strict mode.
__ PushReturnAddressFrom(rbx);
......@@ -1202,9 +1202,9 @@ void StoreIC::GenerateSlow(MacroAssembler* masm) {
// -----------------------------------
__ PopReturnAddressTo(rbx);
__ push(rdx); // receiver
__ push(rcx); // key
__ push(rax); // value
__ Push(rdx); // receiver
__ Push(rcx); // key
__ Push(rax); // value
__ PushReturnAddressFrom(rbx);
// Do tail-call to runtime routine.
......@@ -1222,9 +1222,9 @@ void KeyedStoreIC::GenerateSlow(MacroAssembler* masm) {
// -----------------------------------
__ PopReturnAddressTo(rbx);
__ push(rdx); // receiver
__ push(rcx); // key
__ push(rax); // value
__ Push(rdx); // receiver
__ Push(rcx); // key
__ Push(rax); // value
__ PushReturnAddressFrom(rbx);
// Do tail-call to runtime routine.
......@@ -1242,9 +1242,9 @@ void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) {
// -----------------------------------
__ PopReturnAddressTo(rbx);
__ push(rdx); // receiver
__ push(rcx); // key
__ push(rax); // value
__ Push(rdx); // receiver
__ Push(rcx); // key
__ Push(rax); // value
__ PushReturnAddressFrom(rbx);
// Do tail-call to runtime routine.
......
This diff is collapsed.
This diff is collapsed.
......@@ -837,10 +837,14 @@ class MacroAssembler: public Assembler {
void Drop(int stack_elements);
void Call(Label* target) { call(target); }
void Push(Register src) { push(src); }
void Pop(Register dst) { pop(dst); }
void PushReturnAddressFrom(Register src) { push(src); }
void PopReturnAddressTo(Register dst) { pop(dst); }
void Push(Register src);
void Push(const Operand& src);
void Push(Immediate value);
void PushImm32(int32_t imm32);
void Pop(Register dst);
void Pop(const Operand& dst);
void PushReturnAddressFrom(Register src) { pushq(src); }
void PopReturnAddressTo(Register dst) { popq(dst); }
void Move(Register dst, ExternalReference ext) {
movp(dst, reinterpret_cast<Address>(ext.address()),
RelocInfo::EXTERNAL_REFERENCE);
......@@ -1608,9 +1612,9 @@ extern void LogGeneratedCodeCoverage(const char* file_line);
Address x64_coverage_function = FUNCTION_ADDR(LogGeneratedCodeCoverage); \
masm->pushfq(); \
masm->Pushad(); \
masm->push(Immediate(reinterpret_cast<int>(&__FILE_LINE__))); \
masm->Push(Immediate(reinterpret_cast<int>(&__FILE_LINE__))); \
masm->Call(x64_coverage_function, RelocInfo::EXTERNAL_REFERENCE); \
masm->pop(rax); \
masm->Pop(rax); \
masm->Popad(); \
masm->popfq(); \
} \
......
......@@ -322,10 +322,10 @@ void RegExpMacroAssemblerX64::CheckNotBackReferenceIgnoreCase(
// Save important/volatile registers before calling C function.
#ifndef _WIN64
// Caller save on Linux and callee save in Windows.
__ push(rsi);
__ push(rdi);
__ pushq(rsi);
__ pushq(rdi);
#endif
__ push(backtrack_stackpointer());
__ pushq(backtrack_stackpointer());
static const int num_arguments = 4;
__ PrepareCallCFunction(num_arguments);
......@@ -367,10 +367,10 @@ void RegExpMacroAssemblerX64::CheckNotBackReferenceIgnoreCase(
// Restore original values before reacting on result value.
__ Move(code_object_pointer(), masm_.CodeObject());
__ pop(backtrack_stackpointer());
__ popq(backtrack_stackpointer());
#ifndef _WIN64
__ pop(rdi);
__ pop(rsi);
__ popq(rdi);
__ popq(rsi);
#endif
// Check if function returned non-zero for success or zero for failure.
......@@ -674,7 +674,7 @@ Handle<HeapObject> RegExpMacroAssemblerX64::GetCode(Handle<String> source) {
FrameScope scope(&masm_, StackFrame::MANUAL);
// Actually emit code to start a new stack frame.
__ push(rbp);
__ pushq(rbp);
__ movp(rbp, rsp);
// Save parameters and callee-save registers. Order here should correspond
// to order of kBackup_ebx etc.
......@@ -686,9 +686,9 @@ Handle<HeapObject> RegExpMacroAssemblerX64::GetCode(Handle<String> source) {
__ movq(Operand(rbp, kInputStart), r8);
__ movq(Operand(rbp, kInputEnd), r9);
// Callee-save on Win64.
__ push(rsi);
__ push(rdi);
__ push(rbx);
__ pushq(rsi);
__ pushq(rdi);
__ pushq(rbx);
#else
// GCC passes arguments in rdi, rsi, rdx, rcx, r8, r9 (and then on stack).
// Push register parameters on stack for reference.
......@@ -698,18 +698,18 @@ Handle<HeapObject> RegExpMacroAssemblerX64::GetCode(Handle<String> source) {
ASSERT_EQ(kInputEnd, -4 * kPointerSize);
ASSERT_EQ(kRegisterOutput, -5 * kPointerSize);
ASSERT_EQ(kNumOutputRegisters, -6 * kPointerSize);
__ push(rdi);
__ push(rsi);
__ push(rdx);
__ push(rcx);
__ push(r8);
__ push(r9);
__ push(rbx); // Callee-save
__ pushq(rdi);
__ pushq(rsi);
__ pushq(rdx);
__ pushq(rcx);
__ pushq(r8);
__ pushq(r9);
__ pushq(rbx); // Callee-save
#endif
__ push(Immediate(0)); // Number of successful matches in a global regexp.
__ push(Immediate(0)); // Make room for "input start - 1" constant.
__ Push(Immediate(0)); // Number of successful matches in a global regexp.
__ Push(Immediate(0)); // Make room for "input start - 1" constant.
// Check if we have space on the stack for registers.
Label stack_limit_hit;
......@@ -897,9 +897,9 @@ Handle<HeapObject> RegExpMacroAssemblerX64::GetCode(Handle<String> source) {
#ifdef _WIN64
// Restore callee save registers.
__ lea(rsp, Operand(rbp, kLastCalleeSaveRegister));
__ pop(rbx);
__ pop(rdi);
__ pop(rsi);
__ popq(rbx);
__ popq(rdi);
__ popq(rsi);
// Stack now at rbp.
#else
// Restore callee save register.
......@@ -908,7 +908,7 @@ Handle<HeapObject> RegExpMacroAssemblerX64::GetCode(Handle<String> source) {
__ movp(rsp, rbp);
#endif
// Exit function frame, restore previous one.
__ pop(rbp);
__ popq(rbp);
__ ret(0);
// Backtrack code (branch target for conditional backtracks).
......@@ -923,8 +923,8 @@ Handle<HeapObject> RegExpMacroAssemblerX64::GetCode(Handle<String> source) {
if (check_preempt_label_.is_linked()) {
SafeCallTarget(&check_preempt_label_);
__ push(backtrack_stackpointer());
__ push(rdi);
__ pushq(backtrack_stackpointer());
__ pushq(rdi);
CallCheckStackGuardState();
__ testq(rax, rax);
......@@ -934,8 +934,8 @@ Handle<HeapObject> RegExpMacroAssemblerX64::GetCode(Handle<String> source) {
// Restore registers.
__ Move(code_object_pointer(), masm_.CodeObject());
__ pop(rdi);
__ pop(backtrack_stackpointer());
__ popq(rdi);
__ popq(backtrack_stackpointer());
// String might have moved: Reload esi from frame.
__ movp(rsi, Operand(rbp, kInputEnd));
SafeReturn();
......@@ -950,8 +950,8 @@ Handle<HeapObject> RegExpMacroAssemblerX64::GetCode(Handle<String> source) {
// Save registers before calling C function
#ifndef _WIN64
// Callee-save in Microsoft 64-bit ABI, but not in AMD64 ABI.
__ push(rsi);
__ push(rdi);
__ pushq(rsi);
__ pushq(rdi);
#endif
// Call GrowStack(backtrack_stackpointer())
......@@ -980,8 +980,8 @@ Handle<HeapObject> RegExpMacroAssemblerX64::GetCode(Handle<String> source) {
// Restore saved registers and continue.
__ Move(code_object_pointer(), masm_.CodeObject());
#ifndef _WIN64
__ pop(rdi);
__ pop(rsi);
__ popq(rdi);
__ popq(rsi);
#endif
SafeReturn();
}
......
......@@ -49,10 +49,12 @@ static void ProbeTable(Isolate* isolate,
// The offset is scaled by 4, based on
// kHeapObjectTagSize, which is two bits
Register offset) {
// We need to scale up the pointer by 2 because the offset is scaled by less
// We need to scale up the pointer by 2 when the offset is scaled by less
// than the pointer size.
ASSERT(kPointerSizeLog2 == kHeapObjectTagSize + 1);
ScaleFactor scale_factor = times_2;
ASSERT(kPointerSize == kInt64Size
? kPointerSizeLog2 == kHeapObjectTagSize + 1
: kPointerSizeLog2 == kHeapObjectTagSize);
ScaleFactor scale_factor = kPointerSize == kInt64Size ? times_2 : times_1;
ASSERT_EQ(3 * kPointerSize, sizeof(StubCache::Entry));
// The offset register holds the entry offset times four (due to masking
......@@ -320,13 +322,13 @@ static void PushInterceptorArguments(MacroAssembler* masm,
STATIC_ASSERT(StubCache::kInterceptorArgsThisIndex == 2);
STATIC_ASSERT(StubCache::kInterceptorArgsHolderIndex == 3);
STATIC_ASSERT(StubCache::kInterceptorArgsLength == 4);
__ push(name);
__ Push(name);
Handle<InterceptorInfo> interceptor(holder_obj->GetNamedInterceptor());
ASSERT(!masm->isolate()->heap()->InNewSpace(*interceptor));
__ Move(kScratchRegister, interceptor);
__ push(kScratchRegister);
__ push(receiver);
__ push(holder);
__ Push(kScratchRegister);
__ Push(receiver);
__ Push(holder);
}
......@@ -357,13 +359,13 @@ void StubCompiler::GenerateFastApiCall(MacroAssembler* masm,
__ PopReturnAddressTo(scratch_in);
// receiver
__ push(receiver);
__ Push(receiver);
// Write the arguments to stack frame.
for (int i = 0; i < argc; i++) {
Register arg = values[argc-1-i];
ASSERT(!receiver.is(arg));
ASSERT(!scratch_in.is(arg));
__ push(arg);
__ Push(arg);
}
__ PushReturnAddressFrom(scratch_in);
// Stack now matches JSFunction abi.
......@@ -521,9 +523,9 @@ void StoreStubCompiler::GenerateStoreTransition(MacroAssembler* masm,
// The properties must be extended before we can store the value.
// We jump to a runtime call that extends the properties array.
__ PopReturnAddressTo(scratch1);
__ push(receiver_reg);
__ Push(receiver_reg);
__ Push(transition);
__ push(value_reg);
__ Push(value_reg);
__ PushReturnAddressFrom(scratch1);
__ TailCallExternalReference(
ExternalReference(IC_Utility(IC::kSharedStoreIC_ExtendStorage),
......@@ -933,22 +935,22 @@ void LoadStubCompiler::GenerateLoadCallback(
STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 4);
STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 5);
STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 6);
__ push(receiver()); // receiver
__ Push(receiver()); // receiver
if (heap()->InNewSpace(callback->data())) {
ASSERT(!scratch2().is(reg));
__ Move(scratch2(), callback);
__ push(FieldOperand(scratch2(),
__ Push(FieldOperand(scratch2(),
ExecutableAccessorInfo::kDataOffset)); // data
} else {
__ Push(Handle<Object>(callback->data(), isolate()));
}
ASSERT(!kScratchRegister.is(reg));
__ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex);
__ push(kScratchRegister); // return value
__ push(kScratchRegister); // return value default
__ Push(kScratchRegister); // return value
__ Push(kScratchRegister); // return value default
__ PushAddress(ExternalReference::isolate_address(isolate()));
__ push(reg); // holder
__ push(name()); // name
__ Push(reg); // holder
__ Push(name()); // name
// Save a pointer to where we pushed the arguments pointer. This will be
// passed as the const PropertyAccessorInfo& to the C++ callback.
......@@ -1016,10 +1018,10 @@ void LoadStubCompiler::GenerateLoadInterceptor(
FrameScope frame_scope(masm(), StackFrame::INTERNAL);
if (must_preserve_receiver_reg) {
__ push(receiver());
__ Push(receiver());
}
__ push(holder_reg);
__ push(this->name());
__ Push(holder_reg);
__ Push(this->name());
// Invoke an interceptor. Note: map checks from receiver to
// interceptor's holder has been compiled before (see a caller
......@@ -1037,10 +1039,10 @@ void LoadStubCompiler::GenerateLoadInterceptor(
__ ret(0);
__ bind(&interceptor_failed);
__ pop(this->name());
__ pop(holder_reg);
__ Pop(this->name());
__ Pop(holder_reg);
if (must_preserve_receiver_reg) {
__ pop(receiver());
__ Pop(receiver());
}
// Leave the internal frame.
......@@ -1082,11 +1084,11 @@ Handle<Code> StoreStubCompiler::CompileStoreCallback(
IC::CurrentTypeOf(object, isolate()), receiver(), holder, name);
__ PopReturnAddressTo(scratch1());
__ push(receiver());
__ push(holder_reg);
__ Push(receiver());
__ Push(holder_reg);
__ Push(callback); // callback info
__ Push(name);
__ push(value());
__ Push(value());
__ PushReturnAddressFrom(scratch1());
// Do tail-call to the runtime system.
......@@ -1115,7 +1117,7 @@ void StoreStubCompiler::GenerateStoreViaSetter(
FrameScope scope(masm, StackFrame::INTERNAL);
// Save value register, so we can restore it later.
__ push(value());
__ Push(value());
if (!setter.is_null()) {
// Call the JavaScript setter with receiver and value on the stack.
......@@ -1124,8 +1126,8 @@ void StoreStubCompiler::GenerateStoreViaSetter(
__ movp(receiver,
FieldOperand(receiver, JSGlobalObject::kGlobalReceiverOffset));
}
__ push(receiver);
__ push(value());
__ Push(receiver);
__ Push(value());
ParameterCount actual(1);
ParameterCount expected(setter);
__ InvokeFunction(setter, expected, actual,
......@@ -1137,7 +1139,7 @@ void StoreStubCompiler::GenerateStoreViaSetter(
}
// We have to return the passed value, not the return value of the setter.
__ pop(rax);
__ Pop(rax);
// Restore context register.
__ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
......@@ -1154,9 +1156,9 @@ Handle<Code> StoreStubCompiler::CompileStoreInterceptor(
Handle<JSObject> object,
Handle<Name> name) {
__ PopReturnAddressTo(scratch1());
__ push(receiver());
__ push(this->name());
__ push(value());
__ Push(receiver());
__ Push(this->name());
__ Push(value());
__ PushReturnAddressFrom(scratch1());
// Do tail-call to the runtime system.
......@@ -1172,8 +1174,8 @@ Handle<Code> StoreStubCompiler::CompileStoreInterceptor(
void StoreStubCompiler::GenerateStoreArrayLength() {
// Prepare tail call to StoreIC_ArrayLength.
__ PopReturnAddressTo(scratch1());
__ push(receiver());
__ push(value());
__ Push(receiver());
__ Push(value());
__ PushReturnAddressFrom(scratch1());
ExternalReference ref =
......@@ -1289,7 +1291,7 @@ void LoadStubCompiler::GenerateLoadViaGetter(MacroAssembler* masm,
__ movp(receiver,
FieldOperand(receiver, JSGlobalObject::kGlobalReceiverOffset));
}
__ push(receiver);
__ Push(receiver);
ParameterCount actual(0);
ParameterCount expected(getter);
__ InvokeFunction(getter, expected, actual,
......
......@@ -99,15 +99,15 @@ TEST(AssemblerX64StackOperations) {
// Assemble a simple function that copies argument 2 and returns it.
// We compile without stack frame pointers, so the gdb debugger shows
// incorrect stack frames when debugging this function (which has them).
__ push(rbp);
__ pushq(rbp);
__ movq(rbp, rsp);
__ push(arg2); // Value at (rbp - 8)
__ push(arg2); // Value at (rbp - 16)
__ push(arg1); // Value at (rbp - 24)
__ pop(rax);
__ pop(rax);
__ pop(rax);
__ pop(rbp);
__ pushq(arg2); // Value at (rbp - 8)
__ pushq(arg2); // Value at (rbp - 16)
__ pushq(arg1); // Value at (rbp - 24)
__ popq(rax);
__ popq(rax);
__ popq(rax);
__ popq(rbp);
__ nop();
__ ret(0);
......@@ -330,19 +330,19 @@ TEST(AssemblerX64MemoryOperands) {
Assembler assm(CcTest::i_isolate(), buffer, static_cast<int>(actual_size));
// Assemble a simple function that copies argument 2 and returns it.
__ push(rbp);
__ pushq(rbp);
__ movq(rbp, rsp);
__ push(arg2); // Value at (rbp - 8)
__ push(arg2); // Value at (rbp - 16)
__ push(arg1); // Value at (rbp - 24)
__ pushq(arg2); // Value at (rbp - 8)
__ pushq(arg2); // Value at (rbp - 16)
__ pushq(arg1); // Value at (rbp - 24)
const int kStackElementSize = 8;
__ movq(rax, Operand(rbp, -3 * kStackElementSize));
__ pop(arg2);
__ pop(arg2);
__ pop(arg2);
__ pop(rbp);
__ popq(arg2);
__ popq(arg2);
__ popq(arg2);
__ popq(rbp);
__ nop();
__ ret(0);
......@@ -364,7 +364,7 @@ TEST(AssemblerX64ControlFlow) {
Assembler assm(CcTest::i_isolate(), buffer, static_cast<int>(actual_size));
// Assemble a simple function that copies argument 1 and returns it.
__ push(rbp);
__ pushq(rbp);
__ movq(rbp, rsp);
__ movq(rax, arg1);
......@@ -372,7 +372,7 @@ TEST(AssemblerX64ControlFlow) {
__ jmp(&target);
__ movq(rax, arg2);
__ bind(&target);
__ pop(rbp);
__ popq(rbp);
__ ret(0);
CodeDesc desc;
......@@ -496,11 +496,11 @@ TEST(AssemblerMultiByteNop) {
byte buffer[1024];
Isolate* isolate = CcTest::i_isolate();
Assembler assm(isolate, buffer, sizeof(buffer));
__ push(rbx);
__ push(rcx);
__ push(rdx);
__ push(rdi);
__ push(rsi);
__ pushq(rbx);
__ pushq(rcx);
__ pushq(rdx);
__ pushq(rdi);
__ pushq(rsi);
__ movq(rax, Immediate(1));
__ movq(rbx, Immediate(2));
__ movq(rcx, Immediate(3));
......@@ -527,19 +527,19 @@ TEST(AssemblerMultiByteNop) {
__ cmpq(rsi, Immediate(6));
__ j(not_equal, &fail);
__ movq(rax, Immediate(42));
__ pop(rsi);
__ pop(rdi);
__ pop(rdx);
__ pop(rcx);
__ pop(rbx);
__ popq(rsi);
__ popq(rdi);
__ popq(rdx);
__ popq(rcx);
__ popq(rbx);
__ ret(0);
__ bind(&fail);
__ movq(rax, Immediate(13));
__ pop(rsi);
__ pop(rdi);
__ pop(rdx);
__ pop(rcx);
__ pop(rbx);
__ popq(rsi);
__ popq(rdi);
__ popq(rdx);
__ popq(rcx);
__ popq(rbx);
__ ret(0);
CodeDesc desc;
......@@ -571,14 +571,14 @@ void DoSSE2(const v8::FunctionCallbackInfo<v8::Value>& args) {
Assembler assm(isolate, buffer, sizeof(buffer));
// Remove return address from the stack for fix stack frame alignment.
__ pop(rcx);
__ popq(rcx);
// Store input vector on the stack.
for (int i = 0; i < ELEMENT_COUNT; i++) {
__ movl(rax, Immediate(vec->Get(i)->Int32Value()));
__ shl(rax, Immediate(0x20));
__ or_(rax, Immediate(vec->Get(++i)->Int32Value()));
__ push(rax);
__ pushq(rax);
}
// Read vector into a xmm register.
......@@ -590,7 +590,7 @@ void DoSSE2(const v8::FunctionCallbackInfo<v8::Value>& args) {
// Remove unused data from the stack.
__ addq(rsp, Immediate(ELEMENT_COUNT * sizeof(int32_t)));
// Restore return address.
__ push(rcx);
__ pushq(rcx);
__ ret(0);
......
......@@ -57,11 +57,11 @@ ConvertDToIFunc MakeConvertDToIFuncTrampoline(Isolate* isolate,
DoubleToIStub stub(source_reg, destination_reg, offset, true);
byte* start = stub.GetCode(isolate)->instruction_start();
__ push(rbx);
__ push(rcx);
__ push(rdx);
__ push(rsi);
__ push(rdi);
__ pushq(rbx);
__ pushq(rcx);
__ pushq(rdx);
__ pushq(rsi);
__ pushq(rdi);
if (!source_reg.is(rsp)) {
// The argument we pass to the stub is not a heap number, but instead
......@@ -78,7 +78,7 @@ ConvertDToIFunc MakeConvertDToIFuncTrampoline(Isolate* isolate,
for (;reg_num < Register::NumAllocatableRegisters(); ++reg_num) {
Register reg = Register::FromAllocationIndex(reg_num);
if (!reg.is(rsp) && !reg.is(rbp) && !reg.is(destination_reg)) {
__ push(reg);
__ pushq(reg);
}
}
......@@ -103,11 +103,11 @@ ConvertDToIFunc MakeConvertDToIFuncTrampoline(Isolate* isolate,
__ movq(rax, destination_reg);
__ pop(rdi);
__ pop(rsi);
__ pop(rdx);
__ pop(rcx);
__ pop(rbx);
__ popq(rdi);
__ popq(rsi);
__ popq(rdx);
__ popq(rcx);
__ popq(rbx);
__ ret(0);
......
......@@ -118,17 +118,17 @@ TEST(DisasmX64) {
__ bts(Operand(rdx, 0), rcx);
__ bts(Operand(rbx, rcx, times_4, 0), rcx);
__ nop();
__ push(Immediate(12));
__ push(Immediate(23456));
__ push(rcx);
__ push(rsi);
__ push(Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
__ push(Operand(rbx, rcx, times_4, 0));
__ push(Operand(rbx, rcx, times_4, 0));
__ push(Operand(rbx, rcx, times_4, 10000));
__ pop(rdx);
__ pop(rax);
__ pop(Operand(rbx, rcx, times_4, 0));
__ pushq(Immediate(12));
__ pushq(Immediate(23456));
__ pushq(rcx);
__ pushq(rsi);
__ pushq(Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
__ pushq(Operand(rbx, rcx, times_4, 0));
__ pushq(Operand(rbx, rcx, times_4, 0));
__ pushq(Operand(rbx, rcx, times_4, 10000));
__ popq(rdx);
__ popq(rax);
__ popq(Operand(rbx, rcx, times_4, 0));
__ nop();
__ addq(rdx, Operand(rsp, 16));
......@@ -168,8 +168,8 @@ TEST(DisasmX64) {
__ incq(rdx);
__ incq(Operand(rbx, rcx, times_4, 10000));
__ push(Operand(rbx, rcx, times_4, 10000));
__ pop(Operand(rbx, rcx, times_4, 10000));
__ pushq(Operand(rbx, rcx, times_4, 10000));
__ popq(Operand(rbx, rcx, times_4, 10000));
// TODO(mstarzinger): The following is protected.
// __ jmp(Operand(rbx, rcx, times_4, 10000));
......
......@@ -66,21 +66,21 @@ void generate(MacroAssembler* masm, i::Vector<const uint8_t> string) {
__ pop(ebx);
__ Ret();
#elif V8_TARGET_ARCH_X64
__ push(kRootRegister);
__ pushq(kRootRegister);
__ InitializeRootRegister();
__ push(rbx);
__ push(rcx);
__ movq(rax, Immediate(0));
__ movq(rbx, Immediate(string.at(0)));
__ pushq(rbx);
__ pushq(rcx);
__ movp(rax, Immediate(0));
__ movp(rbx, Immediate(string.at(0)));
StringHelper::GenerateHashInit(masm, rax, rbx, rcx);
for (int i = 1; i < string.length(); i++) {
__ movq(rbx, Immediate(string.at(i)));
__ movp(rbx, Immediate(string.at(i)));
StringHelper::GenerateHashAddCharacter(masm, rax, rbx, rcx);
}
StringHelper::GenerateHashGetHash(masm, rax, rcx);
__ pop(rcx);
__ pop(rbx);
__ pop(kRootRegister);
__ popq(rcx);
__ popq(rbx);
__ popq(kRootRegister);
__ Ret();
#elif V8_TARGET_ARCH_ARM
__ push(kRootRegister);
......@@ -143,13 +143,13 @@ void generate(MacroAssembler* masm, uint32_t key) {
__ pop(ebx);
__ Ret();
#elif V8_TARGET_ARCH_X64
__ push(kRootRegister);
__ pushq(kRootRegister);
__ InitializeRootRegister();
__ push(rbx);
__ movq(rax, Immediate(key));
__ pushq(rbx);
__ movp(rax, Immediate(key));
__ GetNumberHash(rax, rbx);
__ pop(rbx);
__ pop(kRootRegister);
__ popq(rbx);
__ popq(kRootRegister);
__ Ret();
#elif V8_TARGET_ARCH_ARM
__ push(kRootRegister);
......
......@@ -99,8 +99,8 @@ typedef int (*F0)();
static void EntryCode(MacroAssembler* masm) {
// Smi constant register is callee save.
__ push(i::kSmiConstantRegister);
__ push(i::kRootRegister);
__ pushq(i::kSmiConstantRegister);
__ pushq(i::kRootRegister);
__ InitializeSmiConstantRegister();
__ InitializeRootRegister();
}
......@@ -112,8 +112,8 @@ static void ExitCode(MacroAssembler* masm) {
__ cmpq(rdx, i::kSmiConstantRegister);
__ movq(rdx, Immediate(-1));
__ cmovq(not_equal, rax, rdx);
__ pop(i::kRootRegister);
__ pop(i::kSmiConstantRegister);
__ popq(i::kRootRegister);
__ popq(i::kSmiConstantRegister);
}
......@@ -1360,8 +1360,8 @@ TEST(SmiDiv) {
EntryCode(masm);
Label exit;
__ push(r14);
__ push(r15);
__ pushq(r14);
__ pushq(r15);
TestSmiDiv(masm, &exit, 0x10, 1, 1);
TestSmiDiv(masm, &exit, 0x20, 1, 0);
TestSmiDiv(masm, &exit, 0x30, -1, 0);
......@@ -1386,8 +1386,8 @@ TEST(SmiDiv) {
__ xor_(r15, r15); // Success.
__ bind(&exit);
__ movq(rax, r15);
__ pop(r15);
__ pop(r14);
__ popq(r15);
__ popq(r14);
ExitCode(masm);
__ ret(0);
......@@ -1470,8 +1470,8 @@ TEST(SmiMod) {
EntryCode(masm);
Label exit;
__ push(r14);
__ push(r15);
__ pushq(r14);
__ pushq(r15);
TestSmiMod(masm, &exit, 0x10, 1, 1);
TestSmiMod(masm, &exit, 0x20, 1, 0);
TestSmiMod(masm, &exit, 0x30, -1, 0);
......@@ -1496,8 +1496,8 @@ TEST(SmiMod) {
__ xor_(r15, r15); // Success.
__ bind(&exit);
__ movq(rax, r15);
__ pop(r15);
__ pop(r14);
__ popq(r15);
__ popq(r14);
ExitCode(masm);
__ ret(0);
......@@ -2324,21 +2324,21 @@ TEST(OperandOffset) {
Label exit;
EntryCode(masm);
__ push(r13);
__ push(r14);
__ push(rbx);
__ push(rbp);
__ push(Immediate(0x100)); // <-- rbp
__ pushq(r13);
__ pushq(r14);
__ pushq(rbx);
__ pushq(rbp);
__ pushq(Immediate(0x100)); // <-- rbp
__ movq(rbp, rsp);
__ push(Immediate(0x101));
__ push(Immediate(0x102));
__ push(Immediate(0x103));
__ push(Immediate(0x104));
__ push(Immediate(0x105)); // <-- rbx
__ push(Immediate(0x106));
__ push(Immediate(0x107));
__ push(Immediate(0x108));
__ push(Immediate(0x109)); // <-- rsp
__ pushq(Immediate(0x101));
__ pushq(Immediate(0x102));
__ pushq(Immediate(0x103));
__ pushq(Immediate(0x104));
__ pushq(Immediate(0x105)); // <-- rbx
__ pushq(Immediate(0x106));
__ pushq(Immediate(0x107));
__ pushq(Immediate(0x108));
__ pushq(Immediate(0x109)); // <-- rsp
// rbp = rsp[9]
// r15 = rsp[3]
// rbx = rsp[5]
......@@ -2644,10 +2644,10 @@ TEST(OperandOffset) {
__ movl(rax, Immediate(0));
__ bind(&exit);
__ lea(rsp, Operand(rbp, kPointerSize));
__ pop(rbp);
__ pop(rbx);
__ pop(r14);
__ pop(r13);
__ popq(rbp);
__ popq(rbx);
__ popq(r14);
__ popq(r13);
ExitCode(masm);
__ ret(0);
......
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