| Index: src/crankshaft/hydrogen.cc
|
| diff --git a/src/crankshaft/hydrogen.cc b/src/crankshaft/hydrogen.cc
|
| index 16c3639a3d33dbaebaecfa71aeb90bbc11242ff2..0855ba866f60c59f7e19b0b20f46f334aeb7af46 100644
|
| --- a/src/crankshaft/hydrogen.cc
|
| +++ b/src/crankshaft/hydrogen.cc
|
| @@ -1365,7 +1365,7 @@ HGraph* HGraphBuilder::CreateGraph() {
|
| graph_ = new (zone()) HGraph(info_, descriptor_);
|
| if (FLAG_hydrogen_stats) isolate()->GetHStatistics()->Initialize(info_);
|
| if (!info_->IsStub() && is_tracking_positions()) {
|
| - TraceInlinedFunction(info_->shared_info(), SourcePosition::Unknown());
|
| + TraceInlinedFunction(info_->shared_info(), SourcePosition::Unknown(), -1);
|
| }
|
| CompilationPhase phase("H_Block building", info_);
|
| set_current_block(graph()->entry_block());
|
| @@ -1374,12 +1374,11 @@ HGraph* HGraphBuilder::CreateGraph() {
|
| return graph_;
|
| }
|
|
|
| -int HGraphBuilder::TraceInlinedFunction(Handle<SharedFunctionInfo> shared,
|
| - SourcePosition position) {
|
| +void HGraphBuilder::TraceInlinedFunction(Handle<SharedFunctionInfo> shared,
|
| + SourcePosition position,
|
| + int inlining_id) {
|
| DCHECK(is_tracking_positions());
|
|
|
| - int inline_id = static_cast<int>(graph()->inlined_function_infos().size());
|
| - HInlinedFunctionInfo info(shared->start_position());
|
| if (!shared->script()->IsUndefined(isolate())) {
|
| Handle<Script> script(Script::cast(shared->script()), isolate());
|
|
|
| @@ -1393,7 +1392,7 @@ int HGraphBuilder::TraceInlinedFunction(Handle<SharedFunctionInfo> shared,
|
| os << String::cast(source_name)->ToCString().get() << ":";
|
| }
|
| os << shared->DebugName()->ToCString().get() << ") id{";
|
| - os << info_->optimization_id() << "," << inline_id << "} ---\n";
|
| + os << info_->optimization_id() << "," << inlining_id << "} ---\n";
|
| {
|
| DisallowHeapAllocation no_allocation;
|
| int start = shared->start_position();
|
| @@ -1409,17 +1408,13 @@ int HGraphBuilder::TraceInlinedFunction(Handle<SharedFunctionInfo> shared,
|
| }
|
| }
|
|
|
| - graph()->inlined_function_infos().push_back(info);
|
| -
|
| - if (FLAG_hydrogen_track_positions && inline_id != 0) {
|
| + if (FLAG_hydrogen_track_positions && inlining_id != -1) {
|
| CodeTracer::Scope tracing_scope(isolate()->GetCodeTracer());
|
| OFStream os(tracing_scope.file());
|
| os << "INLINE (" << shared->DebugName()->ToCString().get() << ") id{"
|
| - << info_->optimization_id() << "," << inline_id << "} AS " << inline_id
|
| - << " AT " << position << std::endl;
|
| + << info_->optimization_id() << "," << inlining_id << "} AS "
|
| + << inlining_id << " AT " << position.ScriptOffset() << std::endl;
|
| }
|
| -
|
| - return inline_id;
|
| }
|
|
|
| HInstruction* HGraphBuilder::AddInstruction(HInstruction* instr) {
|
| @@ -3127,7 +3122,7 @@ HOptimizedGraphBuilder::HOptimizedGraphBuilder(CompilationInfo* info,
|
| bool track_positions)
|
| : HGraphBuilder(info, CallInterfaceDescriptor(), track_positions),
|
| function_state_(NULL),
|
| - initial_function_state_(this, info, NORMAL_RETURN, 0,
|
| + initial_function_state_(this, info, NORMAL_RETURN, -1,
|
| TailCallMode::kAllow),
|
| ast_context_(NULL),
|
| break_scope_(NULL),
|
| @@ -3243,8 +3238,7 @@ HGraph::HGraph(CompilationInfo* info, CallInterfaceDescriptor descriptor)
|
| type_change_checksum_(0),
|
| maximum_environment_size_(0),
|
| no_side_effects_scope_count_(0),
|
| - disallow_adding_new_values_(false),
|
| - inlined_function_infos_(info->zone()) {
|
| + disallow_adding_new_values_(false) {
|
| if (info->IsStub()) {
|
| // For stubs, explicitly add the context to the environment.
|
| start_environment_ =
|
| @@ -3276,14 +3270,6 @@ void HGraph::FinalizeUniqueness() {
|
| }
|
|
|
|
|
| -int HGraph::SourcePositionToScriptPosition(SourcePosition pos) {
|
| - return (FLAG_hydrogen_track_positions && !pos.IsUnknown())
|
| - ? inlined_function_infos_.at(pos.inlining_id()).start_position +
|
| - pos.position()
|
| - : pos.raw();
|
| -}
|
| -
|
| -
|
| // Block ordering was implemented with two mutually recursive methods,
|
| // HGraph::Postorder and HGraph::PostorderLoopBlocks.
|
| // The recursion could lead to stack overflow so the algorithm has been
|
| @@ -3708,9 +3694,7 @@ FunctionState::FunctionState(HOptimizedGraphBuilder* owner,
|
|
|
| if (owner->is_tracking_positions()) {
|
| outer_source_position_ = owner->source_position();
|
| - owner->EnterInlinedSource(
|
| - info->shared_info()->start_position(),
|
| - inlining_id);
|
| + owner->EnterInlinedSource(inlining_id);
|
| owner->SetSourcePosition(info->shared_info()->start_position());
|
| }
|
| }
|
| @@ -3722,9 +3706,7 @@ FunctionState::~FunctionState() {
|
|
|
| if (owner_->is_tracking_positions()) {
|
| owner_->set_source_position(outer_source_position_);
|
| - owner_->EnterInlinedSource(
|
| - outer_->compilation_info()->shared_info()->start_position(),
|
| - outer_->inlining_id());
|
| + owner_->EnterInlinedSource(outer_->inlining_id());
|
| }
|
| }
|
|
|
| @@ -8089,7 +8071,8 @@ bool HOptimizedGraphBuilder::TryInline(Handle<JSFunction> target,
|
| // Remember that we inlined this function. This needs to be called right
|
| // after the EnsureDeoptimizationSupport call so that the code flusher
|
| // does not remove the code with the deoptimization support.
|
| - top_info()->AddInlinedFunction(target_info.shared_info());
|
| + int inlining_id = top_info()->AddInlinedFunction(target_info.shared_info(),
|
| + source_position());
|
|
|
| // ----------------------------------------------------------------
|
| // After this point, we've made a decision to inline this function (so
|
| @@ -8105,9 +8088,8 @@ bool HOptimizedGraphBuilder::TryInline(Handle<JSFunction> target,
|
| &bounds_)
|
| .Run();
|
|
|
| - int inlining_id = 0;
|
| if (is_tracking_positions()) {
|
| - inlining_id = TraceInlinedFunction(target_shared, source_position());
|
| + TraceInlinedFunction(target_shared, source_position(), inlining_id);
|
| }
|
|
|
| // Save the pending call context. Set up new one for the inlined function.
|
| @@ -8158,6 +8140,7 @@ bool HOptimizedGraphBuilder::TryInline(Handle<JSFunction> target,
|
| if (is_tracking_positions()) {
|
| enter_inlined->set_inlining_id(inlining_id);
|
| }
|
| +
|
| function_state()->set_entry(enter_inlined);
|
|
|
| VisitDeclarations(target_info.scope()->declarations());
|
| @@ -11079,12 +11062,6 @@ void HOptimizedGraphBuilder::VisitArithmeticExpression(BinaryOperation* expr) {
|
| BuildBinaryOperation(expr, left, right,
|
| ast_context()->IsEffect() ? NO_PUSH_BEFORE_SIMULATE
|
| : PUSH_BEFORE_SIMULATE);
|
| - if (is_tracking_positions() && result->IsBinaryOperation()) {
|
| - HBinaryOperation::cast(result)->SetOperandPositions(
|
| - zone(),
|
| - ScriptPositionToSourcePosition(expr->left()->position()),
|
| - ScriptPositionToSourcePosition(expr->right()->position()));
|
| - }
|
| return ast_context()->ReturnValue(result);
|
| }
|
|
|
| @@ -11264,10 +11241,6 @@ HControlInstruction* HOptimizedGraphBuilder::BuildCompareInstruction(
|
| AddCheckMap(operand_to_check, map);
|
| HCompareObjectEqAndBranch* result =
|
| New<HCompareObjectEqAndBranch>(left, right);
|
| - if (is_tracking_positions()) {
|
| - result->set_operand_position(zone(), 0, left_position);
|
| - result->set_operand_position(zone(), 1, right_position);
|
| - }
|
| return result;
|
| } else {
|
| BuildCheckHeapObject(operand_to_check);
|
| @@ -11407,9 +11380,6 @@ HControlInstruction* HOptimizedGraphBuilder::BuildCompareInstruction(
|
| HCompareNumericAndBranch* result =
|
| New<HCompareNumericAndBranch>(left, right, op);
|
| result->set_observed_input_representation(left_rep, right_rep);
|
| - if (is_tracking_positions()) {
|
| - result->SetOperandPositions(zone(), left_position, right_position);
|
| - }
|
| return result;
|
| }
|
| }
|
| @@ -12779,11 +12749,12 @@ void HTracer::Trace(const char* name, HGraph* graph, LChunk* chunk) {
|
| PrintIndent();
|
| std::ostringstream os;
|
| os << "0 " << uses << " " << NameOf(instruction) << " " << *instruction;
|
| - if (instruction->has_position() && instruction->position().raw() != 0) {
|
| + if (instruction->has_position()) {
|
| const SourcePosition pos = instruction->position();
|
| os << " pos:";
|
| - if (pos.inlining_id() != 0) os << pos.inlining_id() << "_";
|
| - os << pos.position();
|
| + if (pos.InliningId() != SourcePosition::kUnknown)
|
| + os << "inlining(" << pos.InliningId() << "),";
|
| + os << pos.ScriptOffset();
|
| }
|
| os << " <|@\n";
|
| trace_.Add(os.str().c_str());
|
|
|