Reviewers: Erik Corry,
Description:
Add PushAddress(ExternalReference) for X64.
[email protected]
Please review this at https://chromiumcodereview.appspot.com/10081009/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/x64/macro-assembler-x64.h
M src/x64/macro-assembler-x64.cc
M src/x64/stub-cache-x64.cc
Index: src/x64/macro-assembler-x64.cc
diff --git a/src/x64/macro-assembler-x64.cc b/src/x64/macro-assembler-x64.cc
index
f7db250f9ec64b11dab52563cb93baf28c432e2c..63c41edf35e115c8f045eef3d6acb7505e84ab39
100644
--- a/src/x64/macro-assembler-x64.cc
+++ b/src/x64/macro-assembler-x64.cc
@@ -150,6 +150,17 @@ 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()) {
+ push(Immediate(static_cast<int32_t>(address)));
+ return;
+ }
+ LoadAddress(kScratchRegister, source);
+ push(kScratchRegister);
+}
+
+
void MacroAssembler::LoadRoot(Register destination, Heap::RootListIndex
index) {
ASSERT(root_array_available_);
movq(destination, Operand(kRootRegister,
Index: src/x64/macro-assembler-x64.h
diff --git a/src/x64/macro-assembler-x64.h b/src/x64/macro-assembler-x64.h
index
6bb5cfeb429a2f3f2fb14964af9d918e97f0eeed..66587d5319a1dffb8fb53a044a5eb9f2b46c2285
100644
--- a/src/x64/macro-assembler-x64.h
+++ b/src/x64/macro-assembler-x64.h
@@ -127,6 +127,8 @@ class MacroAssembler: public Assembler {
// Returns the size of the code generated by LoadAddress.
// Used by CallSize(ExternalReference) to find the size of a call.
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.
void LoadRoot(Register destination, Heap::RootListIndex index);
Index: src/x64/stub-cache-x64.cc
diff --git a/src/x64/stub-cache-x64.cc b/src/x64/stub-cache-x64.cc
index
86b4aff68d02b11ef6c7410499aa4e2da6b78611..a39d2b57d4fc4a9b2c0e0271aa1d037ada7b30b5
100644
--- a/src/x64/stub-cache-x64.cc
+++ b/src/x64/stub-cache-x64.cc
@@ -379,8 +379,7 @@ static void PushInterceptorArguments(MacroAssembler*
masm,
__ push(receiver);
__ push(holder);
__ push(FieldOperand(kScratchRegister, InterceptorInfo::kDataOffset));
- __ movq(kScratchRegister, ExternalReference::isolate_address());
- __ push(kScratchRegister);
+ __ PushAddress(ExternalReference::isolate_address());
}
@@ -1010,8 +1009,7 @@ void
StubCompiler::GenerateLoadCallback(Handle<JSObject> object,
} else {
__ Push(Handle<Object>(callback->data()));
}
- __ movq(kScratchRegister, ExternalReference::isolate_address());
- __ push(kScratchRegister); // isolate
+ __ PushAddress(ExternalReference::isolate_address()); // isolate
__ push(name_reg); // name
// Save a pointer to where we pushed the arguments pointer.
// This will be passed as the const AccessorInfo& to the C++ callback.
@@ -1186,8 +1184,7 @@ void
StubCompiler::GenerateLoadInterceptor(Handle<JSObject> object,
__ push(holder_reg);
__ Move(holder_reg, callback);
__ push(FieldOperand(holder_reg, AccessorInfo::kDataOffset));
- __ movq(kScratchRegister, ExternalReference::isolate_address());
- __ push(kScratchRegister);
+ __ PushAddress(ExternalReference::isolate_address());
__ push(holder_reg);
__ push(name_reg);
__ push(scratch2); // restore return address
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev