Revision: 21711
Author:   [email protected]
Date:     Fri Jun  6 09:57:08 2014 UTC
Log:      Field layout in class Arguments is incompatible w\ 64-bit archs.

The length_ field must be defined as intptr_t rather than int.  This is
due to the fact that we place native argc/argv values into stack slots
(via SetFrameSlot) and then interpret the slots as a an instance of
Arguments class.

Little endian architectures get 'lucky' that the layout happens to work
with implicit padding.  Big endian is not as lucky.

See Runtime_ArrayConstructor for an example.

Based on
https://github.com/andrewlow/v8/commit/d8c3570f71c0be9914e79139740124bd1ca711a7

BUG=v8:3366
LOG=N
[email protected]

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

Patch from Andrew Low <[email protected]>.
http://code.google.com/p/v8/source/detail?r=21711

Modified:
 /branches/bleeding_edge/src/arguments.h

=======================================
--- /branches/bleeding_edge/src/arguments.h     Tue Jun  3 08:12:43 2014 UTC
+++ /branches/bleeding_edge/src/arguments.h     Fri Jun  6 09:57:08 2014 UTC
@@ -21,6 +21,9 @@
 //   Object* Runtime_function(Arguments args) {
 //     ... use args[i] here ...
 //   }
+//
+// Note that length_ (whose value is in the integer range) is defined
+// as intptr_t to provide endian-neutrality on 64-bit archs.

 class Arguments BASE_EMBEDDED {
  public:
@@ -50,12 +53,12 @@
   }

   // Get the total number of arguments including the receiver.
-  int length() const { return length_; }
+  int length() const { return static_cast<int>(length_); }

   Object** arguments() { return arguments_; }

  private:
-  int length_;
+  intptr_t length_;
   Object** arguments_;
 };

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to