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/ic-inl.h" | 9 #include "src/ic/ic-inl.h" |
10 #include "src/ic/ic.h" | 10 #include "src/ic/ic.h" |
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 GenerateApiAccessorCall(masm(), call_optimization, handle(object->map()), | 570 GenerateApiAccessorCall(masm(), call_optimization, handle(object->map()), |
571 receiver(), scratch2(), true, value(), holder, | 571 receiver(), scratch2(), true, value(), holder, |
572 accessor_index); | 572 accessor_index); |
573 return GetCode(kind(), name); | 573 return GetCode(kind(), name); |
574 } | 574 } |
575 | 575 |
576 | 576 |
577 #undef __ | 577 #undef __ |
578 | 578 |
579 // static | 579 // static |
580 Handle<Code> ElementHandlerCompiler::GetKeyedLoadHandler( | 580 Handle<Object> ElementHandlerCompiler::GetKeyedLoadHandler( |
581 Handle<Map> receiver_map, Isolate* isolate) { | 581 Handle<Map> receiver_map, Isolate* isolate) { |
582 if (receiver_map->has_indexed_interceptor() && | 582 if (receiver_map->has_indexed_interceptor() && |
583 !receiver_map->GetIndexedInterceptor()->getter()->IsUndefined(isolate) && | 583 !receiver_map->GetIndexedInterceptor()->getter()->IsUndefined(isolate) && |
584 !receiver_map->GetIndexedInterceptor()->non_masking()) { | 584 !receiver_map->GetIndexedInterceptor()->non_masking()) { |
585 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadIndexedInterceptorStub); | 585 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadIndexedInterceptorStub); |
586 return LoadIndexedInterceptorStub(isolate).GetCode(); | 586 return LoadIndexedInterceptorStub(isolate).GetCode(); |
587 } | 587 } |
588 if (receiver_map->IsStringMap()) { | 588 if (receiver_map->IsStringMap()) { |
589 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadIndexedStringStub); | 589 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadIndexedStringStub); |
590 return LoadIndexedStringStub(isolate).GetCode(); | 590 return LoadIndexedStringStub(isolate).GetCode(); |
(...skipping 12 matching lines...) Expand all Loading... |
603 if (elements_kind == DICTIONARY_ELEMENTS) { | 603 if (elements_kind == DICTIONARY_ELEMENTS) { |
604 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadDictionaryElementStub); | 604 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadDictionaryElementStub); |
605 return LoadDictionaryElementStub(isolate).GetCode(); | 605 return LoadDictionaryElementStub(isolate).GetCode(); |
606 } | 606 } |
607 DCHECK(IsFastElementsKind(elements_kind) || | 607 DCHECK(IsFastElementsKind(elements_kind) || |
608 IsFixedTypedArrayElementsKind(elements_kind)); | 608 IsFixedTypedArrayElementsKind(elements_kind)); |
609 bool is_js_array = instance_type == JS_ARRAY_TYPE; | 609 bool is_js_array = instance_type == JS_ARRAY_TYPE; |
610 bool convert_hole_to_undefined = | 610 bool convert_hole_to_undefined = |
611 is_js_array && elements_kind == FAST_HOLEY_ELEMENTS && | 611 is_js_array && elements_kind == FAST_HOLEY_ELEMENTS && |
612 *receiver_map == isolate->get_initial_js_array_map(elements_kind); | 612 *receiver_map == isolate->get_initial_js_array_map(elements_kind); |
613 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadFastElementStub); | 613 if (FLAG_tf_load_ic_stub) { |
614 return LoadFastElementStub(isolate, is_js_array, elements_kind, | 614 int config = KeyedLoadElementsKind::encode(elements_kind) | |
615 convert_hole_to_undefined) | 615 KeyedLoadConvertHole::encode(convert_hole_to_undefined) | |
616 .GetCode(); | 616 KeyedLoadIsJsarray::encode(is_js_array) | |
| 617 0; // Element marker (as opposed to property). |
| 618 return handle(Smi::FromInt(config), isolate); |
| 619 } else { |
| 620 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadFastElementStub); |
| 621 return LoadFastElementStub(isolate, is_js_array, elements_kind, |
| 622 convert_hole_to_undefined) |
| 623 .GetCode(); |
| 624 } |
617 } | 625 } |
618 | 626 |
619 void ElementHandlerCompiler::CompileElementHandlers( | 627 void ElementHandlerCompiler::CompileElementHandlers( |
620 MapHandleList* receiver_maps, List<Handle<Object>>* handlers) { | 628 MapHandleList* receiver_maps, List<Handle<Object>>* handlers) { |
621 for (int i = 0; i < receiver_maps->length(); ++i) { | 629 for (int i = 0; i < receiver_maps->length(); ++i) { |
622 handlers->Add(GetKeyedLoadHandler(receiver_maps->at(i), isolate())); | 630 handlers->Add(GetKeyedLoadHandler(receiver_maps->at(i), isolate())); |
623 } | 631 } |
624 } | 632 } |
625 } // namespace internal | 633 } // namespace internal |
626 } // namespace v8 | 634 } // namespace v8 |
OLD | NEW |