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
d8c3570f71

BUG=v8:3366
LOG=N
R=danno@chromium.org

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

Patch from Andrew Low <andrew_low@ca.ibm.com>.

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21711 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
danno@chromium.org 2014-06-06 09:57:08 +00:00
parent 59f8b6a9ce
commit 88cb8fb248

View File

@ -21,6 +21,9 @@ namespace internal {
// Object* Runtime_function(Arguments args) { // Object* Runtime_function(Arguments args) {
// ... use args[i] here ... // ... 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 { class Arguments BASE_EMBEDDED {
public: public:
@ -50,12 +53,12 @@ class Arguments BASE_EMBEDDED {
} }
// Get the total number of arguments including the receiver. // 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_; } Object** arguments() { return arguments_; }
private: private:
int length_; intptr_t length_;
Object** arguments_; Object** arguments_;
}; };