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

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

Issue 1977473002: [compiler] Move list of inlined functions to Crankshaft. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@local_cleanup-compiler-sidechannel-3
Patch Set: Fix tha leeeek. Created 4 years, 7 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 | « src/crankshaft/hydrogen.h ('k') | 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 1354 matching lines...) Expand 10 before | Expand all | Expand 10 after
1365 set_current_block(graph()->entry_block()); 1365 set_current_block(graph()->entry_block());
1366 if (!BuildGraph()) return NULL; 1366 if (!BuildGraph()) return NULL;
1367 graph()->FinalizeUniqueness(); 1367 graph()->FinalizeUniqueness();
1368 return graph_; 1368 return graph_;
1369 } 1369 }
1370 1370
1371 int HGraphBuilder::TraceInlinedFunction(Handle<SharedFunctionInfo> shared, 1371 int HGraphBuilder::TraceInlinedFunction(Handle<SharedFunctionInfo> shared,
1372 SourcePosition position) { 1372 SourcePosition position) {
1373 DCHECK(info_->is_tracking_positions()); 1373 DCHECK(info_->is_tracking_positions());
1374 1374
1375 int inline_id = static_cast<int>(info_->inlined_function_infos().size()); 1375 int inline_id = static_cast<int>(graph()->inlined_function_infos().size());
1376 InlinedFunctionInfo info(shared->start_position()); 1376 HInlinedFunctionInfo info(shared->start_position());
1377 if (!shared->script()->IsUndefined()) { 1377 if (!shared->script()->IsUndefined()) {
1378 Handle<Script> script(Script::cast(shared->script())); 1378 Handle<Script> script(Script::cast(shared->script()));
1379 1379
1380 if (FLAG_hydrogen_track_positions && !script->source()->IsUndefined()) { 1380 if (FLAG_hydrogen_track_positions && !script->source()->IsUndefined()) {
1381 CodeTracer::Scope tracing_scope(isolate()->GetCodeTracer()); 1381 CodeTracer::Scope tracing_scope(isolate()->GetCodeTracer());
1382 Object* source_name = script->name(); 1382 Object* source_name = script->name();
1383 OFStream os(tracing_scope.file()); 1383 OFStream os(tracing_scope.file());
1384 os << "--- FUNCTION SOURCE ("; 1384 os << "--- FUNCTION SOURCE (";
1385 if (source_name->IsString()) { 1385 if (source_name->IsString()) {
1386 os << String::cast(source_name)->ToCString().get() << ":"; 1386 os << String::cast(source_name)->ToCString().get() << ":";
1387 } 1387 }
1388 os << shared->DebugName()->ToCString().get() << ") id{"; 1388 os << shared->DebugName()->ToCString().get() << ") id{";
1389 os << info_->optimization_id() << "," << inline_id << "} ---\n"; 1389 os << info_->optimization_id() << "," << inline_id << "} ---\n";
1390 { 1390 {
1391 DisallowHeapAllocation no_allocation; 1391 DisallowHeapAllocation no_allocation;
1392 int start = shared->start_position(); 1392 int start = shared->start_position();
1393 int len = shared->end_position() - start; 1393 int len = shared->end_position() - start;
1394 String::SubStringRange source(String::cast(script->source()), start, 1394 String::SubStringRange source(String::cast(script->source()), start,
1395 len); 1395 len);
1396 for (const auto& c : source) { 1396 for (const auto& c : source) {
1397 os << AsReversiblyEscapedUC16(c); 1397 os << AsReversiblyEscapedUC16(c);
1398 } 1398 }
1399 } 1399 }
1400 1400
1401 os << "\n--- END ---\n"; 1401 os << "\n--- END ---\n";
1402 } 1402 }
1403 } 1403 }
1404 1404
1405 info_->inlined_function_infos().push_back(info); 1405 graph()->inlined_function_infos().push_back(info);
1406 1406
1407 if (FLAG_hydrogen_track_positions && inline_id != 0) { 1407 if (FLAG_hydrogen_track_positions && inline_id != 0) {
1408 CodeTracer::Scope tracing_scope(isolate()->GetCodeTracer()); 1408 CodeTracer::Scope tracing_scope(isolate()->GetCodeTracer());
1409 OFStream os(tracing_scope.file()); 1409 OFStream os(tracing_scope.file());
1410 os << "INLINE (" << shared->DebugName()->ToCString().get() << ") id{" 1410 os << "INLINE (" << shared->DebugName()->ToCString().get() << ") id{"
1411 << info_->optimization_id() << "," << inline_id << "} AS " << inline_id 1411 << info_->optimization_id() << "," << inline_id << "} AS " << inline_id
1412 << " AT " << position << std::endl; 1412 << " AT " << position << std::endl;
1413 } 1413 }
1414 1414
1415 return inline_id; 1415 return inline_id;
(...skipping 2367 matching lines...) Expand 10 before | Expand all | Expand 10 after
3783 osr_(NULL), 3783 osr_(NULL),
3784 info_(info), 3784 info_(info),
3785 descriptor_(descriptor), 3785 descriptor_(descriptor),
3786 zone_(info->zone()), 3786 zone_(info->zone()),
3787 allow_code_motion_(false), 3787 allow_code_motion_(false),
3788 use_optimistic_licm_(false), 3788 use_optimistic_licm_(false),
3789 depends_on_empty_array_proto_elements_(false), 3789 depends_on_empty_array_proto_elements_(false),
3790 type_change_checksum_(0), 3790 type_change_checksum_(0),
3791 maximum_environment_size_(0), 3791 maximum_environment_size_(0),
3792 no_side_effects_scope_count_(0), 3792 no_side_effects_scope_count_(0),
3793 disallow_adding_new_values_(false) { 3793 disallow_adding_new_values_(false),
3794 inlined_function_infos_(info->zone()) {
3794 if (info->IsStub()) { 3795 if (info->IsStub()) {
3795 // For stubs, explicitly add the context to the environment. 3796 // For stubs, explicitly add the context to the environment.
3796 start_environment_ = new (zone_) 3797 start_environment_ = new (zone_)
3797 HEnvironment(zone_, descriptor.GetRegisterParameterCount() + 1); 3798 HEnvironment(zone_, descriptor.GetRegisterParameterCount() + 1);
3798 } else { 3799 } else {
3799 start_environment_ = 3800 start_environment_ =
3800 new(zone_) HEnvironment(NULL, info->scope(), info->closure(), zone_); 3801 new(zone_) HEnvironment(NULL, info->scope(), info->closure(), zone_);
3801 } 3802 }
3802 start_environment_->set_ast_id(BailoutId::FunctionContext()); 3803 start_environment_->set_ast_id(BailoutId::FunctionContext());
3803 entry_block_ = CreateBasicBlock(); 3804 entry_block_ = CreateBasicBlock();
(...skipping 13 matching lines...) Expand all
3817 for (int i = 0; i < blocks()->length(); ++i) { 3818 for (int i = 0; i < blocks()->length(); ++i) {
3818 for (HInstructionIterator it(blocks()->at(i)); !it.Done(); it.Advance()) { 3819 for (HInstructionIterator it(blocks()->at(i)); !it.Done(); it.Advance()) {
3819 it.Current()->FinalizeUniqueness(); 3820 it.Current()->FinalizeUniqueness();
3820 } 3821 }
3821 } 3822 }
3822 } 3823 }
3823 3824
3824 3825
3825 int HGraph::SourcePositionToScriptPosition(SourcePosition pos) { 3826 int HGraph::SourcePositionToScriptPosition(SourcePosition pos) {
3826 return (FLAG_hydrogen_track_positions && !pos.IsUnknown()) 3827 return (FLAG_hydrogen_track_positions && !pos.IsUnknown())
3827 ? info()->inlined_function_infos() 3828 ? inlined_function_infos_.at(pos.inlining_id()).start_position +
3828 .at(pos.inlining_id())
3829 .start_position +
3830 pos.position() 3829 pos.position()
3831 : pos.raw(); 3830 : pos.raw();
3832 } 3831 }
3833 3832
3834 3833
3835 // Block ordering was implemented with two mutually recursive methods, 3834 // Block ordering was implemented with two mutually recursive methods,
3836 // HGraph::Postorder and HGraph::PostorderLoopBlocks. 3835 // HGraph::Postorder and HGraph::PostorderLoopBlocks.
3837 // The recursion could lead to stack overflow so the algorithm has been 3836 // The recursion could lead to stack overflow so the algorithm has been
3838 // implemented iteratively. 3837 // implemented iteratively.
3839 // At a high level the algorithm looks like this: 3838 // At a high level the algorithm looks like this:
(...skipping 9900 matching lines...) Expand 10 before | Expand all | Expand 10 after
13740 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 13739 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
13741 } 13740 }
13742 13741
13743 #ifdef DEBUG 13742 #ifdef DEBUG
13744 graph_->Verify(false); // No full verify. 13743 graph_->Verify(false); // No full verify.
13745 #endif 13744 #endif
13746 } 13745 }
13747 13746
13748 } // namespace internal 13747 } // namespace internal
13749 } // namespace v8 13748 } // namespace v8
OLDNEW
« no previous file with comments | « src/crankshaft/hydrogen.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698