OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/crankshaft/hydrogen.h" | 5 #include "src/crankshaft/hydrogen.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/allocation-site-scopes.h" | 9 #include "src/allocation-site-scopes.h" |
10 #include "src/ast/ast-numbering.h" | 10 #include "src/ast/ast-numbering.h" |
(...skipping 1257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1268 | 1268 |
1269 HValue* HGraphBuilder::BuildGetElementsKind(HValue* object) { | 1269 HValue* HGraphBuilder::BuildGetElementsKind(HValue* object) { |
1270 HValue* map = Add<HLoadNamedField>(object, nullptr, HObjectAccess::ForMap()); | 1270 HValue* map = Add<HLoadNamedField>(object, nullptr, HObjectAccess::ForMap()); |
1271 | 1271 |
1272 HValue* bit_field2 = | 1272 HValue* bit_field2 = |
1273 Add<HLoadNamedField>(map, nullptr, HObjectAccess::ForMapBitField2()); | 1273 Add<HLoadNamedField>(map, nullptr, HObjectAccess::ForMapBitField2()); |
1274 return BuildDecodeField<Map::ElementsKindBits>(bit_field2); | 1274 return BuildDecodeField<Map::ElementsKindBits>(bit_field2); |
1275 } | 1275 } |
1276 | 1276 |
1277 | 1277 |
| 1278 HValue* HGraphBuilder::BuildEnumLength(HValue* map) { |
| 1279 NoObservableSideEffectsScope scope(this); |
| 1280 HValue* bit_field3 = |
| 1281 Add<HLoadNamedField>(map, nullptr, HObjectAccess::ForMapBitField3()); |
| 1282 return BuildDecodeField<Map::EnumLengthBits>(bit_field3); |
| 1283 } |
| 1284 |
| 1285 |
1278 HValue* HGraphBuilder::BuildCheckHeapObject(HValue* obj) { | 1286 HValue* HGraphBuilder::BuildCheckHeapObject(HValue* obj) { |
1279 if (obj->type().IsHeapObject()) return obj; | 1287 if (obj->type().IsHeapObject()) return obj; |
1280 return Add<HCheckHeapObject>(obj); | 1288 return Add<HCheckHeapObject>(obj); |
1281 } | 1289 } |
1282 | 1290 |
1283 | 1291 |
1284 void HGraphBuilder::FinishExitWithHardDeoptimization( | 1292 void HGraphBuilder::FinishExitWithHardDeoptimization( |
1285 Deoptimizer::DeoptReason reason) { | 1293 Deoptimizer::DeoptReason reason) { |
1286 Add<HDeoptimize>(reason, Deoptimizer::EAGER); | 1294 Add<HDeoptimize>(reason, Deoptimizer::EAGER); |
1287 FinishExitCurrentBlock(New<HAbnormalExit>()); | 1295 FinishExitCurrentBlock(New<HAbnormalExit>()); |
(...skipping 4033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5321 Add<HSimulate>(stmt->ToObjectId()); | 5329 Add<HSimulate>(stmt->ToObjectId()); |
5322 if (fast) { | 5330 if (fast) { |
5323 map = Add<HForInPrepareMap>(enumerable); | 5331 map = Add<HForInPrepareMap>(enumerable); |
5324 Push(map); | 5332 Push(map); |
5325 Add<HSimulate>(stmt->EnumId()); | 5333 Add<HSimulate>(stmt->EnumId()); |
5326 Drop(1); | 5334 Drop(1); |
5327 Add<HCheckMaps>(map, meta_map); | 5335 Add<HCheckMaps>(map, meta_map); |
5328 | 5336 |
5329 array = Add<HForInCacheArray>(enumerable, map, | 5337 array = Add<HForInCacheArray>(enumerable, map, |
5330 DescriptorArray::kEnumCacheBridgeCacheIndex); | 5338 DescriptorArray::kEnumCacheBridgeCacheIndex); |
5331 enum_length = Add<HMapEnumLength>(map); | 5339 enum_length = BuildEnumLength(map); |
5332 | 5340 |
5333 HInstruction* index_cache = Add<HForInCacheArray>( | 5341 HInstruction* index_cache = Add<HForInCacheArray>( |
5334 enumerable, map, DescriptorArray::kEnumCacheBridgeIndicesCacheIndex); | 5342 enumerable, map, DescriptorArray::kEnumCacheBridgeIndicesCacheIndex); |
5335 HForInCacheArray::cast(array) | 5343 HForInCacheArray::cast(array) |
5336 ->set_index_cache(HForInCacheArray::cast(index_cache)); | 5344 ->set_index_cache(HForInCacheArray::cast(index_cache)); |
5337 } else { | 5345 } else { |
5338 Runtime::FunctionId function_id = Runtime::kGetPropertyNamesFast; | 5346 Runtime::FunctionId function_id = Runtime::kGetPropertyNamesFast; |
5339 Add<HPushArguments>(enumerable); | 5347 Add<HPushArguments>(enumerable); |
5340 array = Add<HCallRuntime>(Runtime::FunctionForId(function_id), 1); | 5348 array = Add<HCallRuntime>(Runtime::FunctionForId(function_id), 1); |
5341 Push(array); | 5349 Push(array); |
5342 Add<HSimulate>(stmt->EnumId()); | 5350 Add<HSimulate>(stmt->EnumId()); |
5343 Drop(1); | 5351 Drop(1); |
5344 { | 5352 { |
5345 NoObservableSideEffectsScope scope(this); | 5353 NoObservableSideEffectsScope scope(this); |
5346 IfBuilder if_fast(this); | 5354 IfBuilder if_fast(this); |
5347 if_fast.If<HCompareMap>(array, meta_map); | 5355 if_fast.If<HCompareMap>(array, meta_map); |
5348 if_fast.Then(); | 5356 if_fast.Then(); |
5349 { | 5357 { |
5350 HValue* cache_map = array; | 5358 HValue* cache_map = array; |
5351 HForInCacheArray* cache = Add<HForInCacheArray>( | 5359 HForInCacheArray* cache = Add<HForInCacheArray>( |
5352 enumerable, cache_map, DescriptorArray::kEnumCacheBridgeCacheIndex); | 5360 enumerable, cache_map, DescriptorArray::kEnumCacheBridgeCacheIndex); |
5353 enum_length = Add<HMapEnumLength>(cache_map); | 5361 enum_length = BuildEnumLength(cache_map); |
5354 Push(cache_map); | 5362 Push(cache_map); |
5355 Push(cache); | 5363 Push(cache); |
5356 Push(enum_length); | 5364 Push(enum_length); |
5357 } | 5365 } |
5358 if_fast.Else(); | 5366 if_fast.Else(); |
5359 { | 5367 { |
5360 Push(graph()->GetConstant1()); | 5368 Push(graph()->GetConstant1()); |
5361 Push(array); | 5369 Push(array); |
5362 Push(AddLoadFixedArrayLength(array)); | 5370 Push(AddLoadFixedArrayLength(array)); |
5363 } | 5371 } |
(...skipping 8244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13608 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13616 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13609 } | 13617 } |
13610 | 13618 |
13611 #ifdef DEBUG | 13619 #ifdef DEBUG |
13612 graph_->Verify(false); // No full verify. | 13620 graph_->Verify(false); // No full verify. |
13613 #endif | 13621 #endif |
13614 } | 13622 } |
13615 | 13623 |
13616 } // namespace internal | 13624 } // namespace internal |
13617 } // namespace v8 | 13625 } // namespace v8 |
OLD | NEW |