| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/ic/ic.h" | 5 #include "src/ic/ic.h" |
| 6 | 6 |
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/api-arguments-inl.h" | 8 #include "src/api-arguments-inl.h" |
| 9 #include "src/api.h" | 9 #include "src/api.h" |
| 10 #include "src/arguments.h" | 10 #include "src/arguments.h" |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 | 460 |
| 461 void LoadIC::Clear(Isolate* isolate, Code* host, LoadICNexus* nexus) { | 461 void LoadIC::Clear(Isolate* isolate, Code* host, LoadICNexus* nexus) { |
| 462 if (IsCleared(nexus)) return; | 462 if (IsCleared(nexus)) return; |
| 463 nexus->ConfigurePremonomorphic(); | 463 nexus->ConfigurePremonomorphic(); |
| 464 OnTypeFeedbackChanged(isolate, host); | 464 OnTypeFeedbackChanged(isolate, host); |
| 465 } | 465 } |
| 466 | 466 |
| 467 void LoadGlobalIC::Clear(Isolate* isolate, Code* host, | 467 void LoadGlobalIC::Clear(Isolate* isolate, Code* host, |
| 468 LoadGlobalICNexus* nexus) { | 468 LoadGlobalICNexus* nexus) { |
| 469 if (IsCleared(nexus)) return; | 469 if (IsCleared(nexus)) return; |
| 470 if (FLAG_new_load_global_ic) { | 470 nexus->ConfigureUninitialized(); |
| 471 nexus->ConfigureUninitialized(); | |
| 472 } else { | |
| 473 nexus->ConfigurePremonomorphic(); | |
| 474 } | |
| 475 OnTypeFeedbackChanged(isolate, host); | 471 OnTypeFeedbackChanged(isolate, host); |
| 476 } | 472 } |
| 477 | 473 |
| 478 void StoreIC::Clear(Isolate* isolate, Code* host, StoreICNexus* nexus) { | 474 void StoreIC::Clear(Isolate* isolate, Code* host, StoreICNexus* nexus) { |
| 479 if (IsCleared(nexus)) return; | 475 if (IsCleared(nexus)) return; |
| 480 nexus->ConfigurePremonomorphic(); | 476 nexus->ConfigurePremonomorphic(); |
| 481 OnTypeFeedbackChanged(isolate, host); | 477 OnTypeFeedbackChanged(isolate, host); |
| 482 } | 478 } |
| 483 | 479 |
| 484 | 480 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 | 542 |
| 547 | 543 |
| 548 void IC::ConfigureVectorState(Handle<Name> name, Handle<Map> map, | 544 void IC::ConfigureVectorState(Handle<Name> name, Handle<Map> map, |
| 549 Handle<Code> handler) { | 545 Handle<Code> handler) { |
| 550 DCHECK(UseVector()); | 546 DCHECK(UseVector()); |
| 551 if (kind() == Code::LOAD_IC) { | 547 if (kind() == Code::LOAD_IC) { |
| 552 LoadICNexus* nexus = casted_nexus<LoadICNexus>(); | 548 LoadICNexus* nexus = casted_nexus<LoadICNexus>(); |
| 553 nexus->ConfigureMonomorphic(map, handler); | 549 nexus->ConfigureMonomorphic(map, handler); |
| 554 } else if (kind() == Code::LOAD_GLOBAL_IC) { | 550 } else if (kind() == Code::LOAD_GLOBAL_IC) { |
| 555 LoadGlobalICNexus* nexus = casted_nexus<LoadGlobalICNexus>(); | 551 LoadGlobalICNexus* nexus = casted_nexus<LoadGlobalICNexus>(); |
| 556 if (FLAG_new_load_global_ic) { | 552 nexus->ConfigureHandlerMode(handler); |
| 557 nexus->ConfigureHandlerMode(handler); | |
| 558 } else { | |
| 559 nexus->ConfigureMonomorphic(map, handler); | |
| 560 } | |
| 561 } else if (kind() == Code::KEYED_LOAD_IC) { | 553 } else if (kind() == Code::KEYED_LOAD_IC) { |
| 562 KeyedLoadICNexus* nexus = casted_nexus<KeyedLoadICNexus>(); | 554 KeyedLoadICNexus* nexus = casted_nexus<KeyedLoadICNexus>(); |
| 563 nexus->ConfigureMonomorphic(name, map, handler); | 555 nexus->ConfigureMonomorphic(name, map, handler); |
| 564 } else if (kind() == Code::STORE_IC) { | 556 } else if (kind() == Code::STORE_IC) { |
| 565 StoreICNexus* nexus = casted_nexus<StoreICNexus>(); | 557 StoreICNexus* nexus = casted_nexus<StoreICNexus>(); |
| 566 nexus->ConfigureMonomorphic(map, handler); | 558 nexus->ConfigureMonomorphic(map, handler); |
| 567 } else { | 559 } else { |
| 568 DCHECK(kind() == Code::KEYED_STORE_IC); | 560 DCHECK(kind() == Code::KEYED_STORE_IC); |
| 569 KeyedStoreICNexus* nexus = casted_nexus<KeyedStoreICNexus>(); | 561 KeyedStoreICNexus* nexus = casted_nexus<KeyedStoreICNexus>(); |
| 570 nexus->ConfigureMonomorphic(name, map, handler); | 562 nexus->ConfigureMonomorphic(name, map, handler); |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 915 !call_optimization.IsCompatibleReceiverMap(receiver_map, holder)) { | 907 !call_optimization.IsCompatibleReceiverMap(receiver_map, holder)) { |
| 916 return false; | 908 return false; |
| 917 } | 909 } |
| 918 } | 910 } |
| 919 } | 911 } |
| 920 return true; | 912 return true; |
| 921 } | 913 } |
| 922 | 914 |
| 923 | 915 |
| 924 void LoadIC::UpdateCaches(LookupIterator* lookup) { | 916 void LoadIC::UpdateCaches(LookupIterator* lookup) { |
| 925 if (state() == UNINITIALIZED && | 917 if (state() == UNINITIALIZED && kind() != Code::LOAD_GLOBAL_IC) { |
| 926 (!FLAG_new_load_global_ic || kind() != Code::LOAD_GLOBAL_IC)) { | |
| 927 // This is the first time we execute this inline cache. Set the target to | 918 // This is the first time we execute this inline cache. Set the target to |
| 928 // the pre monomorphic stub to delay setting the monomorphic state. | 919 // the pre monomorphic stub to delay setting the monomorphic state. |
| 929 ConfigureVectorState(PREMONOMORPHIC, Handle<Object>()); | 920 ConfigureVectorState(PREMONOMORPHIC, Handle<Object>()); |
| 930 TRACE_IC("LoadIC", lookup->name()); | 921 TRACE_IC("LoadIC", lookup->name()); |
| 931 return; | 922 return; |
| 932 } | 923 } |
| 933 | 924 |
| 934 Handle<Code> code; | 925 Handle<Code> code; |
| 935 if (lookup->state() == LookupIterator::JSPROXY || | 926 if (lookup->state() == LookupIterator::JSPROXY || |
| 936 lookup->state() == LookupIterator::ACCESS_CHECK) { | 927 lookup->state() == LookupIterator::ACCESS_CHECK) { |
| 937 code = slow_stub(); | 928 code = slow_stub(); |
| 938 } else if (!lookup->IsFound()) { | 929 } else if (!lookup->IsFound()) { |
| 939 if (kind() == Code::LOAD_IC || kind() == Code::LOAD_GLOBAL_IC) { | 930 if (kind() == Code::LOAD_IC || kind() == Code::LOAD_GLOBAL_IC) { |
| 940 code = NamedLoadHandlerCompiler::ComputeLoadNonexistent(lookup->name(), | 931 code = NamedLoadHandlerCompiler::ComputeLoadNonexistent(lookup->name(), |
| 941 receiver_map()); | 932 receiver_map()); |
| 942 // TODO(jkummerow/verwaest): Introduce a builtin that handles this case. | 933 // TODO(jkummerow/verwaest): Introduce a builtin that handles this case. |
| 943 if (code.is_null()) code = slow_stub(); | 934 if (code.is_null()) code = slow_stub(); |
| 944 } else { | 935 } else { |
| 945 code = slow_stub(); | 936 code = slow_stub(); |
| 946 } | 937 } |
| 947 } else { | 938 } else { |
| 948 if (FLAG_new_load_global_ic && kind() == Code::LOAD_GLOBAL_IC && | 939 if (kind() == Code::LOAD_GLOBAL_IC && |
| 949 lookup->state() == LookupIterator::DATA && | 940 lookup->state() == LookupIterator::DATA && |
| 950 lookup->GetHolder<Object>()->IsJSGlobalObject()) { | 941 lookup->GetHolder<Object>()->IsJSGlobalObject()) { |
| 951 #if DEBUG | 942 #if DEBUG |
| 952 Handle<Object> holder = lookup->GetHolder<Object>(); | 943 Handle<Object> holder = lookup->GetHolder<Object>(); |
| 953 Handle<Object> receiver = lookup->GetReceiver(); | 944 Handle<Object> receiver = lookup->GetReceiver(); |
| 954 DCHECK_EQ(*receiver, *holder); | 945 DCHECK_EQ(*receiver, *holder); |
| 955 #endif | 946 #endif |
| 956 // Now update the cell in the feedback vector. | 947 // Now update the cell in the feedback vector. |
| 957 LoadGlobalICNexus* nexus = casted_nexus<LoadGlobalICNexus>(); | 948 LoadGlobalICNexus* nexus = casted_nexus<LoadGlobalICNexus>(); |
| 958 nexus->ConfigurePropertyCellMode(lookup->GetPropertyCell()); | 949 nexus->ConfigurePropertyCellMode(lookup->GetPropertyCell()); |
| (...skipping 2066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3025 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_LOAD_IC, | 3016 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_LOAD_IC, |
| 3026 vector->GetKind(vector_slot)); | 3017 vector->GetKind(vector_slot)); |
| 3027 KeyedLoadICNexus nexus(vector, vector_slot); | 3018 KeyedLoadICNexus nexus(vector, vector_slot); |
| 3028 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); | 3019 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); |
| 3029 ic.UpdateState(receiver, key); | 3020 ic.UpdateState(receiver, key); |
| 3030 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key)); | 3021 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key)); |
| 3031 } | 3022 } |
| 3032 } | 3023 } |
| 3033 } // namespace internal | 3024 } // namespace internal |
| 3034 } // namespace v8 | 3025 } // namespace v8 |
| OLD | NEW |