| 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; | |
| 605 if (elements_kind == DICTIONARY_ELEMENTS) { | 604 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 } | |
| 613 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadDictionaryElementStub); | 605 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadDictionaryElementStub); |
| 614 return LoadDictionaryElementStub(isolate).GetCode(); | 606 return LoadDictionaryElementStub(isolate).GetCode(); |
| 615 } | 607 } |
| 616 DCHECK(IsFastElementsKind(elements_kind) || | 608 DCHECK(IsFastElementsKind(elements_kind) || |
| 617 IsFixedTypedArrayElementsKind(elements_kind)); | 609 IsFixedTypedArrayElementsKind(elements_kind)); |
| 618 // TODO(jkummerow): Use IsHoleyElementsKind(elements_kind). | 610 bool is_js_array = instance_type == JS_ARRAY_TYPE; |
| 619 bool convert_hole_to_undefined = | 611 bool convert_hole_to_undefined = |
| 620 is_js_array && elements_kind == FAST_HOLEY_ELEMENTS && | 612 is_js_array && elements_kind == FAST_HOLEY_ELEMENTS && |
| 621 *receiver_map == isolate->get_initial_js_array_map(elements_kind); | 613 *receiver_map == isolate->get_initial_js_array_map(elements_kind); |
| 622 if (FLAG_tf_load_ic_stub) { | 614 if (FLAG_tf_load_ic_stub) { |
| 623 int config = KeyedLoadElementsKind::encode(elements_kind) | | 615 int config = KeyedLoadElementsKind::encode(elements_kind) | |
| 624 KeyedLoadConvertHole::encode(convert_hole_to_undefined) | | 616 KeyedLoadConvertHole::encode(convert_hole_to_undefined) | |
| 625 KeyedLoadIsJsArray::encode(is_js_array) | | 617 KeyedLoadIsJsArray::encode(is_js_array) | |
| 626 LoadHandlerTypeBit::encode(kLoadICHandlerForElements); | 618 LoadHandlerTypeBit::encode(kLoadICHandlerForElements); |
| 627 return handle(Smi::FromInt(config), isolate); | 619 return handle(Smi::FromInt(config), isolate); |
| 628 } else { | 620 } else { |
| 629 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadFastElementStub); | 621 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadFastElementStub); |
| 630 return LoadFastElementStub(isolate, is_js_array, elements_kind, | 622 return LoadFastElementStub(isolate, is_js_array, elements_kind, |
| 631 convert_hole_to_undefined) | 623 convert_hole_to_undefined) |
| 632 .GetCode(); | 624 .GetCode(); |
| 633 } | 625 } |
| 634 } | 626 } |
| 635 | 627 |
| 636 void ElementHandlerCompiler::CompileElementHandlers( | 628 void ElementHandlerCompiler::CompileElementHandlers( |
| 637 MapHandleList* receiver_maps, List<Handle<Object>>* handlers) { | 629 MapHandleList* receiver_maps, List<Handle<Object>>* handlers) { |
| 638 for (int i = 0; i < receiver_maps->length(); ++i) { | 630 for (int i = 0; i < receiver_maps->length(); ++i) { |
| 639 handlers->Add(GetKeyedLoadHandler(receiver_maps->at(i), isolate())); | 631 handlers->Add(GetKeyedLoadHandler(receiver_maps->at(i), isolate())); |
| 640 } | 632 } |
| 641 } | 633 } |
| 642 } // namespace internal | 634 } // namespace internal |
| 643 } // namespace v8 | 635 } // namespace v8 |
| OLD | NEW |