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