| 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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 } | 208 } |
| 209 *out = Smi::cast(len_obj)->value(); | 209 *out = Smi::cast(len_obj)->value(); |
| 210 return *out <= object->elements()->length(); | 210 return *out <= object->elements()->length(); |
| 211 } | 211 } |
| 212 | 212 |
| 213 | 213 |
| 214 inline bool PrototypeHasNoElements(PrototypeIterator* iter) { | 214 inline bool PrototypeHasNoElements(PrototypeIterator* iter) { |
| 215 DisallowHeapAllocation no_gc; | 215 DisallowHeapAllocation no_gc; |
| 216 for (; !iter->IsAtEnd(); iter->Advance()) { | 216 for (; !iter->IsAtEnd(); iter->Advance()) { |
| 217 if (iter->GetCurrent()->IsJSProxy()) return false; | 217 if (iter->GetCurrent()->IsJSProxy()) return false; |
| 218 JSObject* current = JSObject::cast(iter->GetCurrent()); | 218 JSObject* current = iter->GetCurrent<JSObject>(); |
| 219 if (current->IsAccessCheckNeeded()) return false; | 219 if (current->IsAccessCheckNeeded()) return false; |
| 220 if (current->HasIndexedInterceptor()) return false; | 220 if (current->HasIndexedInterceptor()) return false; |
| 221 if (current->elements()->length() != 0) return false; | 221 if (current->elements()->length() != 0) return false; |
| 222 } | 222 } |
| 223 return true; | 223 return true; |
| 224 } | 224 } |
| 225 | 225 |
| 226 | 226 |
| 227 inline bool IsJSArrayFastElementMovingAllowed(Isolate* isolate, | 227 inline bool IsJSArrayFastElementMovingAllowed(Isolate* isolate, |
| 228 JSArray* receiver) { | 228 JSArray* receiver) { |
| (...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 946 } | 946 } |
| 947 } | 947 } |
| 948 break; | 948 break; |
| 949 } | 949 } |
| 950 } | 950 } |
| 951 | 951 |
| 952 PrototypeIterator iter(isolate, object); | 952 PrototypeIterator iter(isolate, object); |
| 953 if (!iter.IsAtEnd()) { | 953 if (!iter.IsAtEnd()) { |
| 954 // The prototype will usually have no inherited element indices, | 954 // The prototype will usually have no inherited element indices, |
| 955 // but we have to check. | 955 // but we have to check. |
| 956 CollectElementIndices( | 956 CollectElementIndices(PrototypeIterator::GetCurrent<JSObject>(iter), range, |
| 957 Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter)), range, | 957 indices); |
| 958 indices); | |
| 959 } | 958 } |
| 960 } | 959 } |
| 961 | 960 |
| 962 | 961 |
| 963 bool IterateElementsSlow(Isolate* isolate, Handle<JSObject> receiver, | 962 bool IterateElementsSlow(Isolate* isolate, Handle<JSObject> receiver, |
| 964 uint32_t length, ArrayConcatVisitor* visitor) { | 963 uint32_t length, ArrayConcatVisitor* visitor) { |
| 965 for (uint32_t i = 0; i < length; ++i) { | 964 for (uint32_t i = 0; i < length; ++i) { |
| 966 HandleScope loop_scope(isolate); | 965 HandleScope loop_scope(isolate); |
| 967 Maybe<bool> maybe = JSReceiver::HasElement(receiver, i); | 966 Maybe<bool> maybe = JSReceiver::HasElement(receiver, i); |
| 968 if (!maybe.IsJust()) return false; | 967 if (!maybe.IsJust()) return false; |
| (...skipping 1106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2075 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 2074 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
| 2076 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 2075 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
| 2077 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) | 2076 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) |
| 2078 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 2077 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
| 2079 #undef DEFINE_BUILTIN_ACCESSOR_C | 2078 #undef DEFINE_BUILTIN_ACCESSOR_C |
| 2080 #undef DEFINE_BUILTIN_ACCESSOR_A | 2079 #undef DEFINE_BUILTIN_ACCESSOR_A |
| 2081 | 2080 |
| 2082 | 2081 |
| 2083 } // namespace internal | 2082 } // namespace internal |
| 2084 } // namespace v8 | 2083 } // namespace v8 |
| OLD | NEW |