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/ic/handler-compiler.h" | 5 #include "src/ic/handler-compiler.h" |
6 | 6 |
7 #include "src/field-type.h" | 7 #include "src/field-type.h" |
8 #include "src/ic/call-optimization.h" | 8 #include "src/ic/call-optimization.h" |
9 #include "src/ic/handler-configuration-inl.h" | 9 #include "src/ic/handler-configuration-inl.h" |
10 #include "src/ic/ic-inl.h" | 10 #include "src/ic/ic-inl.h" |
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 return isolate->builtins()->KeyedLoadIC_Slow(); | 633 return isolate->builtins()->KeyedLoadIC_Slow(); |
634 } | 634 } |
635 | 635 |
636 ElementsKind elements_kind = receiver_map->elements_kind(); | 636 ElementsKind elements_kind = receiver_map->elements_kind(); |
637 if (IsSloppyArgumentsElements(elements_kind)) { | 637 if (IsSloppyArgumentsElements(elements_kind)) { |
638 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_KeyedLoadSloppyArgumentsStub); | 638 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_KeyedLoadSloppyArgumentsStub); |
639 return KeyedLoadSloppyArgumentsStub(isolate).GetCode(); | 639 return KeyedLoadSloppyArgumentsStub(isolate).GetCode(); |
640 } | 640 } |
641 bool is_js_array = instance_type == JS_ARRAY_TYPE; | 641 bool is_js_array = instance_type == JS_ARRAY_TYPE; |
642 if (elements_kind == DICTIONARY_ELEMENTS) { | 642 if (elements_kind == DICTIONARY_ELEMENTS) { |
643 if (FLAG_tf_load_ic_stub) { | 643 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadElementDH); |
644 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadElementDH); | 644 return LoadHandler::LoadElement(isolate, elements_kind, false, is_js_array); |
645 return LoadHandler::LoadElement(isolate, elements_kind, false, | |
646 is_js_array); | |
647 } | |
648 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadDictionaryElementStub); | |
649 return LoadDictionaryElementStub(isolate).GetCode(); | |
650 } | 645 } |
651 DCHECK(IsFastElementsKind(elements_kind) || | 646 DCHECK(IsFastElementsKind(elements_kind) || |
652 IsFixedTypedArrayElementsKind(elements_kind)); | 647 IsFixedTypedArrayElementsKind(elements_kind)); |
653 // TODO(jkummerow): Use IsHoleyElementsKind(elements_kind). | 648 // TODO(jkummerow): Use IsHoleyElementsKind(elements_kind). |
654 bool convert_hole_to_undefined = | 649 bool convert_hole_to_undefined = |
655 is_js_array && elements_kind == FAST_HOLEY_ELEMENTS && | 650 is_js_array && elements_kind == FAST_HOLEY_ELEMENTS && |
656 *receiver_map == isolate->get_initial_js_array_map(elements_kind); | 651 *receiver_map == isolate->get_initial_js_array_map(elements_kind); |
657 if (FLAG_tf_load_ic_stub) { | 652 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadElementDH); |
658 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadElementDH); | 653 return LoadHandler::LoadElement(isolate, elements_kind, |
659 return LoadHandler::LoadElement(isolate, elements_kind, | 654 convert_hole_to_undefined, is_js_array); |
660 convert_hole_to_undefined, is_js_array); | |
661 } else { | |
662 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadFastElementStub); | |
663 return LoadFastElementStub(isolate, is_js_array, elements_kind, | |
664 convert_hole_to_undefined) | |
665 .GetCode(); | |
666 } | |
667 } | 655 } |
668 | 656 |
669 void ElementHandlerCompiler::CompileElementHandlers( | 657 void ElementHandlerCompiler::CompileElementHandlers( |
670 MapHandleList* receiver_maps, List<Handle<Object>>* handlers) { | 658 MapHandleList* receiver_maps, List<Handle<Object>>* handlers) { |
671 for (int i = 0; i < receiver_maps->length(); ++i) { | 659 for (int i = 0; i < receiver_maps->length(); ++i) { |
672 handlers->Add(GetKeyedLoadHandler(receiver_maps->at(i), isolate())); | 660 handlers->Add(GetKeyedLoadHandler(receiver_maps->at(i), isolate())); |
673 } | 661 } |
674 } | 662 } |
675 } // namespace internal | 663 } // namespace internal |
676 } // namespace v8 | 664 } // namespace v8 |
OLD | NEW |