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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/cpu-profiler.h" | 7 #include "src/cpu-profiler.h" |
8 #include "src/ic/call-optimization.h" | 8 #include "src/ic/call-optimization.h" |
9 #include "src/ic/handler-compiler.h" | 9 #include "src/ic/handler-compiler.h" |
10 #include "src/ic/ic.h" | 10 #include "src/ic/ic.h" |
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 receiver(), scratch2(), true, value(), holder, | 530 receiver(), scratch2(), true, value(), holder, |
531 accessor_index); | 531 accessor_index); |
532 return GetCode(kind(), Code::FAST, name); | 532 return GetCode(kind(), Code::FAST, name); |
533 } | 533 } |
534 | 534 |
535 | 535 |
536 #undef __ | 536 #undef __ |
537 | 537 |
538 | 538 |
539 void ElementHandlerCompiler::CompileElementHandlers( | 539 void ElementHandlerCompiler::CompileElementHandlers( |
540 MapHandleList* receiver_maps, CodeHandleList* handlers) { | 540 MapHandleList* receiver_maps, CodeHandleList* handlers, |
| 541 LanguageMode language_mode) { |
541 for (int i = 0; i < receiver_maps->length(); ++i) { | 542 for (int i = 0; i < receiver_maps->length(); ++i) { |
542 Handle<Map> receiver_map = receiver_maps->at(i); | 543 Handle<Map> receiver_map = receiver_maps->at(i); |
543 Handle<Code> cached_stub; | 544 Handle<Code> cached_stub; |
544 | 545 |
545 if (receiver_map->IsStringMap()) { | 546 if (receiver_map->IsStringMap()) { |
546 cached_stub = LoadIndexedStringStub(isolate()).GetCode(); | 547 cached_stub = LoadIndexedStringStub(isolate()).GetCode(); |
547 } else if (receiver_map->instance_type() < FIRST_JS_RECEIVER_TYPE) { | 548 } else if (receiver_map->instance_type() < FIRST_JS_RECEIVER_TYPE) { |
548 cached_stub = isolate()->builtins()->KeyedLoadIC_Slow(); | 549 cached_stub = is_strong(language_mode) |
| 550 ? isolate()->builtins()->KeyedLoadIC_Slow_Strong() |
| 551 : isolate()->builtins()->KeyedLoadIC_Slow(); |
549 } else { | 552 } else { |
550 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; | 553 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; |
551 ElementsKind elements_kind = receiver_map->elements_kind(); | 554 ElementsKind elements_kind = receiver_map->elements_kind(); |
552 | 555 |
553 // No need to check for an elements-free prototype chain here, the | 556 // No need to check for an elements-free prototype chain here, the |
554 // generated stub code needs to check that dynamically anyway. | 557 // generated stub code needs to check that dynamically anyway. |
555 bool convert_hole_to_undefined = | 558 bool convert_hole_to_undefined = |
556 is_js_array && elements_kind == FAST_HOLEY_ELEMENTS && | 559 (is_js_array && elements_kind == FAST_HOLEY_ELEMENTS && |
557 *receiver_map == isolate()->get_initial_js_array_map(elements_kind); | 560 *receiver_map == |
| 561 isolate()->get_initial_js_array_map(elements_kind)) && |
| 562 !is_strong(language_mode); |
558 | 563 |
559 if (receiver_map->has_indexed_interceptor()) { | 564 if (receiver_map->has_indexed_interceptor()) { |
560 cached_stub = LoadIndexedInterceptorStub(isolate()).GetCode(); | 565 cached_stub = LoadIndexedInterceptorStub(isolate()).GetCode(); |
561 } else if (IsSloppyArgumentsElements(elements_kind)) { | 566 } else if (IsSloppyArgumentsElements(elements_kind)) { |
562 cached_stub = KeyedLoadSloppyArgumentsStub(isolate()).GetCode(); | 567 cached_stub = KeyedLoadSloppyArgumentsStub(isolate()).GetCode(); |
563 } else if (IsFastElementsKind(elements_kind) || | 568 } else if (IsFastElementsKind(elements_kind) || |
564 IsExternalArrayElementsKind(elements_kind) || | 569 IsExternalArrayElementsKind(elements_kind) || |
565 IsFixedTypedArrayElementsKind(elements_kind)) { | 570 IsFixedTypedArrayElementsKind(elements_kind)) { |
566 cached_stub = LoadFastElementStub(isolate(), is_js_array, elements_kind, | 571 cached_stub = LoadFastElementStub(isolate(), is_js_array, elements_kind, |
567 convert_hole_to_undefined).GetCode(); | 572 convert_hole_to_undefined).GetCode(); |
568 } else { | 573 } else { |
569 DCHECK(elements_kind == DICTIONARY_ELEMENTS); | 574 DCHECK(elements_kind == DICTIONARY_ELEMENTS); |
570 cached_stub = LoadDictionaryElementStub(isolate()).GetCode(); | 575 LoadICState state = |
| 576 LoadICState(is_strong(language_mode) ? LoadICState::kStrongModeState |
| 577 : kNoExtraICState); |
| 578 cached_stub = LoadDictionaryElementStub(isolate(), state).GetCode(); |
571 } | 579 } |
572 } | 580 } |
573 | 581 |
574 handlers->Add(cached_stub); | 582 handlers->Add(cached_stub); |
575 } | 583 } |
576 } | 584 } |
577 } // namespace internal | 585 } // namespace internal |
578 } // namespace v8 | 586 } // namespace v8 |
OLD | NEW |