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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/cpu-profiler.h" | 7 #include "src/cpu-profiler.h" |
8 #include "src/ic/call-optimization.h" | 8 #include "src/ic/call-optimization.h" |
9 #include "src/ic/handler-compiler.h" | 9 #include "src/ic/handler-compiler.h" |
10 #include "src/ic/ic.h" | 10 #include "src/ic/ic.h" |
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 Handle<Map> receiver_map = receiver_maps->at(i); | 529 Handle<Map> receiver_map = receiver_maps->at(i); |
530 Handle<Code> cached_stub; | 530 Handle<Code> cached_stub; |
531 | 531 |
532 if (receiver_map->IsStringMap()) { | 532 if (receiver_map->IsStringMap()) { |
533 cached_stub = LoadIndexedStringStub(isolate()).GetCode(); | 533 cached_stub = LoadIndexedStringStub(isolate()).GetCode(); |
534 } else if (receiver_map->instance_type() < FIRST_JS_RECEIVER_TYPE) { | 534 } else if (receiver_map->instance_type() < FIRST_JS_RECEIVER_TYPE) { |
535 cached_stub = isolate()->builtins()->KeyedLoadIC_Slow(); | 535 cached_stub = isolate()->builtins()->KeyedLoadIC_Slow(); |
536 } else { | 536 } else { |
537 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; | 537 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; |
538 ElementsKind elements_kind = receiver_map->elements_kind(); | 538 ElementsKind elements_kind = receiver_map->elements_kind(); |
| 539 |
| 540 // No need to check for an elements-free prototype chain here, the |
| 541 // generated stub code needs to check that dynamically anyway. |
| 542 bool convert_hole_to_undefined = |
| 543 is_js_array && elements_kind == FAST_HOLEY_ELEMENTS && |
| 544 *receiver_map == isolate()->get_initial_js_array_map(elements_kind); |
| 545 |
539 if (receiver_map->has_indexed_interceptor()) { | 546 if (receiver_map->has_indexed_interceptor()) { |
540 cached_stub = LoadIndexedInterceptorStub(isolate()).GetCode(); | 547 cached_stub = LoadIndexedInterceptorStub(isolate()).GetCode(); |
541 } else if (IsSloppyArgumentsElements(elements_kind)) { | 548 } else if (IsSloppyArgumentsElements(elements_kind)) { |
542 cached_stub = KeyedLoadSloppyArgumentsStub(isolate()).GetCode(); | 549 cached_stub = KeyedLoadSloppyArgumentsStub(isolate()).GetCode(); |
543 } else if (IsFastElementsKind(elements_kind) || | 550 } else if (IsFastElementsKind(elements_kind) || |
544 IsExternalArrayElementsKind(elements_kind) || | 551 IsExternalArrayElementsKind(elements_kind) || |
545 IsFixedTypedArrayElementsKind(elements_kind)) { | 552 IsFixedTypedArrayElementsKind(elements_kind)) { |
546 cached_stub = LoadFastElementStub(isolate(), is_js_array, elements_kind) | 553 cached_stub = LoadFastElementStub(isolate(), is_js_array, elements_kind, |
547 .GetCode(); | 554 convert_hole_to_undefined).GetCode(); |
548 } else { | 555 } else { |
549 DCHECK(elements_kind == DICTIONARY_ELEMENTS); | 556 DCHECK(elements_kind == DICTIONARY_ELEMENTS); |
550 cached_stub = LoadDictionaryElementStub(isolate()).GetCode(); | 557 cached_stub = LoadDictionaryElementStub(isolate()).GetCode(); |
551 } | 558 } |
552 } | 559 } |
553 | 560 |
554 handlers->Add(cached_stub); | 561 handlers->Add(cached_stub); |
555 } | 562 } |
556 } | 563 } |
557 } | 564 } |
558 } // namespace v8::internal | 565 } // namespace v8::internal |
OLD | NEW |