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