OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/accessor-assembler.h" | 5 #include "src/ic/accessor-assembler.h" |
6 | 6 |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/counters.h" | 9 #include "src/counters.h" |
10 #include "src/ic/handler-configuration.h" | 10 #include "src/ic/handler-configuration.h" |
(...skipping 2023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2034 Bind(&slow); | 2034 Bind(&slow); |
2035 { | 2035 { |
2036 Comment("KeyedLoadGeneric_slow"); | 2036 Comment("KeyedLoadGeneric_slow"); |
2037 IncrementCounter(isolate()->counters()->ic_keyed_load_generic_slow(), 1); | 2037 IncrementCounter(isolate()->counters()->ic_keyed_load_generic_slow(), 1); |
2038 // TODO(jkummerow): Should we use the GetProperty TF stub instead? | 2038 // TODO(jkummerow): Should we use the GetProperty TF stub instead? |
2039 TailCallRuntime(Runtime::kKeyedGetProperty, p->context, p->receiver, | 2039 TailCallRuntime(Runtime::kKeyedGetProperty, p->context, p->receiver, |
2040 p->name); | 2040 p->name); |
2041 } | 2041 } |
2042 } | 2042 } |
2043 | 2043 |
2044 void AccessorAssembler::StoreIC(const StoreICParameters* p) { | 2044 void AccessorAssembler::StoreIC(const StoreICParameters* p, |
| 2045 LanguageMode language_mode) { |
2045 Variable var_handler(this, MachineRepresentation::kTagged); | 2046 Variable var_handler(this, MachineRepresentation::kTagged); |
2046 Label if_handler(this, &var_handler), try_polymorphic(this, Label::kDeferred), | 2047 Label if_handler(this, &var_handler), try_polymorphic(this, Label::kDeferred), |
2047 try_megamorphic(this, Label::kDeferred), miss(this, Label::kDeferred); | 2048 try_megamorphic(this, Label::kDeferred), |
| 2049 try_uninitialized(this, Label::kDeferred), miss(this, Label::kDeferred); |
2048 | 2050 |
2049 Node* receiver_map = LoadReceiverMap(p->receiver); | 2051 Node* receiver_map = LoadReceiverMap(p->receiver); |
2050 GotoIf(IsDeprecatedMap(receiver_map), &miss); | 2052 GotoIf(IsDeprecatedMap(receiver_map), &miss); |
2051 | 2053 |
2052 // Check monomorphic case. | 2054 // Check monomorphic case. |
2053 Node* feedback = | 2055 Node* feedback = |
2054 TryMonomorphicCase(p->slot, p->vector, receiver_map, &if_handler, | 2056 TryMonomorphicCase(p->slot, p->vector, receiver_map, &if_handler, |
2055 &var_handler, &try_polymorphic); | 2057 &var_handler, &try_polymorphic); |
2056 Bind(&if_handler); | 2058 Bind(&if_handler); |
2057 { | 2059 { |
2058 Comment("StoreIC_if_handler"); | 2060 Comment("StoreIC_if_handler"); |
2059 HandleStoreICHandlerCase(p, var_handler.value(), &miss); | 2061 HandleStoreICHandlerCase(p, var_handler.value(), &miss); |
2060 } | 2062 } |
2061 | 2063 |
2062 Bind(&try_polymorphic); | 2064 Bind(&try_polymorphic); |
2063 { | 2065 { |
2064 // Check polymorphic case. | 2066 // Check polymorphic case. |
2065 Comment("StoreIC_try_polymorphic"); | 2067 Comment("StoreIC_try_polymorphic"); |
2066 GotoIfNot( | 2068 GotoIfNot( |
2067 WordEqual(LoadMap(feedback), LoadRoot(Heap::kFixedArrayMapRootIndex)), | 2069 WordEqual(LoadMap(feedback), LoadRoot(Heap::kFixedArrayMapRootIndex)), |
2068 &try_megamorphic); | 2070 &try_megamorphic); |
2069 HandlePolymorphicCase(receiver_map, feedback, &if_handler, &var_handler, | 2071 HandlePolymorphicCase(receiver_map, feedback, &if_handler, &var_handler, |
2070 &miss, 2); | 2072 &miss, 2); |
2071 } | 2073 } |
2072 | 2074 |
2073 Bind(&try_megamorphic); | 2075 Bind(&try_megamorphic); |
2074 { | 2076 { |
2075 // Check megamorphic case. | 2077 // Check megamorphic case. |
2076 GotoIfNot(WordEqual(feedback, LoadRoot(Heap::kmegamorphic_symbolRootIndex)), | 2078 GotoIfNot(WordEqual(feedback, LoadRoot(Heap::kmegamorphic_symbolRootIndex)), |
2077 &miss); | 2079 &try_uninitialized); |
2078 | 2080 |
2079 TryProbeStubCache(isolate()->store_stub_cache(), p->receiver, p->name, | 2081 TryProbeStubCache(isolate()->store_stub_cache(), p->receiver, p->name, |
2080 &if_handler, &var_handler, &miss); | 2082 &if_handler, &var_handler, &miss); |
2081 } | 2083 } |
| 2084 Bind(&try_uninitialized); |
| 2085 { |
| 2086 // Check uninitialized case. |
| 2087 GotoIfNot( |
| 2088 WordEqual(feedback, LoadRoot(Heap::kuninitialized_symbolRootIndex)), |
| 2089 &miss); |
| 2090 TailCallStub(CodeFactory::StoreIC_Uninitialized(isolate(), language_mode), |
| 2091 p->context, p->receiver, p->name, p->value, p->slot, |
| 2092 p->vector); |
| 2093 } |
2082 Bind(&miss); | 2094 Bind(&miss); |
2083 { | 2095 { |
2084 TailCallRuntime(Runtime::kStoreIC_Miss, p->context, p->value, p->slot, | 2096 TailCallRuntime(Runtime::kStoreIC_Miss, p->context, p->value, p->slot, |
2085 p->vector, p->receiver, p->name); | 2097 p->vector, p->receiver, p->name); |
2086 } | 2098 } |
2087 } | 2099 } |
2088 | 2100 |
2089 void AccessorAssembler::KeyedStoreIC(const StoreICParameters* p, | 2101 void AccessorAssembler::KeyedStoreIC(const StoreICParameters* p, |
2090 LanguageMode language_mode) { | 2102 LanguageMode language_mode) { |
2091 Label miss(this, Label::kDeferred); | 2103 Label miss(this, Label::kDeferred); |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2369 typedef StoreWithVectorDescriptor Descriptor; | 2381 typedef StoreWithVectorDescriptor Descriptor; |
2370 | 2382 |
2371 Node* receiver = Parameter(Descriptor::kReceiver); | 2383 Node* receiver = Parameter(Descriptor::kReceiver); |
2372 Node* name = Parameter(Descriptor::kName); | 2384 Node* name = Parameter(Descriptor::kName); |
2373 Node* value = Parameter(Descriptor::kValue); | 2385 Node* value = Parameter(Descriptor::kValue); |
2374 Node* slot = Parameter(Descriptor::kSlot); | 2386 Node* slot = Parameter(Descriptor::kSlot); |
2375 Node* vector = Parameter(Descriptor::kVector); | 2387 Node* vector = Parameter(Descriptor::kVector); |
2376 Node* context = Parameter(Descriptor::kContext); | 2388 Node* context = Parameter(Descriptor::kContext); |
2377 | 2389 |
2378 StoreICParameters p(context, receiver, name, value, slot, vector); | 2390 StoreICParameters p(context, receiver, name, value, slot, vector); |
2379 // Current StoreIC dispatcher does not depend on the language mode. | 2391 StoreIC(&p, language_mode); |
2380 StoreIC(&p); | |
2381 } | 2392 } |
2382 | 2393 |
2383 void AccessorAssembler::GenerateStoreICTrampoline(LanguageMode language_mode) { | 2394 void AccessorAssembler::GenerateStoreICTrampoline(LanguageMode language_mode) { |
2384 typedef StoreDescriptor Descriptor; | 2395 typedef StoreDescriptor Descriptor; |
2385 | 2396 |
2386 Node* receiver = Parameter(Descriptor::kReceiver); | 2397 Node* receiver = Parameter(Descriptor::kReceiver); |
2387 Node* name = Parameter(Descriptor::kName); | 2398 Node* name = Parameter(Descriptor::kName); |
2388 Node* value = Parameter(Descriptor::kValue); | 2399 Node* value = Parameter(Descriptor::kValue); |
2389 Node* slot = Parameter(Descriptor::kSlot); | 2400 Node* slot = Parameter(Descriptor::kSlot); |
2390 Node* context = Parameter(Descriptor::kContext); | 2401 Node* context = Parameter(Descriptor::kContext); |
(...skipping 29 matching lines...) Expand all Loading... |
2420 Node* context = Parameter(Descriptor::kContext); | 2431 Node* context = Parameter(Descriptor::kContext); |
2421 Node* vector = LoadFeedbackVectorForStub(); | 2432 Node* vector = LoadFeedbackVectorForStub(); |
2422 | 2433 |
2423 Callable callable = | 2434 Callable callable = |
2424 CodeFactory::KeyedStoreICInOptimizedCode(isolate(), language_mode); | 2435 CodeFactory::KeyedStoreICInOptimizedCode(isolate(), language_mode); |
2425 TailCallStub(callable, context, receiver, name, value, slot, vector); | 2436 TailCallStub(callable, context, receiver, name, value, slot, vector); |
2426 } | 2437 } |
2427 | 2438 |
2428 } // namespace internal | 2439 } // namespace internal |
2429 } // namespace v8 | 2440 } // namespace v8 |
OLD | NEW |