OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.h" |
6 | 6 |
7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/conversions-inl.h" | 9 #include "src/conversions-inl.h" |
10 #include "src/elements.h" | 10 #include "src/elements.h" |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 !iter.IsAtEnd(); iter.Advance()) { | 206 !iter.IsAtEnd(); iter.Advance()) { |
207 if (PrototypeIterator::GetCurrent(iter)->IsJSProxy() || | 207 if (PrototypeIterator::GetCurrent(iter)->IsJSProxy() || |
208 PrototypeIterator::GetCurrent<JSObject>(iter) | 208 PrototypeIterator::GetCurrent<JSObject>(iter) |
209 ->HasIndexedInterceptor()) { | 209 ->HasIndexedInterceptor()) { |
210 // Bail out if we find a proxy or interceptor, likely not worth | 210 // Bail out if we find a proxy or interceptor, likely not worth |
211 // collecting keys in that case. | 211 // collecting keys in that case. |
212 return *isolate->factory()->NewNumberFromUint(length); | 212 return *isolate->factory()->NewNumberFromUint(length); |
213 } | 213 } |
214 accumulator.NextPrototype(); | 214 accumulator.NextPrototype(); |
215 Handle<JSObject> current = PrototypeIterator::GetCurrent<JSObject>(iter); | 215 Handle<JSObject> current = PrototypeIterator::GetCurrent<JSObject>(iter); |
216 JSObject::CollectOwnElementKeys(current, &accumulator, ALL_PROPERTIES); | 216 accumulator.CollectOwnElementKeys(current); |
217 } | 217 } |
218 // Erase any keys >= length. | 218 // Erase any keys >= length. |
219 Handle<FixedArray> keys = accumulator.GetKeys(KEEP_NUMBERS); | 219 Handle<FixedArray> keys = accumulator.GetKeys(KEEP_NUMBERS); |
220 int j = 0; | 220 int j = 0; |
221 for (int i = 0; i < keys->length(); i++) { | 221 for (int i = 0; i < keys->length(); i++) { |
222 if (NumberToUint32(keys->get(i)) >= length) continue; | 222 if (NumberToUint32(keys->get(i)) >= length) continue; |
223 if (i != j) keys->set(j, keys->get(i)); | 223 if (i != j) keys->set(j, keys->get(i)); |
224 j++; | 224 j++; |
225 } | 225 } |
226 | 226 |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 CONVERT_ARG_HANDLE_CHECKED(Object, original_array, 0); | 493 CONVERT_ARG_HANDLE_CHECKED(Object, original_array, 0); |
494 Handle<Object> constructor; | 494 Handle<Object> constructor; |
495 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 495 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
496 isolate, constructor, | 496 isolate, constructor, |
497 Object::ArraySpeciesConstructor(isolate, original_array)); | 497 Object::ArraySpeciesConstructor(isolate, original_array)); |
498 return *constructor; | 498 return *constructor; |
499 } | 499 } |
500 | 500 |
501 } // namespace internal | 501 } // namespace internal |
502 } // namespace v8 | 502 } // namespace v8 |
OLD | NEW |