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 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 receiver(), scratch2(), true, value(), holder, | 517 receiver(), scratch2(), true, value(), holder, |
518 accessor_index); | 518 accessor_index); |
519 return GetCode(kind(), Code::FAST, name); | 519 return GetCode(kind(), Code::FAST, name); |
520 } | 520 } |
521 | 521 |
522 | 522 |
523 #undef __ | 523 #undef __ |
524 | 524 |
525 | 525 |
526 void ElementHandlerCompiler::CompileElementHandlers( | 526 void ElementHandlerCompiler::CompileElementHandlers( |
527 MapHandleList* receiver_maps, CodeHandleList* handlers) { | 527 MapHandleList* receiver_maps, CodeHandleList* handlers, Strength strength) { |
528 for (int i = 0; i < receiver_maps->length(); ++i) { | 528 for (int i = 0; i < receiver_maps->length(); ++i) { |
529 Handle<Map> receiver_map = receiver_maps->at(i); | 529 Handle<Map> receiver_map = receiver_maps->at(i); |
530 Handle<Code> cached_stub; | 530 Handle<Code> cached_stub; |
531 | 531 |
532 if (receiver_map->IsStringMap()) { | 532 if (receiver_map->IsStringMap()) { |
533 cached_stub = LoadIndexedStringStub(isolate()).GetCode(); | 533 cached_stub = LoadIndexedStringStub(isolate()).GetCode(); |
534 } else if (receiver_map->instance_type() < FIRST_JS_RECEIVER_TYPE) { | 534 } else if (receiver_map->instance_type() < FIRST_JS_RECEIVER_TYPE) { |
535 cached_stub = isolate()->builtins()->KeyedLoadIC_Slow(); | 535 cached_stub = isolate()->builtins()->KeyedLoadIC_Slow(); |
536 } else { | 536 } else { |
537 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; | 537 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; |
538 ElementsKind elements_kind = receiver_map->elements_kind(); | 538 ElementsKind elements_kind = receiver_map->elements_kind(); |
539 | 539 |
540 // No need to check for an elements-free prototype chain here, the | 540 // No need to check for an elements-free prototype chain here, the |
541 // generated stub code needs to check that dynamically anyway. | 541 // generated stub code needs to check that dynamically anyway. |
542 bool convert_hole_to_undefined = | 542 bool convert_hole_to_undefined = |
543 is_js_array && elements_kind == FAST_HOLEY_ELEMENTS && | 543 (is_js_array && elements_kind == FAST_HOLEY_ELEMENTS && |
544 *receiver_map == isolate()->get_initial_js_array_map(elements_kind); | 544 *receiver_map == |
| 545 isolate()->get_initial_js_array_map(elements_kind)) && |
| 546 !is_strong(strength); |
545 | 547 |
546 if (receiver_map->has_indexed_interceptor()) { | 548 if (receiver_map->has_indexed_interceptor()) { |
547 cached_stub = LoadIndexedInterceptorStub(isolate()).GetCode(); | 549 cached_stub = LoadIndexedInterceptorStub(isolate()).GetCode(); |
548 } else if (IsSloppyArgumentsElements(elements_kind)) { | 550 } else if (IsSloppyArgumentsElements(elements_kind)) { |
549 cached_stub = KeyedLoadSloppyArgumentsStub(isolate()).GetCode(); | 551 cached_stub = KeyedLoadSloppyArgumentsStub(isolate()).GetCode(); |
550 } else if (IsFastElementsKind(elements_kind) || | 552 } else if (IsFastElementsKind(elements_kind) || |
551 IsExternalArrayElementsKind(elements_kind) || | 553 IsExternalArrayElementsKind(elements_kind) || |
552 IsFixedTypedArrayElementsKind(elements_kind)) { | 554 IsFixedTypedArrayElementsKind(elements_kind)) { |
553 cached_stub = LoadFastElementStub(isolate(), is_js_array, elements_kind, | 555 cached_stub = LoadFastElementStub(isolate(), is_js_array, elements_kind, |
554 convert_hole_to_undefined).GetCode(); | 556 convert_hole_to_undefined).GetCode(); |
555 } else { | 557 } else { |
556 DCHECK(elements_kind == DICTIONARY_ELEMENTS); | 558 DCHECK(elements_kind == DICTIONARY_ELEMENTS); |
557 cached_stub = LoadDictionaryElementStub(isolate()).GetCode(); | 559 LoadICState state = LoadICState( |
| 560 is_strong(strength) ? LoadICState::kStrongModeState : 0); |
| 561 cached_stub = LoadDictionaryElementStub(isolate(), state).GetCode(); |
558 } | 562 } |
559 } | 563 } |
560 | 564 |
561 handlers->Add(cached_stub); | 565 handlers->Add(cached_stub); |
562 } | 566 } |
563 } | 567 } |
564 } // namespace internal | 568 } // namespace internal |
565 } // namespace v8 | 569 } // namespace v8 |
OLD | NEW |