Chromium Code Reviews| 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/code-stub-assembler.h" | 5 #include "src/code-stub-assembler.h" |
| 6 #include "src/code-factory.h" | 6 #include "src/code-factory.h" |
| 7 #include "src/frames-inl.h" | 7 #include "src/frames-inl.h" |
| 8 #include "src/frames.h" | 8 #include "src/frames.h" |
| 9 #include "src/ic/stub-cache.h" | 9 #include "src/ic/stub-cache.h" |
| 10 | 10 |
| (...skipping 1480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1491 void CodeStubAssembler::DecrementCounter(StatsCounter* counter, int delta) { | 1491 void CodeStubAssembler::DecrementCounter(StatsCounter* counter, int delta) { |
| 1492 DCHECK(delta > 0); | 1492 DCHECK(delta > 0); |
| 1493 if (FLAG_native_code_counters && counter->Enabled()) { | 1493 if (FLAG_native_code_counters && counter->Enabled()) { |
| 1494 Node* counter_address = ExternalConstant(ExternalReference(counter)); | 1494 Node* counter_address = ExternalConstant(ExternalReference(counter)); |
| 1495 Node* value = Load(MachineType::Int32(), counter_address); | 1495 Node* value = Load(MachineType::Int32(), counter_address); |
| 1496 value = Int32Sub(value, Int32Constant(delta)); | 1496 value = Int32Sub(value, Int32Constant(delta)); |
| 1497 StoreNoWriteBarrier(MachineRepresentation::kWord32, counter_address, value); | 1497 StoreNoWriteBarrier(MachineRepresentation::kWord32, counter_address, value); |
| 1498 } | 1498 } |
| 1499 } | 1499 } |
| 1500 | 1500 |
| 1501 void CodeStubAssembler::Use(Label* label) { | |
| 1502 GotoIf(Word32Equal(Int32Constant(0), Int32Constant(1)), label); | |
| 1503 } | |
| 1504 | |
| 1501 void CodeStubAssembler::TryToName(Node* key, Label* if_keyisindex, | 1505 void CodeStubAssembler::TryToName(Node* key, Label* if_keyisindex, |
| 1502 Variable* var_index, Label* if_keyisunique, | 1506 Variable* var_index, Label* if_keyisunique, |
| 1503 Label* if_bailout) { | 1507 Label* if_bailout) { |
| 1504 DCHECK_EQ(MachineRepresentation::kWord32, var_index->rep()); | 1508 DCHECK_EQ(MachineRepresentation::kWord32, var_index->rep()); |
| 1505 Comment("TryToName"); | 1509 Comment("TryToName"); |
| 1506 | 1510 |
| 1507 Label if_keyissmi(this), if_keyisnotsmi(this); | 1511 Label if_keyissmi(this), if_keyisnotsmi(this); |
| 1508 Branch(WordIsSmi(key), &if_keyissmi, &if_keyisnotsmi); | 1512 Branch(WordIsSmi(key), &if_keyissmi, &if_keyisnotsmi); |
| 1509 Bind(&if_keyissmi); | 1513 Bind(&if_keyissmi); |
| 1510 { | 1514 { |
| (...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2149 Goto(&if_isdictionary); | 2153 Goto(&if_isdictionary); |
| 2150 } | 2154 } |
| 2151 } | 2155 } |
| 2152 | 2156 |
| 2153 // Instantiate template methods to workaround GCC compilation issue. | 2157 // Instantiate template methods to workaround GCC compilation issue. |
| 2154 template void CodeStubAssembler::NumberDictionaryLookup<SeededNumberDictionary>( | 2158 template void CodeStubAssembler::NumberDictionaryLookup<SeededNumberDictionary>( |
| 2155 Node*, Node*, Label*, Variable*, Label*); | 2159 Node*, Node*, Label*, Variable*, Label*); |
| 2156 template void CodeStubAssembler::NumberDictionaryLookup< | 2160 template void CodeStubAssembler::NumberDictionaryLookup< |
| 2157 UnseededNumberDictionary>(Node*, Node*, Label*, Variable*, Label*); | 2161 UnseededNumberDictionary>(Node*, Node*, Label*, Variable*, Label*); |
| 2158 | 2162 |
| 2163 void CodeStubAssembler::TryPrototypeChainLookup( | |
| 2164 Node* receiver, Node* key, LookupInHolder& lookup_property_in_holder, | |
| 2165 LookupInHolder& lookup_element_in_holder, Label* if_end, | |
| 2166 Label* if_bailout) { | |
| 2167 // Ensure receiver is JSReceiver, otherwise bailout. | |
| 2168 Label if_objectisnotsmi(this); | |
| 2169 Branch(WordIsSmi(receiver), if_bailout, &if_objectisnotsmi); | |
| 2170 Bind(&if_objectisnotsmi); | |
| 2171 | |
| 2172 Node* map = LoadMap(receiver); | |
| 2173 Node* instance_type = LoadMapInstanceType(map); | |
| 2174 { | |
| 2175 Label if_objectisreceiver(this); | |
| 2176 STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE); | |
| 2177 Branch(Int32GreaterThanOrEqual(instance_type, | |
| 2178 Int32Constant(FIRST_JS_RECEIVER_TYPE)), | |
|
Toon Verwaest
2016/06/23 12:48:22
LAST_SPECIAL_RECEIVER_TYPE or the other including
Igor Sheludko
2016/06/28 08:09:07
The existing own property/element lookups already
| |
| 2179 &if_objectisreceiver, if_bailout); | |
| 2180 Bind(&if_objectisreceiver); | |
| 2181 } | |
| 2182 | |
| 2183 Variable var_index(this, MachineRepresentation::kWord32); | |
| 2184 | |
| 2185 Label if_keyisindex(this), if_iskeyunique(this); | |
| 2186 TryToName(key, &if_keyisindex, &var_index, &if_iskeyunique, if_bailout); | |
| 2187 | |
| 2188 Bind(&if_iskeyunique); | |
| 2189 { | |
| 2190 Variable var_holder(this, MachineRepresentation::kTagged); | |
| 2191 Variable var_holder_map(this, MachineRepresentation::kTagged); | |
| 2192 Variable var_holder_instance_type(this, MachineRepresentation::kWord8); | |
| 2193 | |
| 2194 Variable* merged_variables[] = {&var_holder, &var_holder_map, | |
| 2195 &var_holder_instance_type}; | |
| 2196 Label loop(this, arraysize(merged_variables), merged_variables); | |
| 2197 var_holder.Bind(receiver); | |
| 2198 var_holder_map.Bind(map); | |
| 2199 var_holder_instance_type.Bind(instance_type); | |
| 2200 Goto(&loop); | |
| 2201 Bind(&loop); | |
| 2202 { | |
| 2203 Node* holder_map = var_holder_map.value(); | |
| 2204 Node* holder_instance_type = var_holder_instance_type.value(); | |
| 2205 | |
| 2206 Label next_proto(this); | |
| 2207 lookup_property_in_holder(receiver, var_holder.value(), holder_map, | |
| 2208 holder_instance_type, key, &next_proto, | |
| 2209 if_bailout); | |
| 2210 Bind(&next_proto); | |
| 2211 | |
| 2212 // Bailout if it can be an integer indexed exotic case. | |
| 2213 GotoIf( | |
| 2214 Word32Equal(holder_instance_type, Int32Constant(JS_TYPED_ARRAY_TYPE)), | |
| 2215 if_bailout); | |
| 2216 | |
| 2217 Node* proto = LoadMapPrototype(holder_map); | |
| 2218 | |
| 2219 Label if_not_null(this); | |
| 2220 Branch(WordEqual(proto, NullConstant()), if_end, &if_not_null); | |
| 2221 Bind(&if_not_null); | |
| 2222 | |
| 2223 Node* map = LoadMap(proto); | |
| 2224 Node* instance_type = LoadMapInstanceType(map); | |
| 2225 | |
| 2226 var_holder.Bind(proto); | |
| 2227 var_holder_map.Bind(map); | |
| 2228 var_holder_instance_type.Bind(instance_type); | |
| 2229 Goto(&loop); | |
| 2230 } | |
| 2231 } | |
| 2232 Bind(&if_keyisindex); | |
| 2233 { | |
| 2234 Variable var_holder(this, MachineRepresentation::kTagged); | |
| 2235 Variable var_holder_map(this, MachineRepresentation::kTagged); | |
| 2236 Variable var_holder_instance_type(this, MachineRepresentation::kWord8); | |
| 2237 | |
| 2238 Variable* merged_variables[] = {&var_holder, &var_holder_map, | |
| 2239 &var_holder_instance_type}; | |
| 2240 Label loop(this, arraysize(merged_variables), merged_variables); | |
| 2241 var_holder.Bind(receiver); | |
| 2242 var_holder_map.Bind(map); | |
| 2243 var_holder_instance_type.Bind(instance_type); | |
| 2244 Goto(&loop); | |
| 2245 Bind(&loop); | |
| 2246 { | |
| 2247 Label next_proto(this); | |
| 2248 lookup_element_in_holder(receiver, var_holder.value(), | |
| 2249 var_holder_map.value(), | |
| 2250 var_holder_instance_type.value(), | |
| 2251 var_index.value(), &next_proto, if_bailout); | |
| 2252 Bind(&next_proto); | |
| 2253 | |
| 2254 Node* proto = LoadMapPrototype(var_holder_map.value()); | |
| 2255 | |
| 2256 Label if_not_null(this); | |
| 2257 Branch(WordEqual(proto, NullConstant()), if_end, &if_not_null); | |
| 2258 Bind(&if_not_null); | |
| 2259 | |
| 2260 Node* map = LoadMap(proto); | |
| 2261 Node* instance_type = LoadMapInstanceType(map); | |
| 2262 | |
| 2263 var_holder.Bind(proto); | |
| 2264 var_holder_map.Bind(map); | |
| 2265 var_holder_instance_type.Bind(instance_type); | |
| 2266 Goto(&loop); | |
| 2267 } | |
| 2268 } | |
| 2269 } | |
| 2270 | |
| 2159 Node* CodeStubAssembler::OrdinaryHasInstance(Node* context, Node* callable, | 2271 Node* CodeStubAssembler::OrdinaryHasInstance(Node* context, Node* callable, |
| 2160 Node* object) { | 2272 Node* object) { |
| 2161 Variable var_result(this, MachineRepresentation::kTagged); | 2273 Variable var_result(this, MachineRepresentation::kTagged); |
| 2162 Label return_false(this), return_true(this), | 2274 Label return_false(this), return_true(this), |
| 2163 return_runtime(this, Label::kDeferred), return_result(this); | 2275 return_runtime(this, Label::kDeferred), return_result(this); |
| 2164 | 2276 |
| 2165 // Goto runtime if {object} is a Smi. | 2277 // Goto runtime if {object} is a Smi. |
| 2166 GotoIf(WordIsSmi(object), &return_runtime); | 2278 GotoIf(WordIsSmi(object), &return_runtime); |
| 2167 | 2279 |
| 2168 // Load map of {object}. | 2280 // Load map of {object}. |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2648 } | 2760 } |
| 2649 Bind(&miss); | 2761 Bind(&miss); |
| 2650 { | 2762 { |
| 2651 TailCallRuntime(Runtime::kLoadGlobalIC_Miss, p->context, p->name, p->slot, | 2763 TailCallRuntime(Runtime::kLoadGlobalIC_Miss, p->context, p->name, p->slot, |
| 2652 p->vector); | 2764 p->vector); |
| 2653 } | 2765 } |
| 2654 } | 2766 } |
| 2655 | 2767 |
| 2656 } // namespace internal | 2768 } // namespace internal |
| 2657 } // namespace v8 | 2769 } // namespace v8 |
| OLD | NEW |