Add PushAddress(ExternalReference) for X64.

R=erik.corry@gmail.com

Review URL: https://chromiumcodereview.appspot.com/10081009

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11329 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 44516ce7
...@@ -150,6 +150,20 @@ int MacroAssembler::LoadAddressSize(ExternalReference source) { ...@@ -150,6 +150,20 @@ int MacroAssembler::LoadAddressSize(ExternalReference source) {
} }
void MacroAssembler::PushAddress(ExternalReference source) {
int64_t address = reinterpret_cast<int64_t>(source.address());
if (is_int32(address) && !Serializer::enabled()) {
if (emit_debug_code()) {
movq(kScratchRegister, BitCast<int64_t>(kZapValue), RelocInfo::NONE);
}
push(Immediate(static_cast<int32_t>(address)));
return;
}
LoadAddress(kScratchRegister, source);
push(kScratchRegister);
}
void MacroAssembler::LoadRoot(Register destination, Heap::RootListIndex index) { void MacroAssembler::LoadRoot(Register destination, Heap::RootListIndex index) {
ASSERT(root_array_available_); ASSERT(root_array_available_);
movq(destination, Operand(kRootRegister, movq(destination, Operand(kRootRegister,
......
...@@ -127,6 +127,8 @@ class MacroAssembler: public Assembler { ...@@ -127,6 +127,8 @@ class MacroAssembler: public Assembler {
// Returns the size of the code generated by LoadAddress. // Returns the size of the code generated by LoadAddress.
// Used by CallSize(ExternalReference) to find the size of a call. // Used by CallSize(ExternalReference) to find the size of a call.
int LoadAddressSize(ExternalReference source); int LoadAddressSize(ExternalReference source);
// Pushes the address of the external reference onto the stack.
void PushAddress(ExternalReference source);
// Operations on roots in the root-array. // Operations on roots in the root-array.
void LoadRoot(Register destination, Heap::RootListIndex index); void LoadRoot(Register destination, Heap::RootListIndex index);
......
...@@ -379,8 +379,7 @@ static void PushInterceptorArguments(MacroAssembler* masm, ...@@ -379,8 +379,7 @@ static void PushInterceptorArguments(MacroAssembler* masm,
__ push(receiver); __ push(receiver);
__ push(holder); __ push(holder);
__ push(FieldOperand(kScratchRegister, InterceptorInfo::kDataOffset)); __ push(FieldOperand(kScratchRegister, InterceptorInfo::kDataOffset));
__ movq(kScratchRegister, ExternalReference::isolate_address()); __ PushAddress(ExternalReference::isolate_address());
__ push(kScratchRegister);
} }
...@@ -1012,8 +1011,7 @@ void StubCompiler::GenerateLoadCallback(Handle<JSObject> object, ...@@ -1012,8 +1011,7 @@ void StubCompiler::GenerateLoadCallback(Handle<JSObject> object,
} else { } else {
__ Push(Handle<Object>(callback->data())); __ Push(Handle<Object>(callback->data()));
} }
__ movq(kScratchRegister, ExternalReference::isolate_address()); __ PushAddress(ExternalReference::isolate_address()); // isolate
__ push(kScratchRegister); // isolate
__ push(name_reg); // name __ push(name_reg); // name
// Save a pointer to where we pushed the arguments pointer. // Save a pointer to where we pushed the arguments pointer.
// This will be passed as the const AccessorInfo& to the C++ callback. // This will be passed as the const AccessorInfo& to the C++ callback.
...@@ -1191,8 +1189,7 @@ void StubCompiler::GenerateLoadInterceptor(Handle<JSObject> object, ...@@ -1191,8 +1189,7 @@ void StubCompiler::GenerateLoadInterceptor(Handle<JSObject> object,
__ push(holder_reg); __ push(holder_reg);
__ Move(holder_reg, callback); __ Move(holder_reg, callback);
__ push(FieldOperand(holder_reg, AccessorInfo::kDataOffset)); __ push(FieldOperand(holder_reg, AccessorInfo::kDataOffset));
__ movq(kScratchRegister, ExternalReference::isolate_address()); __ PushAddress(ExternalReference::isolate_address());
__ push(kScratchRegister);
__ push(holder_reg); __ push(holder_reg);
__ push(name_reg); __ push(name_reg);
__ push(scratch2); // restore return address __ push(scratch2); // restore return address
......
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