| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/builtins.h" | 5 #include "src/builtins.h" |
| 6 | 6 |
| 7 #include "src/api.h" | 7 #include "src/api.h" |
| 8 #include "src/api-natives.h" | 8 #include "src/api-natives.h" |
| 9 #include "src/arguments.h" | 9 #include "src/arguments.h" |
| 10 #include "src/base/once.h" | 10 #include "src/base/once.h" |
| (...skipping 982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 993 | 993 |
| 994 if (receiver->IsJSArray()) { | 994 if (receiver->IsJSArray()) { |
| 995 Handle<JSArray> array(Handle<JSArray>::cast(receiver)); | 995 Handle<JSArray> array(Handle<JSArray>::cast(receiver)); |
| 996 length = static_cast<uint32_t>(array->length()->Number()); | 996 length = static_cast<uint32_t>(array->length()->Number()); |
| 997 } else { | 997 } else { |
| 998 Handle<Object> val; | 998 Handle<Object> val; |
| 999 Handle<Object> key(isolate->heap()->length_string(), isolate); | 999 Handle<Object> key(isolate->heap()->length_string(), isolate); |
| 1000 ASSIGN_RETURN_ON_EXCEPTION_VALUE( | 1000 ASSIGN_RETURN_ON_EXCEPTION_VALUE( |
| 1001 isolate, val, Runtime::GetObjectProperty(isolate, receiver, key), | 1001 isolate, val, Runtime::GetObjectProperty(isolate, receiver, key), |
| 1002 false); | 1002 false); |
| 1003 ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, val, |
| 1004 Object::ToLength(isolate, val), false); |
| 1003 // TODO(caitp): Support larger element indexes (up to 2^53-1). | 1005 // TODO(caitp): Support larger element indexes (up to 2^53-1). |
| 1004 if (!val->ToUint32(&length)) { | 1006 if (!val->ToUint32(&length)) { |
| 1005 ASSIGN_RETURN_ON_EXCEPTION_VALUE( | 1007 length = 0; |
| 1006 isolate, val, Execution::ToLength(isolate, val), false); | |
| 1007 val->ToUint32(&length); | |
| 1008 } | 1008 } |
| 1009 } | 1009 } |
| 1010 | 1010 |
| 1011 if (!(receiver->IsJSArray() || receiver->IsJSTypedArray())) { | 1011 if (!(receiver->IsJSArray() || receiver->IsJSTypedArray())) { |
| 1012 // For classes which are not known to be safe to access via elements alone, | 1012 // For classes which are not known to be safe to access via elements alone, |
| 1013 // use the slow case. | 1013 // use the slow case. |
| 1014 return IterateElementsSlow(isolate, receiver, length, visitor); | 1014 return IterateElementsSlow(isolate, receiver, length, visitor); |
| 1015 } | 1015 } |
| 1016 | 1016 |
| 1017 switch (receiver->GetElementsKind()) { | 1017 switch (receiver->GetElementsKind()) { |
| (...skipping 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2089 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 2089 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
| 2090 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 2090 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
| 2091 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) | 2091 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) |
| 2092 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 2092 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
| 2093 #undef DEFINE_BUILTIN_ACCESSOR_C | 2093 #undef DEFINE_BUILTIN_ACCESSOR_C |
| 2094 #undef DEFINE_BUILTIN_ACCESSOR_A | 2094 #undef DEFINE_BUILTIN_ACCESSOR_A |
| 2095 | 2095 |
| 2096 | 2096 |
| 2097 } // namespace internal | 2097 } // namespace internal |
| 2098 } // namespace v8 | 2098 } // namespace v8 |
| OLD | NEW |