d8 external array c'tors: fix double-to-uint32 semantics

TEST=mjsunit/external-array

Review URL: http://codereview.chromium.org/7866040

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9244 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 3ec37169
......@@ -300,11 +300,11 @@ 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();
int32_t raw_length = number->ToInt32()->Int32Value();
if (raw_length < 0) {
return ThrowException(String::New("Array length must not be negative."));
}
if (raw_length > kMaxLength) {
if (raw_length > static_cast<int32_t>(kMaxLength)) {
return ThrowException(
String::New("Array length exceeds maximum length."));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment