| 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 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 Register holder = Frontend(name); | 554 Register holder = Frontend(name); |
| 555 GenerateApiAccessorCall(masm(), call_optimization, handle(object->map()), | 555 GenerateApiAccessorCall(masm(), call_optimization, handle(object->map()), |
| 556 receiver(), scratch2(), true, value(), holder, | 556 receiver(), scratch2(), true, value(), holder, |
| 557 accessor_index); | 557 accessor_index); |
| 558 return GetCode(kind(), Code::FAST, name); | 558 return GetCode(kind(), Code::FAST, name); |
| 559 } | 559 } |
| 560 | 560 |
| 561 | 561 |
| 562 #undef __ | 562 #undef __ |
| 563 | 563 |
| 564 | |
| 565 void ElementHandlerCompiler::CompileElementHandlers( | 564 void ElementHandlerCompiler::CompileElementHandlers( |
| 566 MapHandleList* receiver_maps, CodeHandleList* handlers, | 565 MapHandleList* receiver_maps, CodeHandleList* handlers) { |
| 567 LanguageMode language_mode) { | |
| 568 for (int i = 0; i < receiver_maps->length(); ++i) { | 566 for (int i = 0; i < receiver_maps->length(); ++i) { |
| 569 Handle<Map> receiver_map = receiver_maps->at(i); | 567 Handle<Map> receiver_map = receiver_maps->at(i); |
| 570 Handle<Code> cached_stub; | 568 Handle<Code> cached_stub; |
| 571 | 569 |
| 572 if (receiver_map->IsStringMap()) { | 570 if (receiver_map->IsStringMap()) { |
| 573 cached_stub = LoadIndexedStringStub(isolate()).GetCode(); | 571 cached_stub = LoadIndexedStringStub(isolate()).GetCode(); |
| 574 } else if (receiver_map->instance_type() < FIRST_JS_RECEIVER_TYPE) { | 572 } else if (receiver_map->instance_type() < FIRST_JS_RECEIVER_TYPE) { |
| 575 cached_stub = is_strong(language_mode) | 573 cached_stub = isolate()->builtins()->KeyedLoadIC_Slow(); |
| 576 ? isolate()->builtins()->KeyedLoadIC_Slow_Strong() | |
| 577 : isolate()->builtins()->KeyedLoadIC_Slow(); | |
| 578 } else { | 574 } else { |
| 579 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; | 575 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; |
| 580 ElementsKind elements_kind = receiver_map->elements_kind(); | 576 ElementsKind elements_kind = receiver_map->elements_kind(); |
| 581 | 577 |
| 582 // No need to check for an elements-free prototype chain here, the | 578 // No need to check for an elements-free prototype chain here, the |
| 583 // generated stub code needs to check that dynamically anyway. | 579 // generated stub code needs to check that dynamically anyway. |
| 584 bool convert_hole_to_undefined = | 580 bool convert_hole_to_undefined = |
| 585 (is_js_array && elements_kind == FAST_HOLEY_ELEMENTS && | 581 (is_js_array && elements_kind == FAST_HOLEY_ELEMENTS && |
| 586 *receiver_map == | 582 *receiver_map == isolate()->get_initial_js_array_map(elements_kind)); |
| 587 isolate()->get_initial_js_array_map(elements_kind)) && | |
| 588 !is_strong(language_mode); | |
| 589 | 583 |
| 590 if (receiver_map->has_indexed_interceptor()) { | 584 if (receiver_map->has_indexed_interceptor()) { |
| 591 cached_stub = LoadIndexedInterceptorStub(isolate()).GetCode(); | 585 cached_stub = LoadIndexedInterceptorStub(isolate()).GetCode(); |
| 592 } else if (IsSloppyArgumentsElements(elements_kind)) { | 586 } else if (IsSloppyArgumentsElements(elements_kind)) { |
| 593 cached_stub = KeyedLoadSloppyArgumentsStub(isolate()).GetCode(); | 587 cached_stub = KeyedLoadSloppyArgumentsStub(isolate()).GetCode(); |
| 594 } else if (IsFastElementsKind(elements_kind) || | 588 } else if (IsFastElementsKind(elements_kind) || |
| 595 IsFixedTypedArrayElementsKind(elements_kind)) { | 589 IsFixedTypedArrayElementsKind(elements_kind)) { |
| 596 cached_stub = LoadFastElementStub(isolate(), is_js_array, elements_kind, | 590 cached_stub = LoadFastElementStub(isolate(), is_js_array, elements_kind, |
| 597 convert_hole_to_undefined).GetCode(); | 591 convert_hole_to_undefined).GetCode(); |
| 598 } else { | 592 } else { |
| 599 DCHECK(elements_kind == DICTIONARY_ELEMENTS); | 593 DCHECK(elements_kind == DICTIONARY_ELEMENTS); |
| 600 LoadICState state = | 594 LoadICState state = LoadICState(kNoExtraICState); |
| 601 LoadICState(is_strong(language_mode) ? LoadICState::kStrongModeState | |
| 602 : kNoExtraICState); | |
| 603 cached_stub = LoadDictionaryElementStub(isolate(), state).GetCode(); | 595 cached_stub = LoadDictionaryElementStub(isolate(), state).GetCode(); |
| 604 } | 596 } |
| 605 } | 597 } |
| 606 | 598 |
| 607 handlers->Add(cached_stub); | 599 handlers->Add(cached_stub); |
| 608 } | 600 } |
| 609 } | 601 } |
| 610 } // namespace internal | 602 } // namespace internal |
| 611 } // namespace v8 | 603 } // namespace v8 |
| OLD | NEW |