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 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 | 627 |
628 ElementsKind elements_kind = receiver_map->elements_kind(); | 628 ElementsKind elements_kind = receiver_map->elements_kind(); |
629 if (IsSloppyArgumentsElements(elements_kind)) { | 629 if (IsSloppyArgumentsElements(elements_kind)) { |
630 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_KeyedLoadSloppyArgumentsStub); | 630 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_KeyedLoadSloppyArgumentsStub); |
631 return KeyedLoadSloppyArgumentsStub(isolate).GetCode(); | 631 return KeyedLoadSloppyArgumentsStub(isolate).GetCode(); |
632 } | 632 } |
633 bool is_js_array = instance_type == JS_ARRAY_TYPE; | 633 bool is_js_array = instance_type == JS_ARRAY_TYPE; |
634 if (elements_kind == DICTIONARY_ELEMENTS) { | 634 if (elements_kind == DICTIONARY_ELEMENTS) { |
635 if (FLAG_tf_load_ic_stub) { | 635 if (FLAG_tf_load_ic_stub) { |
636 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadElementDH); | 636 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadElementDH); |
637 return SmiHandler::MakeKeyedLoadHandler(isolate, elements_kind, false, | 637 return LoadHandler::LoadElement(isolate, elements_kind, false, |
638 is_js_array); | 638 is_js_array); |
639 } | 639 } |
640 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadDictionaryElementStub); | 640 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadDictionaryElementStub); |
641 return LoadDictionaryElementStub(isolate).GetCode(); | 641 return LoadDictionaryElementStub(isolate).GetCode(); |
642 } | 642 } |
643 DCHECK(IsFastElementsKind(elements_kind) || | 643 DCHECK(IsFastElementsKind(elements_kind) || |
644 IsFixedTypedArrayElementsKind(elements_kind)); | 644 IsFixedTypedArrayElementsKind(elements_kind)); |
645 // TODO(jkummerow): Use IsHoleyElementsKind(elements_kind). | 645 // TODO(jkummerow): Use IsHoleyElementsKind(elements_kind). |
646 bool convert_hole_to_undefined = | 646 bool convert_hole_to_undefined = |
647 is_js_array && elements_kind == FAST_HOLEY_ELEMENTS && | 647 is_js_array && elements_kind == FAST_HOLEY_ELEMENTS && |
648 *receiver_map == isolate->get_initial_js_array_map(elements_kind); | 648 *receiver_map == isolate->get_initial_js_array_map(elements_kind); |
649 if (FLAG_tf_load_ic_stub) { | 649 if (FLAG_tf_load_ic_stub) { |
650 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadElementDH); | 650 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadElementDH); |
651 return SmiHandler::MakeKeyedLoadHandler( | 651 return LoadHandler::LoadElement(isolate, elements_kind, |
652 isolate, elements_kind, convert_hole_to_undefined, is_js_array); | 652 convert_hole_to_undefined, is_js_array); |
653 } else { | 653 } else { |
654 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadFastElementStub); | 654 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadFastElementStub); |
655 return LoadFastElementStub(isolate, is_js_array, elements_kind, | 655 return LoadFastElementStub(isolate, is_js_array, elements_kind, |
656 convert_hole_to_undefined) | 656 convert_hole_to_undefined) |
657 .GetCode(); | 657 .GetCode(); |
658 } | 658 } |
659 } | 659 } |
660 | 660 |
661 void ElementHandlerCompiler::CompileElementHandlers( | 661 void ElementHandlerCompiler::CompileElementHandlers( |
662 MapHandleList* receiver_maps, List<Handle<Object>>* handlers) { | 662 MapHandleList* receiver_maps, List<Handle<Object>>* handlers) { |
663 for (int i = 0; i < receiver_maps->length(); ++i) { | 663 for (int i = 0; i < receiver_maps->length(); ++i) { |
664 handlers->Add(GetKeyedLoadHandler(receiver_maps->at(i), isolate())); | 664 handlers->Add(GetKeyedLoadHandler(receiver_maps->at(i), isolate())); |
665 } | 665 } |
666 } | 666 } |
667 } // namespace internal | 667 } // namespace internal |
668 } // namespace v8 | 668 } // namespace v8 |
OLD | NEW |