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 = isolate()->builtins()->KeyedLoadIC_Slow(); |
549 } else { | 550 } else { |
550 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; | 551 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; |
551 ElementsKind elements_kind = receiver_map->elements_kind(); | 552 ElementsKind elements_kind = receiver_map->elements_kind(); |
552 | 553 |
553 // No need to check for an elements-free prototype chain here, the | 554 // No need to check for an elements-free prototype chain here, the |
554 // generated stub code needs to check that dynamically anyway. | 555 // generated stub code needs to check that dynamically anyway. |
555 bool convert_hole_to_undefined = | 556 bool convert_hole_to_undefined = |
556 is_js_array && elements_kind == FAST_HOLEY_ELEMENTS && | 557 (is_js_array && elements_kind == FAST_HOLEY_ELEMENTS && |
557 *receiver_map == isolate()->get_initial_js_array_map(elements_kind); | 558 *receiver_map == |
| 559 isolate()->get_initial_js_array_map(elements_kind)) && |
| 560 !is_strong(language_mode); |
558 | 561 |
559 if (receiver_map->has_indexed_interceptor()) { | 562 if (receiver_map->has_indexed_interceptor()) { |
560 cached_stub = LoadIndexedInterceptorStub(isolate()).GetCode(); | 563 cached_stub = LoadIndexedInterceptorStub(isolate()).GetCode(); |
561 } else if (IsSloppyArgumentsElements(elements_kind)) { | 564 } else if (IsSloppyArgumentsElements(elements_kind)) { |
562 cached_stub = KeyedLoadSloppyArgumentsStub(isolate()).GetCode(); | 565 cached_stub = KeyedLoadSloppyArgumentsStub(isolate()).GetCode(); |
563 } else if (IsFastElementsKind(elements_kind) || | 566 } else if (IsFastElementsKind(elements_kind) || |
564 IsExternalArrayElementsKind(elements_kind) || | 567 IsExternalArrayElementsKind(elements_kind) || |
565 IsFixedTypedArrayElementsKind(elements_kind)) { | 568 IsFixedTypedArrayElementsKind(elements_kind)) { |
566 cached_stub = LoadFastElementStub(isolate(), is_js_array, elements_kind, | 569 cached_stub = LoadFastElementStub(isolate(), is_js_array, elements_kind, |
567 convert_hole_to_undefined).GetCode(); | 570 convert_hole_to_undefined).GetCode(); |
568 } else { | 571 } else { |
569 DCHECK(elements_kind == DICTIONARY_ELEMENTS); | 572 DCHECK(elements_kind == DICTIONARY_ELEMENTS); |
570 cached_stub = LoadDictionaryElementStub(isolate()).GetCode(); | 573 LoadICState state = LoadICState( |
| 574 is_strong(language_mode) ? LoadICState::kStrongModeState : 0); |
| 575 cached_stub = LoadDictionaryElementStub(isolate(), state).GetCode(); |
571 } | 576 } |
572 } | 577 } |
573 | 578 |
574 handlers->Add(cached_stub); | 579 handlers->Add(cached_stub); |
575 } | 580 } |
576 } | 581 } |
577 } // namespace internal | 582 } // namespace internal |
578 } // namespace v8 | 583 } // namespace v8 |
OLD | NEW |