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