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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 for (PrototypeIterator iter(isolate, array, | 204 for (PrototypeIterator iter(isolate, array, |
205 PrototypeIterator::START_AT_RECEIVER); | 205 PrototypeIterator::START_AT_RECEIVER); |
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 Handle<JSObject> current = PrototypeIterator::GetCurrent<JSObject>(iter); | 215 Handle<JSObject> current = PrototypeIterator::GetCurrent<JSObject>(iter); |
215 accumulator.CollectOwnElementIndices(array, current); | 216 accumulator.CollectOwnElementIndices(current); |
216 } | 217 } |
217 // Erase any keys >= length. | 218 // Erase any keys >= length. |
218 Handle<FixedArray> keys = accumulator.GetKeys(KEEP_NUMBERS); | 219 Handle<FixedArray> keys = accumulator.GetKeys(KEEP_NUMBERS); |
219 int j = 0; | 220 int j = 0; |
220 for (int i = 0; i < keys->length(); i++) { | 221 for (int i = 0; i < keys->length(); i++) { |
221 if (NumberToUint32(keys->get(i)) >= length) continue; | 222 if (NumberToUint32(keys->get(i)) >= length) continue; |
222 if (i != j) keys->set(j, keys->get(i)); | 223 if (i != j) keys->set(j, keys->get(i)); |
223 j++; | 224 j++; |
224 } | 225 } |
225 | 226 |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 RUNTIME_FUNCTION(Runtime_ArraySpeciesConstructor) { | 503 RUNTIME_FUNCTION(Runtime_ArraySpeciesConstructor) { |
503 HandleScope scope(isolate); | 504 HandleScope scope(isolate); |
504 DCHECK(args.length() == 1); | 505 DCHECK(args.length() == 1); |
505 CONVERT_ARG_HANDLE_CHECKED(Object, original_array, 0); | 506 CONVERT_ARG_HANDLE_CHECKED(Object, original_array, 0); |
506 RETURN_RESULT_OR_FAILURE( | 507 RETURN_RESULT_OR_FAILURE( |
507 isolate, Object::ArraySpeciesConstructor(isolate, original_array)); | 508 isolate, Object::ArraySpeciesConstructor(isolate, original_array)); |
508 } | 509 } |
509 | 510 |
510 } // namespace internal | 511 } // namespace internal |
511 } // namespace v8 | 512 } // namespace v8 |
OLD | NEW |