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