Reviewers: Yang,
Message:
PTAL.
Description:
d8 external array c'tors: fix double-to-uint32 semantics
TEST=mjsunit/external-array
Please review this at http://codereview.chromium.org/7866040/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/d8.cc
Index: src/d8.cc
diff --git a/src/d8.cc b/src/d8.cc
index
9390c846d60055aef88431c04c70761dcfb00aac..1a3be1ec7781825254b4f885a03d2db995372d93
100644
--- a/src/d8.cc
+++ b/src/d8.cc
@@ -300,15 +300,7 @@ Handle<Value> Shell::CreateExternalArray(const
Arguments& args,
if (number.IsEmpty() || !number->IsNumber()) {
return ThrowException(String::New("Array length must be a number."));
}
- double raw_length = number->NumberValue();
- if (raw_length < 0) {
- return ThrowException(String::New("Array length must not be
negative."));
- }
- if (raw_length > kMaxLength) {
- return ThrowException(
- String::New("Array length exceeds maximum length."));
- }
- length = static_cast<size_t>(raw_length);
+ length = number->ToUint32()->Uint32Value();
}
if (length > static_cast<size_t>(kMaxLength)) {
return ThrowException(String::New("Array length exceeds maximum
length."));
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev