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.h" | 9 #include "src/ic/handler-configuration.h" |
10 #include "src/ic/ic-inl.h" | 10 #include "src/ic/ic-inl.h" |
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 if (instance_type < FIRST_JS_RECEIVER_TYPE) { | 594 if (instance_type < FIRST_JS_RECEIVER_TYPE) { |
595 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_SlowStub); | 595 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_SlowStub); |
596 return isolate->builtins()->KeyedLoadIC_Slow(); | 596 return isolate->builtins()->KeyedLoadIC_Slow(); |
597 } | 597 } |
598 | 598 |
599 ElementsKind elements_kind = receiver_map->elements_kind(); | 599 ElementsKind elements_kind = receiver_map->elements_kind(); |
600 if (IsSloppyArgumentsElements(elements_kind)) { | 600 if (IsSloppyArgumentsElements(elements_kind)) { |
601 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_KeyedLoadSloppyArgumentsStub); | 601 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_KeyedLoadSloppyArgumentsStub); |
602 return KeyedLoadSloppyArgumentsStub(isolate).GetCode(); | 602 return KeyedLoadSloppyArgumentsStub(isolate).GetCode(); |
603 } | 603 } |
| 604 bool is_js_array = instance_type == JS_ARRAY_TYPE; |
604 if (elements_kind == DICTIONARY_ELEMENTS) { | 605 if (elements_kind == DICTIONARY_ELEMENTS) { |
| 606 if (FLAG_tf_load_ic_stub) { |
| 607 int config = KeyedLoadElementsKind::encode(elements_kind) | |
| 608 KeyedLoadConvertHole::encode(false) | |
| 609 KeyedLoadIsJsArray::encode(is_js_array) | |
| 610 LoadHandlerTypeBit::encode(kLoadICHandlerForElements); |
| 611 return handle(Smi::FromInt(config), isolate); |
| 612 } |
605 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadDictionaryElementStub); | 613 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadDictionaryElementStub); |
606 return LoadDictionaryElementStub(isolate).GetCode(); | 614 return LoadDictionaryElementStub(isolate).GetCode(); |
607 } | 615 } |
608 DCHECK(IsFastElementsKind(elements_kind) || | 616 DCHECK(IsFastElementsKind(elements_kind) || |
609 IsFixedTypedArrayElementsKind(elements_kind)); | 617 IsFixedTypedArrayElementsKind(elements_kind)); |
610 bool is_js_array = instance_type == JS_ARRAY_TYPE; | 618 // TODO(jkummerow): Use IsHoleyElementsKind(elements_kind). |
611 bool convert_hole_to_undefined = | 619 bool convert_hole_to_undefined = |
612 is_js_array && elements_kind == FAST_HOLEY_ELEMENTS && | 620 is_js_array && elements_kind == FAST_HOLEY_ELEMENTS && |
613 *receiver_map == isolate->get_initial_js_array_map(elements_kind); | 621 *receiver_map == isolate->get_initial_js_array_map(elements_kind); |
614 if (FLAG_tf_load_ic_stub) { | 622 if (FLAG_tf_load_ic_stub) { |
615 int config = KeyedLoadElementsKind::encode(elements_kind) | | 623 int config = KeyedLoadElementsKind::encode(elements_kind) | |
616 KeyedLoadConvertHole::encode(convert_hole_to_undefined) | | 624 KeyedLoadConvertHole::encode(convert_hole_to_undefined) | |
617 KeyedLoadIsJsArray::encode(is_js_array) | | 625 KeyedLoadIsJsArray::encode(is_js_array) | |
618 LoadHandlerTypeBit::encode(kLoadICHandlerForElements); | 626 LoadHandlerTypeBit::encode(kLoadICHandlerForElements); |
619 return handle(Smi::FromInt(config), isolate); | 627 return handle(Smi::FromInt(config), isolate); |
620 } else { | 628 } else { |
621 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadFastElementStub); | 629 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadFastElementStub); |
622 return LoadFastElementStub(isolate, is_js_array, elements_kind, | 630 return LoadFastElementStub(isolate, is_js_array, elements_kind, |
623 convert_hole_to_undefined) | 631 convert_hole_to_undefined) |
624 .GetCode(); | 632 .GetCode(); |
625 } | 633 } |
626 } | 634 } |
627 | 635 |
628 void ElementHandlerCompiler::CompileElementHandlers( | 636 void ElementHandlerCompiler::CompileElementHandlers( |
629 MapHandleList* receiver_maps, List<Handle<Object>>* handlers) { | 637 MapHandleList* receiver_maps, List<Handle<Object>>* handlers) { |
630 for (int i = 0; i < receiver_maps->length(); ++i) { | 638 for (int i = 0; i < receiver_maps->length(); ++i) { |
631 handlers->Add(GetKeyedLoadHandler(receiver_maps->at(i), isolate())); | 639 handlers->Add(GetKeyedLoadHandler(receiver_maps->at(i), isolate())); |
632 } | 640 } |
633 } | 641 } |
634 } // namespace internal | 642 } // namespace internal |
635 } // namespace v8 | 643 } // namespace v8 |
OLD | NEW |