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