Revision: 11329
Author:   [email protected]
Date:     Mon Apr 16 03:53:26 2012
Log:      Add PushAddress(ExternalReference) for X64.

[email protected]

Review URL: https://chromiumcodereview.appspot.com/10081009
http://code.google.com/p/v8/source/detail?r=11329

Modified:
 /branches/bleeding_edge/src/x64/macro-assembler-x64.cc
 /branches/bleeding_edge/src/x64/macro-assembler-x64.h
 /branches/bleeding_edge/src/x64/stub-cache-x64.cc

=======================================
--- /branches/bleeding_edge/src/x64/macro-assembler-x64.cc Mon Apr 16 02:22:12 2012 +++ /branches/bleeding_edge/src/x64/macro-assembler-x64.cc Mon Apr 16 03:53:26 2012
@@ -148,6 +148,20 @@
   // Size of movq(destination, src);
   return 10;
 }
+
+
+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) {
=======================================
--- /branches/bleeding_edge/src/x64/macro-assembler-x64.h Mon Mar 12 06:56:56 2012 +++ /branches/bleeding_edge/src/x64/macro-assembler-x64.h Mon Apr 16 03:53:26 2012
@@ -127,6 +127,8 @@
   // 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);
=======================================
--- /branches/bleeding_edge/src/x64/stub-cache-x64.cc Mon Apr 16 02:22:12 2012 +++ /branches/bleeding_edge/src/x64/stub-cache-x64.cc Mon Apr 16 03:53:26 2012
@@ -379,8 +379,7 @@
   __ push(receiver);
   __ push(holder);
   __ push(FieldOperand(kScratchRegister, InterceptorInfo::kDataOffset));
-  __ movq(kScratchRegister, ExternalReference::isolate_address());
-  __ push(kScratchRegister);
+  __ PushAddress(ExternalReference::isolate_address());
 }


@@ -1012,8 +1011,7 @@
   } 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.
@@ -1191,8 +1189,7 @@
       __ 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

Reply via email to