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

Side by Side Diff: src/crankshaft/hydrogen.cc

Issue 1611933003: [crankshaft] Remove for-in slow mode deopt loop. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@ForIn
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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 5293 matching lines...) Expand 10 before | Expand all | Expand 10 after
5304 enumerable, graph()->GetConstantNull()); 5304 enumerable, graph()->GetConstantNull());
5305 if_undefined_or_null.ThenDeopt(Deoptimizer::kUndefinedOrNullInForIn); 5305 if_undefined_or_null.ThenDeopt(Deoptimizer::kUndefinedOrNullInForIn);
5306 if_undefined_or_null.End(); 5306 if_undefined_or_null.End();
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 HValue* map;
5315 HInstruction* array; 5315 HValue* array;
5316 HInstruction* enum_length; 5316 HValue* enum_length;
5317 Handle<Map> meta_map = isolate()->factory()->meta_map();
5318 bool fast = stmt->for_in_type() == ForInStatement::FAST_FOR_IN;
5317 BuildCheckHeapObject(enumerable); 5319 BuildCheckHeapObject(enumerable);
5318 Add<HCheckInstanceType>(enumerable, HCheckInstanceType::IS_JS_RECEIVER); 5320 Add<HCheckInstanceType>(enumerable, HCheckInstanceType::IS_JS_RECEIVER);
5319 Add<HSimulate>(stmt->ToObjectId()); 5321 Add<HSimulate>(stmt->ToObjectId());
5320 bool fast = stmt->for_in_type() == ForInStatement::FAST_FOR_IN;
5321 if (fast) { 5322 if (fast) {
5322 map = Add<HForInPrepareMap>(enumerable); 5323 map = Add<HForInPrepareMap>(enumerable);
5323 Push(map); 5324 Push(map);
5324 Add<HSimulate>(stmt->EnumId()); 5325 Add<HSimulate>(stmt->EnumId());
5325 Drop(1); 5326 Drop(1);
5326 Handle<Map> meta_map = isolate()->factory()->meta_map();
5327 Add<HCheckMaps>(map, meta_map); 5327 Add<HCheckMaps>(map, meta_map);
5328 5328
5329 array = Add<HForInCacheArray>(enumerable, map, 5329 array = Add<HForInCacheArray>(enumerable, map,
5330 DescriptorArray::kEnumCacheBridgeCacheIndex); 5330 DescriptorArray::kEnumCacheBridgeCacheIndex);
5331 enum_length = Add<HMapEnumLength>(map); 5331 enum_length = Add<HMapEnumLength>(map);
5332 5332
5333 HInstruction* index_cache = Add<HForInCacheArray>( 5333 HInstruction* index_cache = Add<HForInCacheArray>(
5334 enumerable, map, DescriptorArray::kEnumCacheBridgeIndicesCacheIndex); 5334 enumerable, map, DescriptorArray::kEnumCacheBridgeIndicesCacheIndex);
5335 HForInCacheArray::cast(array) 5335 HForInCacheArray::cast(array)
5336 ->set_index_cache(HForInCacheArray::cast(index_cache)); 5336 ->set_index_cache(HForInCacheArray::cast(index_cache));
5337 } else { 5337 } else {
5338 map = graph()->GetConstant1();
5339 Runtime::FunctionId function_id = Runtime::kGetPropertyNamesFast; 5338 Runtime::FunctionId function_id = Runtime::kGetPropertyNamesFast;
5340 Add<HPushArguments>(enumerable); 5339 Add<HPushArguments>(enumerable);
5341 array = Add<HCallRuntime>(Runtime::FunctionForId(function_id), 1); 5340 array = Add<HCallRuntime>(Runtime::FunctionForId(function_id), 1);
5342 Push(array); 5341 Push(array);
5343 Add<HSimulate>(stmt->EnumId()); 5342 Add<HSimulate>(stmt->EnumId());
5344 Drop(1); 5343 Drop(1);
5345 Handle<Map> array_map = isolate()->factory()->fixed_array_map(); 5344 {
5346 HValue* check = Add<HCheckMaps>(array, array_map); 5345 NoObservableSideEffectsScope scope(this);
5347 enum_length = AddLoadFixedArrayLength(array, check); 5346 IfBuilder if_fast(this);
5347 if_fast.If<HCompareMap>(array, meta_map);
5348 if_fast.Then();
5349 {
5350 HValue* cache_map = array;
5351 HForInCacheArray* cache = Add<HForInCacheArray>(
5352 enumerable, cache_map, DescriptorArray::kEnumCacheBridgeCacheIndex);
5353 enum_length = Add<HMapEnumLength>(cache_map);
5354 Push(cache_map);
Jakob Kummerow 2016/01/28 21:34:38 Pushing the map here has no effect, as we're in th
5355 Push(cache);
5356 Push(enum_length);
5357 }
5358 if_fast.Else();
5359 {
5360 Push(graph()->GetConstant1());
5361 Push(array);
5362 Push(AddLoadFixedArrayLength(array));
5363 }
5364 if_fast.End();
5365 enum_length = Pop();
5366 array = Pop();
5367 map = Pop();
5368 }
5348 } 5369 }
5349 5370
5350 HInstruction* start_index = Add<HConstant>(0); 5371 HInstruction* start_index = Add<HConstant>(0);
5351 5372
5352 Push(map); 5373 Push(map);
5353 Push(array); 5374 Push(array);
5354 Push(enum_length); 5375 Push(enum_length);
5355 Push(start_index); 5376 Push(start_index);
5356 5377
5357 HBasicBlock* loop_entry = BuildLoopEntry(stmt); 5378 HBasicBlock* loop_entry = BuildLoopEntry(stmt);
(...skipping 8229 matching lines...) Expand 10 before | Expand all | Expand 10 after
13587 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 13608 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
13588 } 13609 }
13589 13610
13590 #ifdef DEBUG 13611 #ifdef DEBUG
13591 graph_->Verify(false); // No full verify. 13612 graph_->Verify(false); // No full verify.
13592 #endif 13613 #endif
13593 } 13614 }
13594 13615
13595 } // namespace internal 13616 } // namespace internal
13596 } // namespace v8 13617 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698