Chromium Code Reviews| Index: src/runtime.cc |
| diff --git a/src/runtime.cc b/src/runtime.cc |
| index d3baaa440cf7c49a64d1d3a5baeefa0eac4e1162..7529192e2427f205c47e867707150fd2224137df 100644 |
| --- a/src/runtime.cc |
| +++ b/src/runtime.cc |
| @@ -857,9 +857,14 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_TypedArrayInitialize) { |
| ASSERT(byte_length % elementSize == 0); |
| size_t length = byte_length / elementSize; |
| - Handle<Object> length_obj = |
| - isolate->factory()->NewNumber(static_cast<double>(length)); |
| - holder->set_length(*length_obj); |
| + if (Smi::IsValid(static_cast<intptr_t>(length))) { |
|
rossberg
2013/05/14 14:00:45
I think this should be refactored into a function
|
| + holder->set_length(Smi::FromIntptr(length)); |
| + } else { |
| + Handle<Object> length_obj= |
| + isolate->factory()->NewNumber(static_cast<double>(length)); |
| + holder->set_length(*length_obj); |
| + } |
| + |
| Handle<ExternalArray> elements = |
| isolate->factory()->NewExternalArray( |
| static_cast<int>(length), arrayType, |