Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(160)

Unified Diff: src/crankshaft/hydrogen.cc

Issue 1630523002: [turbofan] Switch JSForInPrepare to %ForInPrepare style. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/typer.cc ('k') | src/full-codegen/arm/full-codegen-arm.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/crankshaft/hydrogen.cc
diff --git a/src/crankshaft/hydrogen.cc b/src/crankshaft/hydrogen.cc
index 090223606c575940bfbbdc70c66dc3cd32d9c110..d2ba73c1da65549651b0544019a1ff7c2463824c 100644
--- a/src/crankshaft/hydrogen.cc
+++ b/src/crankshaft/hydrogen.cc
@@ -5315,69 +5315,62 @@ void HOptimizedGraphBuilder::VisitForInStatement(ForInStatement* stmt) {
void HOptimizedGraphBuilder::BuildForInBody(ForInStatement* stmt,
Variable* each_var,
HValue* enumerable) {
- HValue* map;
- HValue* array;
- HValue* enum_length;
Handle<Map> meta_map = isolate()->factory()->meta_map();
bool fast = stmt->for_in_type() == ForInStatement::FAST_FOR_IN;
BuildCheckHeapObject(enumerable);
Add<HCheckInstanceType>(enumerable, HCheckInstanceType::IS_JS_RECEIVER);
Add<HSimulate>(stmt->ToObjectId());
if (fast) {
- map = Add<HForInPrepareMap>(enumerable);
+ HForInPrepareMap* map = Add<HForInPrepareMap>(enumerable);
Push(map);
Add<HSimulate>(stmt->EnumId());
Drop(1);
Add<HCheckMaps>(map, meta_map);
- array = Add<HForInCacheArray>(enumerable, map,
- DescriptorArray::kEnumCacheBridgeCacheIndex);
- enum_length = BuildEnumLength(map);
+ HForInCacheArray* array = Add<HForInCacheArray>(
+ enumerable, map, DescriptorArray::kEnumCacheBridgeCacheIndex);
+ HValue* enum_length = BuildEnumLength(map);
- HInstruction* index_cache = Add<HForInCacheArray>(
+ HForInCacheArray* index_cache = Add<HForInCacheArray>(
enumerable, map, DescriptorArray::kEnumCacheBridgeIndicesCacheIndex);
- HForInCacheArray::cast(array)
- ->set_index_cache(HForInCacheArray::cast(index_cache));
+ array->set_index_cache(index_cache);
+
+ Push(map);
+ Push(array);
+ Push(enum_length);
+ Add<HSimulate>(stmt->PrepareId());
} else {
Runtime::FunctionId function_id = Runtime::kGetPropertyNamesFast;
Add<HPushArguments>(enumerable);
- array = Add<HCallRuntime>(Runtime::FunctionForId(function_id), 1);
+ HCallRuntime* array =
+ Add<HCallRuntime>(Runtime::FunctionForId(function_id), 1);
Push(array);
Add<HSimulate>(stmt->EnumId());
Drop(1);
+
+ IfBuilder if_fast(this);
+ if_fast.If<HCompareMap>(array, meta_map);
+ if_fast.Then();
{
- NoObservableSideEffectsScope scope(this);
- IfBuilder if_fast(this);
- if_fast.If<HCompareMap>(array, meta_map);
- if_fast.Then();
- {
- HValue* cache_map = array;
- HForInCacheArray* cache = Add<HForInCacheArray>(
- enumerable, cache_map, DescriptorArray::kEnumCacheBridgeCacheIndex);
- enum_length = BuildEnumLength(cache_map);
- Push(cache_map);
- Push(cache);
- Push(enum_length);
- }
- if_fast.Else();
- {
- Push(graph()->GetConstant1());
- Push(array);
- Push(AddLoadFixedArrayLength(array));
- }
- if_fast.End();
- enum_length = Pop();
- array = Pop();
- map = Pop();
+ HValue* cache_map = array;
+ HForInCacheArray* cache = Add<HForInCacheArray>(
+ enumerable, cache_map, DescriptorArray::kEnumCacheBridgeCacheIndex);
+ HValue* enum_length = BuildEnumLength(cache_map);
+ Push(cache_map);
+ Push(cache);
+ Push(enum_length);
+ Add<HSimulate>(stmt->PrepareId(), FIXED_SIMULATE);
+ }
+ if_fast.Else();
+ {
+ Push(graph()->GetConstant1());
+ Push(array);
+ Push(AddLoadFixedArrayLength(array));
+ Add<HSimulate>(stmt->PrepareId(), FIXED_SIMULATE);
}
}
- HInstruction* start_index = Add<HConstant>(0);
-
- Push(map);
- Push(array);
- Push(enum_length);
- Push(start_index);
+ Push(graph()->GetConstant0());
HBasicBlock* loop_entry = BuildLoopEntry(stmt);
« no previous file with comments | « src/compiler/typer.cc ('k') | src/full-codegen/arm/full-codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698