| 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 5296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5307 BuildForInBody(stmt, each_var, enumerable); | 5307 BuildForInBody(stmt, each_var, enumerable); |
| 5308 } | 5308 } |
| 5309 | 5309 |
| 5310 | 5310 |
| 5311 void HOptimizedGraphBuilder::BuildForInBody(ForInStatement* stmt, | 5311 void HOptimizedGraphBuilder::BuildForInBody(ForInStatement* stmt, |
| 5312 Variable* each_var, | 5312 Variable* each_var, |
| 5313 HValue* enumerable) { | 5313 HValue* enumerable) { |
| 5314 HInstruction* map; | 5314 HInstruction* map; |
| 5315 HInstruction* array; | 5315 HInstruction* array; |
| 5316 HInstruction* enum_length; | 5316 HInstruction* enum_length; |
| 5317 BuildCheckHeapObject(enumerable); |
| 5318 Add<HCheckInstanceType>(enumerable, HCheckInstanceType::IS_JS_RECEIVER); |
| 5319 Add<HSimulate>(stmt->ToObjectId()); |
| 5317 bool fast = stmt->for_in_type() == ForInStatement::FAST_FOR_IN; | 5320 bool fast = stmt->for_in_type() == ForInStatement::FAST_FOR_IN; |
| 5318 if (fast) { | 5321 if (fast) { |
| 5319 map = Add<HForInPrepareMap>(enumerable); | 5322 map = Add<HForInPrepareMap>(enumerable); |
| 5320 Add<HSimulate>(stmt->PrepareId()); | 5323 Push(map); |
| 5324 Add<HSimulate>(stmt->EnumId()); |
| 5325 Drop(1); |
| 5326 Handle<Map> meta_map = isolate()->factory()->meta_map(); |
| 5327 Add<HCheckMaps>(map, meta_map); |
| 5321 | 5328 |
| 5322 array = Add<HForInCacheArray>(enumerable, map, | 5329 array = Add<HForInCacheArray>(enumerable, map, |
| 5323 DescriptorArray::kEnumCacheBridgeCacheIndex); | 5330 DescriptorArray::kEnumCacheBridgeCacheIndex); |
| 5324 enum_length = Add<HMapEnumLength>(map); | 5331 enum_length = Add<HMapEnumLength>(map); |
| 5325 | 5332 |
| 5326 HInstruction* index_cache = Add<HForInCacheArray>( | 5333 HInstruction* index_cache = Add<HForInCacheArray>( |
| 5327 enumerable, map, DescriptorArray::kEnumCacheBridgeIndicesCacheIndex); | 5334 enumerable, map, DescriptorArray::kEnumCacheBridgeIndicesCacheIndex); |
| 5328 HForInCacheArray::cast(array) | 5335 HForInCacheArray::cast(array) |
| 5329 ->set_index_cache(HForInCacheArray::cast(index_cache)); | 5336 ->set_index_cache(HForInCacheArray::cast(index_cache)); |
| 5330 } else { | 5337 } else { |
| 5331 Add<HSimulate>(stmt->PrepareId()); | |
| 5332 { | |
| 5333 NoObservableSideEffectsScope no_effects(this); | |
| 5334 BuildJSObjectCheck(enumerable, 0); | |
| 5335 } | |
| 5336 Add<HSimulate>(stmt->ToObjectId()); | |
| 5337 | |
| 5338 map = graph()->GetConstant1(); | 5338 map = graph()->GetConstant1(); |
| 5339 Runtime::FunctionId function_id = Runtime::kGetPropertyNamesFast; | 5339 Runtime::FunctionId function_id = Runtime::kGetPropertyNamesFast; |
| 5340 Add<HPushArguments>(enumerable); | 5340 Add<HPushArguments>(enumerable); |
| 5341 array = Add<HCallRuntime>(Runtime::FunctionForId(function_id), 1); | 5341 array = Add<HCallRuntime>(Runtime::FunctionForId(function_id), 1); |
| 5342 Push(array); | 5342 Push(array); |
| 5343 Add<HSimulate>(stmt->EnumId()); | 5343 Add<HSimulate>(stmt->EnumId()); |
| 5344 Drop(1); | 5344 Drop(1); |
| 5345 Handle<Map> array_map = isolate()->factory()->fixed_array_map(); | 5345 Handle<Map> array_map = isolate()->factory()->fixed_array_map(); |
| 5346 HValue* check = Add<HCheckMaps>(array, array_map); | 5346 HValue* check = Add<HCheckMaps>(array, array_map); |
| 5347 enum_length = AddLoadFixedArrayLength(array, check); | 5347 enum_length = AddLoadFixedArrayLength(array, check); |
| (...skipping 8239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13587 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13587 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 13588 } | 13588 } |
| 13589 | 13589 |
| 13590 #ifdef DEBUG | 13590 #ifdef DEBUG |
| 13591 graph_->Verify(false); // No full verify. | 13591 graph_->Verify(false); // No full verify. |
| 13592 #endif | 13592 #endif |
| 13593 } | 13593 } |
| 13594 | 13594 |
| 13595 } // namespace internal | 13595 } // namespace internal |
| 13596 } // namespace v8 | 13596 } // namespace v8 |
| OLD | NEW |