| Index: src/hydrogen.cc
|
| diff --git a/src/hydrogen.cc b/src/hydrogen.cc
|
| index c25d7a12d1c25707bd54bbd6f2e40afaa237dca6..1f0831878bbcdb9e645aea676dffd9ef21c466f3 100644
|
| --- a/src/hydrogen.cc
|
| +++ b/src/hydrogen.cc
|
| @@ -139,16 +139,25 @@ void HBasicBlock::RemovePhi(HPhi* phi) {
|
| }
|
|
|
|
|
| -void HBasicBlock::AddInstruction(HInstruction* instr) {
|
| +void HBasicBlock::AddInstruction(HInstruction* instr, int position) {
|
| ASSERT(!IsStartBlock() || !IsFinished());
|
| ASSERT(!instr->IsLinked());
|
| ASSERT(!IsFinished());
|
|
|
| + if (position != RelocInfo::kNoPosition) {
|
| + instr->set_position(position);
|
| + }
|
| if (first_ == NULL) {
|
| ASSERT(last_environment() != NULL);
|
| ASSERT(!last_environment()->ast_id().IsNone());
|
| HBlockEntry* entry = new(zone()) HBlockEntry();
|
| entry->InitializeAsFirst(this);
|
| + if (position != RelocInfo::kNoPosition) {
|
| + entry->set_position(position);
|
| + } else {
|
| + ASSERT(!FLAG_opt_code_positions ||
|
| + !graph()->info()->IsOptimizing());
|
| + }
|
| first_ = last_ = entry;
|
| }
|
| instr->InsertAfter(last_);
|
| @@ -199,9 +208,9 @@ HSimulate* HBasicBlock::CreateSimulate(BailoutId ast_id,
|
| }
|
|
|
|
|
| -void HBasicBlock::Finish(HControlInstruction* end) {
|
| +void HBasicBlock::Finish(HControlInstruction* end, int position) {
|
| ASSERT(!IsFinished());
|
| - AddInstruction(end);
|
| + AddInstruction(end, position);
|
| end_ = end;
|
| for (HSuccessorIterator it(end); !it.Done(); it.Advance()) {
|
| it.Current()->RegisterPredecessor(this);
|
| @@ -210,6 +219,7 @@ void HBasicBlock::Finish(HControlInstruction* end) {
|
|
|
|
|
| void HBasicBlock::Goto(HBasicBlock* block,
|
| + int position,
|
| FunctionState* state,
|
| bool add_simulate) {
|
| bool drop_extra = state != NULL &&
|
| @@ -218,18 +228,21 @@ void HBasicBlock::Goto(HBasicBlock* block,
|
| if (block->IsInlineReturnTarget()) {
|
| HEnvironment* env = last_environment();
|
| int argument_count = env->arguments_environment()->parameter_count();
|
| - AddInstruction(new(zone()) HLeaveInlined(state->entry(), argument_count));
|
| + AddInstruction(new(zone())
|
| + HLeaveInlined(state->entry(), argument_count),
|
| + position);
|
| UpdateEnvironment(last_environment()->DiscardInlined(drop_extra));
|
| }
|
|
|
| - if (add_simulate) AddNewSimulate(BailoutId::None());
|
| + if (add_simulate) AddNewSimulate(BailoutId::None(), position);
|
| HGoto* instr = new(zone()) HGoto(block);
|
| - Finish(instr);
|
| + Finish(instr, position);
|
| }
|
|
|
|
|
| void HBasicBlock::AddLeaveInlined(HValue* return_value,
|
| - FunctionState* state) {
|
| + FunctionState* state,
|
| + int position) {
|
| HBasicBlock* target = state->function_return();
|
| bool drop_extra = state->inlining_kind() == DROP_EXTRA_ON_RETURN;
|
|
|
| @@ -237,12 +250,13 @@ void HBasicBlock::AddLeaveInlined(HValue* return_value,
|
| ASSERT(return_value != NULL);
|
| HEnvironment* env = last_environment();
|
| int argument_count = env->arguments_environment()->parameter_count();
|
| - AddInstruction(new(zone()) HLeaveInlined(state->entry(), argument_count));
|
| + AddInstruction(new(zone()) HLeaveInlined(state->entry(), argument_count),
|
| + position);
|
| UpdateEnvironment(last_environment()->DiscardInlined(drop_extra));
|
| last_environment()->Push(return_value);
|
| - AddNewSimulate(BailoutId::None());
|
| + AddNewSimulate(BailoutId::None(), position);
|
| HGoto* instr = new(zone()) HGoto(target);
|
| - Finish(instr);
|
| + Finish(instr, position);
|
| }
|
|
|
|
|
| @@ -700,9 +714,8 @@ bool HGraph::IsStandardConstant(HConstant* constant) {
|
| }
|
|
|
|
|
| -HGraphBuilder::IfBuilder::IfBuilder(HGraphBuilder* builder, int position)
|
| +HGraphBuilder::IfBuilder::IfBuilder(HGraphBuilder* builder)
|
| : builder_(builder),
|
| - position_(position),
|
| finished_(false),
|
| deopt_then_(false),
|
| deopt_else_(false),
|
| @@ -725,7 +738,6 @@ HGraphBuilder::IfBuilder::IfBuilder(
|
| HGraphBuilder* builder,
|
| HIfContinuation* continuation)
|
| : builder_(builder),
|
| - position_(RelocInfo::kNoPosition),
|
| finished_(false),
|
| deopt_then_(false),
|
| deopt_else_(false),
|
| @@ -741,8 +753,7 @@ HGraphBuilder::IfBuilder::IfBuilder(
|
| split_edge_merge_block_(NULL),
|
| merge_block_(NULL) {
|
| continuation->Continue(&first_true_block_,
|
| - &first_false_block_,
|
| - &position_);
|
| + &first_false_block_);
|
| }
|
|
|
|
|
| @@ -759,12 +770,12 @@ HControlInstruction* HGraphBuilder::IfBuilder::AddCompare(
|
| compare->SetSuccessorAt(0, first_true_block_);
|
| compare->SetSuccessorAt(1, split_edge);
|
| }
|
| - split_edge->GotoNoSimulate(split_edge_merge_block_);
|
| + builder_->GotoNoSimulate(split_edge, split_edge_merge_block_);
|
| } else {
|
| compare->SetSuccessorAt(0, first_true_block_);
|
| compare->SetSuccessorAt(1, first_false_block_);
|
| }
|
| - builder_->current_block()->Finish(compare);
|
| + builder_->FinishCurrentBlock(compare);
|
| needs_compare_ = false;
|
| return compare;
|
| }
|
| @@ -777,7 +788,7 @@ void HGraphBuilder::IfBuilder::Or() {
|
| if (split_edge_merge_block_ == NULL) {
|
| split_edge_merge_block_ =
|
| builder_->CreateBasicBlock(env->Copy());
|
| - first_true_block_->GotoNoSimulate(split_edge_merge_block_);
|
| + builder_->GotoNoSimulate(first_true_block_, split_edge_merge_block_);
|
| first_true_block_ = split_edge_merge_block_;
|
| }
|
| builder_->set_current_block(first_false_block_);
|
| @@ -791,7 +802,7 @@ void HGraphBuilder::IfBuilder::And() {
|
| HEnvironment* env = first_false_block_->last_environment();
|
| if (split_edge_merge_block_ == NULL) {
|
| split_edge_merge_block_ = builder_->CreateBasicBlock(env->Copy());
|
| - first_false_block_->GotoNoSimulate(split_edge_merge_block_);
|
| + builder_->GotoNoSimulate(first_false_block_, split_edge_merge_block_);
|
| first_false_block_ = split_edge_merge_block_;
|
| }
|
| builder_->set_current_block(first_true_block_);
|
| @@ -809,7 +820,7 @@ void HGraphBuilder::IfBuilder::CaptureContinuation(
|
| HBasicBlock* false_block = did_else_ && (first_false_block_ != NULL)
|
| ? builder_->current_block()
|
| : first_false_block_;
|
| - continuation->Capture(true_block, false_block, position_);
|
| + continuation->Capture(true_block, false_block);
|
| captured_ = true;
|
| End();
|
| }
|
| @@ -826,11 +837,11 @@ void HGraphBuilder::IfBuilder::JoinContinuation(HIfContinuation* continuation) {
|
| : first_false_block_;
|
| if (true_block != NULL && !true_block->IsFinished()) {
|
| ASSERT(continuation->IsTrueReachable());
|
| - true_block->GotoNoSimulate(continuation->true_branch());
|
| + builder_->GotoNoSimulate(true_block, continuation->true_branch());
|
| }
|
| if (false_block != NULL && !false_block->IsFinished()) {
|
| ASSERT(continuation->IsFalseReachable());
|
| - false_block->GotoNoSimulate(continuation->false_branch());
|
| + builder_->GotoNoSimulate(false_block, continuation->false_branch());
|
| }
|
| captured_ = true;
|
| End();
|
| @@ -851,7 +862,7 @@ void HGraphBuilder::IfBuilder::Then() {
|
| boolean_type.Add(ToBooleanStub::BOOLEAN);
|
| HBranch* branch = builder()->New<HBranch>(
|
| constant_false, boolean_type, first_true_block_, first_false_block_);
|
| - builder_->current_block()->Finish(branch);
|
| + builder_->FinishCurrentBlock(branch);
|
| }
|
| builder_->set_current_block(first_true_block_);
|
| }
|
| @@ -879,10 +890,9 @@ void HGraphBuilder::IfBuilder::Deopt(const char* reason) {
|
|
|
|
|
| void HGraphBuilder::IfBuilder::Return(HValue* value) {
|
| - HBasicBlock* block = builder_->current_block();
|
| HValue* parameter_count = builder_->graph()->GetConstantMinus1();
|
| - block->FinishExit(builder_->New<HReturn>(value, parameter_count));
|
| - builder_->set_current_block(NULL);
|
| + builder_->FinishExitCurrentBlock(
|
| + builder_->New<HReturn>(value, parameter_count));
|
| if (did_else_) {
|
| first_false_block_ = NULL;
|
| } else {
|
| @@ -912,17 +922,17 @@ void HGraphBuilder::IfBuilder::End() {
|
| HBasicBlock* last_false_block = builder_->current_block();
|
| ASSERT(!last_false_block->IsFinished());
|
| if (deopt_then_) {
|
| - last_false_block->GotoNoSimulate(merge_block_);
|
| + builder_->GotoNoSimulate(last_false_block, merge_block_);
|
| builder_->PadEnvironmentForContinuation(last_true_block_,
|
| merge_block_);
|
| - last_true_block_->GotoNoSimulate(merge_block_);
|
| + builder_->GotoNoSimulate(last_true_block_, merge_block_);
|
| } else {
|
| - last_true_block_->GotoNoSimulate(merge_block_);
|
| + builder_->GotoNoSimulate(last_true_block_, merge_block_);
|
| if (deopt_else_) {
|
| builder_->PadEnvironmentForContinuation(last_false_block,
|
| merge_block_);
|
| }
|
| - last_false_block->GotoNoSimulate(merge_block_);
|
| + builder_->GotoNoSimulate(last_false_block, merge_block_);
|
| }
|
| builder_->set_current_block(merge_block_);
|
| }
|
| @@ -970,7 +980,7 @@ HValue* HGraphBuilder::LoopBuilder::BeginBody(
|
| phi_ = header_block_->AddNewPhi(env->values()->length());
|
| phi_->AddInput(initial);
|
| env->Push(initial);
|
| - builder_->current_block()->GotoNoSimulate(header_block_);
|
| + builder_->GotoNoSimulate(header_block_);
|
|
|
| HEnvironment* body_env = env->Copy();
|
| HEnvironment* exit_env = env->Copy();
|
| @@ -982,7 +992,7 @@ HValue* HGraphBuilder::LoopBuilder::BeginBody(
|
|
|
| builder_->set_current_block(header_block_);
|
| env->Pop();
|
| - builder_->current_block()->Finish(builder_->New<HCompareNumericAndBranch>(
|
| + builder_->FinishCurrentBlock(builder_->New<HCompareNumericAndBranch>(
|
| phi_, terminating, token, body_block_, exit_block_));
|
|
|
| builder_->set_current_block(body_block_);
|
| @@ -1007,10 +1017,10 @@ void HGraphBuilder::LoopBuilder::Break() {
|
| // Its the first time we saw a break.
|
| HEnvironment* env = exit_block_->last_environment()->Copy();
|
| exit_trampoline_block_ = builder_->CreateBasicBlock(env);
|
| - exit_block_->GotoNoSimulate(exit_trampoline_block_);
|
| + builder_->GotoNoSimulate(exit_block_, exit_trampoline_block_);
|
| }
|
|
|
| - builder_->current_block()->GotoNoSimulate(exit_trampoline_block_);
|
| + builder_->GotoNoSimulate(exit_trampoline_block_);
|
| }
|
|
|
|
|
| @@ -1030,7 +1040,7 @@ void HGraphBuilder::LoopBuilder::EndBody() {
|
| // Push the new increment value on the expression stack to merge into the phi.
|
| builder_->environment()->Push(increment_);
|
| HBasicBlock* last_block = builder_->current_block();
|
| - last_block->GotoNoSimulate(header_block_);
|
| + builder_->GotoNoSimulate(last_block, header_block_);
|
| header_block_->loop_information()->RegisterBackEdge(last_block);
|
|
|
| if (exit_trampoline_block_ != NULL) {
|
| @@ -1055,7 +1065,9 @@ HGraph* HGraphBuilder::CreateGraph() {
|
|
|
| HInstruction* HGraphBuilder::AddInstruction(HInstruction* instr) {
|
| ASSERT(current_block() != NULL);
|
| - current_block()->AddInstruction(instr);
|
| + ASSERT(!FLAG_opt_code_positions ||
|
| + position_ != RelocInfo::kNoPosition || !info_->IsOptimizing());
|
| + current_block()->AddInstruction(instr, position_);
|
| if (graph()->IsInsideNoSideEffectsScope()) {
|
| instr->SetFlag(HValue::kHasNoObservableSideEffects);
|
| }
|
| @@ -1063,6 +1075,26 @@ HInstruction* HGraphBuilder::AddInstruction(HInstruction* instr) {
|
| }
|
|
|
|
|
| +void HGraphBuilder::FinishCurrentBlock(HControlInstruction* last) {
|
| + ASSERT(!FLAG_opt_code_positions || !info_->IsOptimizing() ||
|
| + position_ != RelocInfo::kNoPosition);
|
| + current_block()->Finish(last, position_);
|
| + if (last->IsReturn() || last->IsAbnormalExit()) {
|
| + set_current_block(NULL);
|
| + }
|
| +}
|
| +
|
| +
|
| +void HGraphBuilder::FinishExitCurrentBlock(HControlInstruction* instruction) {
|
| + ASSERT(!FLAG_opt_code_positions || !info_->IsOptimizing() ||
|
| + position_ != RelocInfo::kNoPosition);
|
| + current_block()->FinishExit(instruction, position_);
|
| + if (instruction->IsReturn() || instruction->IsAbnormalExit()) {
|
| + set_current_block(NULL);
|
| + }
|
| +}
|
| +
|
| +
|
| void HGraphBuilder::AddIncrementCounter(StatsCounter* counter) {
|
| if (FLAG_native_code_counters && counter->Enabled()) {
|
| HValue* reference = Add<HConstant>(ExternalReference(counter));
|
| @@ -1111,9 +1143,9 @@ void HGraphBuilder::FinishExitWithHardDeoptimization(
|
| PadEnvironmentForContinuation(current_block(), continuation);
|
| Add<HDeoptimize>(reason, Deoptimizer::EAGER);
|
| if (graph()->IsInsideNoSideEffectsScope()) {
|
| - current_block()->GotoNoSimulate(continuation);
|
| + GotoNoSimulate(continuation);
|
| } else {
|
| - current_block()->Goto(continuation);
|
| + Goto(continuation);
|
| }
|
| }
|
|
|
| @@ -1937,9 +1969,8 @@ HValue* HGraphBuilder::BuildCloneShallowArray(HValue* boilerplate,
|
| void HGraphBuilder::BuildCompareNil(
|
| HValue* value,
|
| Handle<Type> type,
|
| - int position,
|
| HIfContinuation* continuation) {
|
| - IfBuilder if_nil(this, position);
|
| + IfBuilder if_nil(this);
|
| bool some_case_handled = false;
|
| bool some_case_missing = false;
|
|
|
| @@ -2207,6 +2238,9 @@ HOptimizedGraphBuilder::HOptimizedGraphBuilder(CompilationInfo* info)
|
| // to know it's the initial state.
|
| function_state_= &initial_function_state_;
|
| InitializeAstVisitor(info->isolate());
|
| + if (FLAG_opt_code_positions) {
|
| + SetSourcePosition(info->shared_info()->start_position());
|
| + }
|
| }
|
|
|
|
|
| @@ -2219,8 +2253,8 @@ HBasicBlock* HOptimizedGraphBuilder::CreateJoin(HBasicBlock* first,
|
| return first;
|
| } else {
|
| HBasicBlock* join_block = graph()->CreateBasicBlock();
|
| - first->Goto(join_block);
|
| - second->Goto(join_block);
|
| + Goto(first, join_block);
|
| + Goto(second, join_block);
|
| join_block->SetJoinId(join_id);
|
| return join_block;
|
| }
|
| @@ -2231,7 +2265,7 @@ HBasicBlock* HOptimizedGraphBuilder::JoinContinue(IterationStatement* statement,
|
| HBasicBlock* exit_block,
|
| HBasicBlock* continue_block) {
|
| if (continue_block != NULL) {
|
| - if (exit_block != NULL) exit_block->Goto(continue_block);
|
| + if (exit_block != NULL) Goto(exit_block, continue_block);
|
| continue_block->SetJoinId(statement->ContinueId());
|
| return continue_block;
|
| }
|
| @@ -2244,10 +2278,10 @@ HBasicBlock* HOptimizedGraphBuilder::CreateLoop(IterationStatement* statement,
|
| HBasicBlock* body_exit,
|
| HBasicBlock* loop_successor,
|
| HBasicBlock* break_block) {
|
| - if (body_exit != NULL) body_exit->Goto(loop_entry);
|
| + if (body_exit != NULL) Goto(body_exit, loop_entry);
|
| loop_entry->PostProcessLoopHeader(statement);
|
| if (break_block != NULL) {
|
| - if (loop_successor != NULL) loop_successor->Goto(break_block);
|
| + if (loop_successor != NULL) Goto(loop_successor, break_block);
|
| break_block->SetJoinId(statement->ExitId());
|
| return break_block;
|
| }
|
| @@ -2258,7 +2292,7 @@ HBasicBlock* HOptimizedGraphBuilder::CreateLoop(IterationStatement* statement,
|
| // Build a new loop header block and set it as the current block.
|
| HBasicBlock* HOptimizedGraphBuilder::BuildLoopEntry() {
|
| HBasicBlock* loop_entry = CreateLoopHeaderBlock();
|
| - current_block()->Goto(loop_entry);
|
| + Goto(loop_entry);
|
| set_current_block(loop_entry);
|
| return loop_entry;
|
| }
|
| @@ -2273,8 +2307,8 @@ HBasicBlock* HOptimizedGraphBuilder::BuildLoopEntry(
|
| }
|
|
|
|
|
| -void HBasicBlock::FinishExit(HControlInstruction* instruction) {
|
| - Finish(instruction);
|
| +void HBasicBlock::FinishExit(HControlInstruction* instruction, int position) {
|
| + Finish(instruction, position);
|
| ClearEnvironment();
|
| }
|
|
|
| @@ -2822,7 +2856,7 @@ void EffectContext::ReturnControl(HControlInstruction* instr,
|
| HBasicBlock* empty_false = owner()->graph()->CreateBasicBlock();
|
| instr->SetSuccessorAt(0, empty_true);
|
| instr->SetSuccessorAt(1, empty_false);
|
| - owner()->current_block()->Finish(instr);
|
| + owner()->FinishCurrentBlock(instr);
|
| HBasicBlock* join = owner()->CreateJoin(empty_true, empty_false, ast_id);
|
| owner()->set_current_block(join);
|
| }
|
| @@ -2832,7 +2866,7 @@ void EffectContext::ReturnContinuation(HIfContinuation* continuation,
|
| BailoutId ast_id) {
|
| HBasicBlock* true_branch = NULL;
|
| HBasicBlock* false_branch = NULL;
|
| - continuation->Continue(&true_branch, &false_branch, NULL);
|
| + continuation->Continue(&true_branch, &false_branch);
|
| if (!continuation->IsTrueReachable()) {
|
| owner()->set_current_block(false_branch);
|
| } else if (!continuation->IsFalseReachable()) {
|
| @@ -2866,7 +2900,7 @@ void ValueContext::ReturnControl(HControlInstruction* instr, BailoutId ast_id) {
|
| HBasicBlock* materialize_true = owner()->graph()->CreateBasicBlock();
|
| instr->SetSuccessorAt(0, materialize_true);
|
| instr->SetSuccessorAt(1, materialize_false);
|
| - owner()->current_block()->Finish(instr);
|
| + owner()->FinishCurrentBlock(instr);
|
| owner()->set_current_block(materialize_true);
|
| owner()->Push(owner()->graph()->GetConstantTrue());
|
| owner()->set_current_block(materialize_false);
|
| @@ -2881,7 +2915,7 @@ void ValueContext::ReturnContinuation(HIfContinuation* continuation,
|
| BailoutId ast_id) {
|
| HBasicBlock* materialize_true = NULL;
|
| HBasicBlock* materialize_false = NULL;
|
| - continuation->Continue(&materialize_true, &materialize_false, NULL);
|
| + continuation->Continue(&materialize_true, &materialize_false);
|
| if (continuation->IsTrueReachable()) {
|
| owner()->set_current_block(materialize_true);
|
| owner()->Push(owner()->graph()->GetConstantTrue());
|
| @@ -2921,9 +2955,9 @@ void TestContext::ReturnControl(HControlInstruction* instr, BailoutId ast_id) {
|
| HBasicBlock* empty_false = owner()->graph()->CreateBasicBlock();
|
| instr->SetSuccessorAt(0, empty_true);
|
| instr->SetSuccessorAt(1, empty_false);
|
| - owner()->current_block()->Finish(instr);
|
| - empty_true->Goto(if_true(), owner()->function_state());
|
| - empty_false->Goto(if_false(), owner()->function_state());
|
| + owner()->FinishCurrentBlock(instr);
|
| + owner()->Goto(empty_true, if_true(), owner()->function_state());
|
| + owner()->Goto(empty_false, if_false(), owner()->function_state());
|
| owner()->set_current_block(NULL);
|
| }
|
|
|
| @@ -2932,12 +2966,12 @@ void TestContext::ReturnContinuation(HIfContinuation* continuation,
|
| BailoutId ast_id) {
|
| HBasicBlock* true_branch = NULL;
|
| HBasicBlock* false_branch = NULL;
|
| - continuation->Continue(&true_branch, &false_branch, NULL);
|
| + continuation->Continue(&true_branch, &false_branch);
|
| if (continuation->IsTrueReachable()) {
|
| - true_branch->Goto(if_true(), owner()->function_state());
|
| + owner()->Goto(true_branch, if_true(), owner()->function_state());
|
| }
|
| if (continuation->IsFalseReachable()) {
|
| - false_branch->Goto(if_false(), owner()->function_state());
|
| + owner()->Goto(false_branch, if_false(), owner()->function_state());
|
| }
|
| owner()->set_current_block(NULL);
|
| }
|
| @@ -2955,11 +2989,11 @@ void TestContext::BuildBranch(HValue* value) {
|
| HBasicBlock* empty_true = builder->graph()->CreateBasicBlock();
|
| HBasicBlock* empty_false = builder->graph()->CreateBasicBlock();
|
| ToBooleanStub::Types expected(condition()->to_boolean_types());
|
| - builder->current_block()->Finish(builder->New<HBranch>(
|
| + builder->FinishCurrentBlock(builder->New<HBranch>(
|
| value, expected, empty_true, empty_false));
|
|
|
| - empty_true->Goto(if_true(), builder->function_state());
|
| - empty_false->Goto(if_false(), builder->function_state());
|
| + owner()->Goto(empty_true, if_true(), builder->function_state());
|
| + owner()->Goto(empty_false , if_false(), builder->function_state());
|
| builder->set_current_block(NULL);
|
| }
|
|
|
| @@ -3076,7 +3110,7 @@ bool HOptimizedGraphBuilder::BuildGraph() {
|
| // not replayed by the Lithium translation.
|
| HEnvironment* initial_env = environment()->CopyWithoutHistory();
|
| HBasicBlock* body_entry = CreateBasicBlock(initial_env);
|
| - current_block()->Goto(body_entry);
|
| + Goto(body_entry);
|
| body_entry->SetJoinId(BailoutId::FunctionEntry());
|
| set_current_block(body_entry);
|
|
|
| @@ -3319,7 +3353,7 @@ void HOptimizedGraphBuilder::VisitBlock(Block* stmt) {
|
| }
|
| HBasicBlock* break_block = break_info.break_block();
|
| if (break_block != NULL) {
|
| - if (current_block() != NULL) current_block()->Goto(break_block);
|
| + if (current_block() != NULL) Goto(break_block);
|
| break_block->SetJoinId(stmt->ExitId());
|
| set_current_block(break_block);
|
| }
|
| @@ -3429,7 +3463,7 @@ void HOptimizedGraphBuilder::VisitContinueStatement(
|
| HBasicBlock* continue_block = break_scope()->Get(
|
| stmt->target(), BreakAndContinueScope::CONTINUE, &drop_extra);
|
| Drop(drop_extra);
|
| - current_block()->Goto(continue_block);
|
| + Goto(continue_block);
|
| set_current_block(NULL);
|
| }
|
|
|
| @@ -3442,7 +3476,7 @@ void HOptimizedGraphBuilder::VisitBreakStatement(BreakStatement* stmt) {
|
| HBasicBlock* break_block = break_scope()->Get(
|
| stmt->target(), BreakAndContinueScope::BREAK, &drop_extra);
|
| Drop(drop_extra);
|
| - current_block()->Goto(break_block);
|
| + Goto(break_block);
|
| set_current_block(NULL);
|
| }
|
|
|
| @@ -3465,10 +3499,10 @@ void HOptimizedGraphBuilder::VisitReturnStatement(ReturnStatement* stmt) {
|
| if (context->IsTest()) {
|
| TestContext* test = TestContext::cast(context);
|
| CHECK_ALIVE(VisitForEffect(stmt->expression()));
|
| - current_block()->Goto(test->if_true(), state);
|
| + Goto(test->if_true(), state);
|
| } else if (context->IsEffect()) {
|
| CHECK_ALIVE(VisitForEffect(stmt->expression()));
|
| - current_block()->Goto(function_return(), state);
|
| + Goto(function_return(), state);
|
| } else {
|
| ASSERT(context->IsValue());
|
| CHECK_ALIVE(VisitForValue(stmt->expression()));
|
| @@ -3482,9 +3516,9 @@ void HOptimizedGraphBuilder::VisitReturnStatement(ReturnStatement* stmt) {
|
| HBasicBlock* not_spec_object = graph()->CreateBasicBlock();
|
| typecheck->SetSuccessorAt(0, if_spec_object);
|
| typecheck->SetSuccessorAt(1, not_spec_object);
|
| - current_block()->Finish(typecheck);
|
| - if_spec_object->AddLeaveInlined(return_value, state);
|
| - not_spec_object->AddLeaveInlined(receiver, state);
|
| + FinishCurrentBlock(typecheck);
|
| + AddLeaveInlined(if_spec_object, return_value, state);
|
| + AddLeaveInlined(not_spec_object, receiver, state);
|
| }
|
| } else if (state->inlining_kind() == SETTER_CALL_RETURN) {
|
| // Return from an inlined setter call. The returned value is never used, the
|
| @@ -3494,11 +3528,11 @@ void HOptimizedGraphBuilder::VisitReturnStatement(ReturnStatement* stmt) {
|
| HValue* rhs = environment()->arguments_environment()->Lookup(1);
|
| context->ReturnValue(rhs);
|
| } else if (context->IsEffect()) {
|
| - current_block()->Goto(function_return(), state);
|
| + Goto(function_return(), state);
|
| } else {
|
| ASSERT(context->IsValue());
|
| HValue* rhs = environment()->arguments_environment()->Lookup(1);
|
| - current_block()->AddLeaveInlined(rhs, state);
|
| + AddLeaveInlined(rhs, state);
|
| }
|
| } else {
|
| // Return from a normal inlined function. Visit the subexpression in the
|
| @@ -3508,11 +3542,11 @@ void HOptimizedGraphBuilder::VisitReturnStatement(ReturnStatement* stmt) {
|
| VisitForControl(stmt->expression(), test->if_true(), test->if_false());
|
| } else if (context->IsEffect()) {
|
| CHECK_ALIVE(VisitForEffect(stmt->expression()));
|
| - current_block()->Goto(function_return(), state);
|
| + Goto(function_return(), state);
|
| } else {
|
| ASSERT(context->IsValue());
|
| CHECK_ALIVE(VisitForValue(stmt->expression()));
|
| - current_block()->AddLeaveInlined(Pop(), state);
|
| + AddLeaveInlined(Pop(), state);
|
| }
|
| }
|
| set_current_block(NULL);
|
| @@ -3560,7 +3594,7 @@ void HOptimizedGraphBuilder::VisitSwitchStatement(SwitchStatement* stmt) {
|
| not_string_block = graph()->CreateBasicBlock();
|
| string_check = New<HIsStringAndBranch>(
|
| tag_value, first_test_block, not_string_block);
|
| - current_block()->Finish(string_check);
|
| + FinishCurrentBlock(string_check);
|
|
|
| set_current_block(first_test_block);
|
| }
|
| @@ -3603,7 +3637,7 @@ void HOptimizedGraphBuilder::VisitSwitchStatement(SwitchStatement* stmt) {
|
|
|
| compare->SetSuccessorAt(0, body_block);
|
| compare->SetSuccessorAt(1, next_test_block);
|
| - current_block()->Finish(compare);
|
| + FinishCurrentBlock(compare);
|
|
|
| set_current_block(next_test_block);
|
| }
|
| @@ -3684,8 +3718,8 @@ void HOptimizedGraphBuilder::VisitSwitchStatement(SwitchStatement* stmt) {
|
| last_block,
|
| stmt->ExitId()));
|
| } else {
|
| - if (fall_through_block != NULL) fall_through_block->Goto(break_block);
|
| - if (last_block != NULL) last_block->Goto(break_block);
|
| + if (fall_through_block != NULL) Goto(fall_through_block, break_block);
|
| + if (last_block != NULL) Goto(last_block, break_block);
|
| break_block->SetJoinId(stmt->ExitId());
|
| set_current_block(break_block);
|
| }
|
| @@ -3890,7 +3924,7 @@ void HOptimizedGraphBuilder::VisitForInStatement(ForInStatement* stmt) {
|
|
|
| compare_index->SetSuccessorAt(0, loop_body);
|
| compare_index->SetSuccessorAt(1, loop_successor);
|
| - current_block()->Finish(compare_index);
|
| + FinishCurrentBlock(compare_index);
|
|
|
| set_current_block(loop_successor);
|
| Drop(5);
|
| @@ -4141,7 +4175,6 @@ void HOptimizedGraphBuilder::VisitVariableProxy(VariableProxy* expr) {
|
| global_object,
|
| variable->name(),
|
| ast_context()->is_for_typeof());
|
| - instr->set_position(expr->position());
|
| return ast_context()->ReturnInstruction(instr, expr->id());
|
| }
|
| }
|
| @@ -4879,7 +4912,6 @@ HInstruction* HOptimizedGraphBuilder::BuildLoadMonomorphic(
|
|
|
|
|
| void HOptimizedGraphBuilder::HandlePolymorphicLoadNamedField(
|
| - int position,
|
| BailoutId ast_id,
|
| BailoutId return_id,
|
| HValue* object,
|
| @@ -4900,7 +4932,7 @@ void HOptimizedGraphBuilder::HandlePolymorphicLoadNamedField(
|
| HBasicBlock* if_false = graph()->CreateBasicBlock();
|
| HCompareMap* compare = New<HCompareMap>(
|
| object, info.map(), if_true, if_false);
|
| - current_block()->Finish(compare);
|
| + FinishCurrentBlock(compare);
|
|
|
| set_current_block(if_true);
|
|
|
| @@ -4910,13 +4942,12 @@ void HOptimizedGraphBuilder::HandlePolymorphicLoadNamedField(
|
| if (HasStackOverflow()) return;
|
| } else {
|
| if (!load->IsLinked()) {
|
| - load->set_position(position);
|
| AddInstruction(load);
|
| }
|
| if (!ast_context()->IsEffect()) Push(load);
|
| }
|
|
|
| - if (current_block() != NULL) current_block()->Goto(join);
|
| + if (current_block() != NULL) Goto(join);
|
| set_current_block(if_false);
|
| }
|
| }
|
| @@ -4933,12 +4964,11 @@ void HOptimizedGraphBuilder::HandlePolymorphicLoadNamedField(
|
| } else {
|
| HValue* context = environment()->context();
|
| HInstruction* load = new(zone()) HLoadNamedGeneric(context, object, name);
|
| - load->set_position(position);
|
| AddInstruction(load);
|
| if (!ast_context()->IsEffect()) Push(load);
|
|
|
| if (join != NULL) {
|
| - current_block()->Goto(join);
|
| + Goto(join);
|
| } else {
|
| Add<HSimulate>(ast_id, REMOVABLE_SIMULATE);
|
| if (!ast_context()->IsEffect()) ast_context()->ReturnValue(Pop());
|
| @@ -4954,7 +4984,6 @@ void HOptimizedGraphBuilder::HandlePolymorphicLoadNamedField(
|
|
|
|
|
| bool HOptimizedGraphBuilder::TryStorePolymorphicAsMonomorphic(
|
| - int position,
|
| BailoutId assignment_id,
|
| HValue* object,
|
| HValue* value,
|
| @@ -5004,7 +5033,6 @@ bool HOptimizedGraphBuilder::TryStorePolymorphicAsMonomorphic(
|
| checked_object, name, value, types->at(count - 1), &lookup),
|
| true);
|
| if (!ast_context()->IsEffect()) Push(value);
|
| - store->set_position(position);
|
| AddInstruction(store);
|
| Add<HSimulate>(assignment_id);
|
| if (!ast_context()->IsEffect()) Drop(1);
|
| @@ -5014,14 +5042,13 @@ bool HOptimizedGraphBuilder::TryStorePolymorphicAsMonomorphic(
|
|
|
|
|
| void HOptimizedGraphBuilder::HandlePolymorphicStoreNamedField(
|
| - int position,
|
| BailoutId assignment_id,
|
| HValue* object,
|
| HValue* value,
|
| SmallMapList* types,
|
| Handle<String> name) {
|
| if (TryStorePolymorphicAsMonomorphic(
|
| - position, assignment_id, object, value, types, name)) {
|
| + assignment_id, object, value, types, name)) {
|
| return;
|
| }
|
|
|
| @@ -5042,17 +5069,16 @@ void HOptimizedGraphBuilder::HandlePolymorphicStoreNamedField(
|
| HBasicBlock* if_true = graph()->CreateBasicBlock();
|
| HBasicBlock* if_false = graph()->CreateBasicBlock();
|
| HCompareMap* compare = New<HCompareMap>(object, map, if_true, if_false);
|
| - current_block()->Finish(compare);
|
| + FinishCurrentBlock(compare);
|
|
|
| set_current_block(if_true);
|
| HInstruction* instr;
|
| CHECK_ALIVE(instr = BuildStoreNamedField(
|
| compare, name, value, map, &lookup));
|
| - instr->set_position(position);
|
| // Goto will add the HSimulate for the store.
|
| AddInstruction(instr);
|
| if (!ast_context()->IsEffect()) Push(value);
|
| - current_block()->Goto(join);
|
| + Goto(join);
|
|
|
| set_current_block(if_false);
|
| }
|
| @@ -5065,14 +5091,13 @@ void HOptimizedGraphBuilder::HandlePolymorphicStoreNamedField(
|
| FinishExitWithHardDeoptimization("Unknown map in polymorphic store", join);
|
| } else {
|
| HInstruction* instr = BuildStoreNamedGeneric(object, name, value);
|
| - instr->set_position(position);
|
| AddInstruction(instr);
|
|
|
| if (join != NULL) {
|
| if (!ast_context()->IsEffect()) {
|
| Push(value);
|
| }
|
| - current_block()->Goto(join);
|
| + Goto(join);
|
| } else {
|
| // The HSimulate for the store should not see the stored value in
|
| // effect contexts (it is not materialized at expr->id() in the
|
| @@ -5127,7 +5152,6 @@ void HOptimizedGraphBuilder::BuildStore(Expression* expr,
|
| HValue* object = environment()->ExpressionStackAt(2);
|
| bool has_side_effects = false;
|
| HandleKeyedElementAccess(object, key, value, expr, return_id,
|
| - expr->position(),
|
| true, // is_store
|
| &has_side_effects);
|
| Drop(3);
|
| @@ -5176,15 +5200,13 @@ void HOptimizedGraphBuilder::BuildStore(Expression* expr,
|
| }
|
| } else if (types != NULL && types->length() > 1) {
|
| Drop(2);
|
| - return HandlePolymorphicStoreNamedField(
|
| - expr->position(), ast_id, object, value, types, name);
|
| + return HandlePolymorphicStoreNamedField(ast_id, object, value, types, name);
|
| } else {
|
| Drop(2);
|
| instr = BuildStoreNamedGeneric(object, name, value);
|
| }
|
|
|
| if (!ast_context()->IsEffect()) Push(value);
|
| - instr->set_position(expr->position());
|
| AddInstruction(instr);
|
| if (instr->HasObservableSideEffects()) {
|
| Add<HSimulate>(ast_id, REMOVABLE_SIMULATE);
|
| @@ -5213,7 +5235,6 @@ void HOptimizedGraphBuilder::HandlePropertyAssignment(Assignment* expr) {
|
| void HOptimizedGraphBuilder::HandleGlobalVariableAssignment(
|
| Variable* var,
|
| HValue* value,
|
| - int position,
|
| BailoutId ast_id) {
|
| LookupResult lookup(isolate());
|
| GlobalPropertyAccess type = LookupGlobalProperty(var, &lookup, true);
|
| @@ -5236,7 +5257,6 @@ void HOptimizedGraphBuilder::HandleGlobalVariableAssignment(
|
| }
|
| HInstruction* instr =
|
| Add<HStoreGlobalCell>(value, cell, lookup.GetPropertyDetails());
|
| - instr->set_position(position);
|
| if (instr->HasObservableSideEffects()) {
|
| Add<HSimulate>(ast_id, REMOVABLE_SIMULATE);
|
| }
|
| @@ -5245,7 +5265,7 @@ void HOptimizedGraphBuilder::HandleGlobalVariableAssignment(
|
| HStoreGlobalGeneric* instr =
|
| Add<HStoreGlobalGeneric>(global_object, var->name(),
|
| value, function_strict_mode_flag());
|
| - instr->set_position(position);
|
| + USE(instr);
|
| ASSERT(instr->HasObservableSideEffects());
|
| Add<HSimulate>(ast_id, REMOVABLE_SIMULATE);
|
| }
|
| @@ -5274,7 +5294,6 @@ void HOptimizedGraphBuilder::HandleCompoundAssignment(Assignment* expr) {
|
| case Variable::UNALLOCATED:
|
| HandleGlobalVariableAssignment(var,
|
| Top(),
|
| - expr->position(),
|
| expr->AssignmentId());
|
| break;
|
|
|
| @@ -5342,7 +5361,7 @@ void HOptimizedGraphBuilder::HandleCompoundAssignment(Assignment* expr) {
|
| key = Top();
|
| }
|
|
|
| - CHECK_ALIVE(PushLoad(prop, object, key, expr->position()));
|
| + CHECK_ALIVE(PushLoad(prop, object, key));
|
|
|
| CHECK_ALIVE(VisitForValue(expr->value()));
|
| HValue* right = Pop();
|
| @@ -5405,7 +5424,6 @@ void HOptimizedGraphBuilder::VisitAssignment(Assignment* expr) {
|
| CHECK_ALIVE(VisitForValue(expr->value()));
|
| HandleGlobalVariableAssignment(var,
|
| Top(),
|
| - expr->position(),
|
| expr->AssignmentId());
|
| return ast_context()->ReturnValue(Pop());
|
|
|
| @@ -5504,16 +5522,15 @@ void HOptimizedGraphBuilder::VisitThrow(Throw* expr) {
|
| CHECK_ALIVE(VisitForValue(expr->exception()));
|
|
|
| HValue* value = environment()->Pop();
|
| - HThrow* instr = Add<HThrow>(value);
|
| - instr->set_position(expr->position());
|
| + if (!FLAG_opt_code_positions) SetSourcePosition(expr->position());
|
| + Add<HThrow>(value);
|
| Add<HSimulate>(expr->id());
|
|
|
| // If the throw definitely exits the function, we can finish with a dummy
|
| // control flow at this point. This is not the case if the throw is inside
|
| // an inlined function which may be replaced.
|
| if (call_context() == NULL) {
|
| - current_block()->FinishExit(new(zone()) HAbnormalExit);
|
| - set_current_block(NULL);
|
| + FinishExitCurrentBlock(new(zone()) HAbnormalExit);
|
| }
|
| }
|
|
|
| @@ -5677,7 +5694,6 @@ HValue* HOptimizedGraphBuilder::HandlePolymorphicElementAccess(
|
| HValue* val,
|
| SmallMapList* maps,
|
| BailoutId ast_id,
|
| - int position,
|
| bool is_store,
|
| KeyedAccessStoreMode store_mode,
|
| bool* has_side_effects) {
|
| @@ -5689,9 +5705,6 @@ HValue* HOptimizedGraphBuilder::HandlePolymorphicElementAccess(
|
| TryBuildConsolidatedElementLoad(object, key, val, maps);
|
| if (consolidated_load != NULL) {
|
| *has_side_effects |= consolidated_load->HasObservableSideEffects();
|
| - if (position != RelocInfo::kNoPosition) {
|
| - consolidated_load->set_position(position);
|
| - }
|
| return consolidated_load;
|
| }
|
| }
|
| @@ -5748,7 +5761,6 @@ HValue* HOptimizedGraphBuilder::HandlePolymorphicElementAccess(
|
| store_mode);
|
| }
|
| *has_side_effects |= instr->HasObservableSideEffects();
|
| - if (position != RelocInfo::kNoPosition) instr->set_position(position);
|
| return is_store ? NULL : instr;
|
| }
|
|
|
| @@ -5762,7 +5774,7 @@ HValue* HOptimizedGraphBuilder::HandlePolymorphicElementAccess(
|
| HBasicBlock* other_map = graph()->CreateBasicBlock();
|
| HCompareMap* mapcompare =
|
| New<HCompareMap>(object, map, this_map, other_map);
|
| - current_block()->Finish(mapcompare);
|
| + FinishCurrentBlock(mapcompare);
|
|
|
| set_current_block(this_map);
|
| HInstruction* access = NULL;
|
| @@ -5785,12 +5797,11 @@ HValue* HOptimizedGraphBuilder::HandlePolymorphicElementAccess(
|
| *has_side_effects |= access->HasObservableSideEffects();
|
| // The caller will use has_side_effects and add a correct Simulate.
|
| access->SetFlag(HValue::kHasNoObservableSideEffects);
|
| - if (position != RelocInfo::kNoPosition) access->set_position(position);
|
| if (!is_store) {
|
| Push(access);
|
| }
|
| NoObservableSideEffectsScope scope(this);
|
| - current_block()->GotoNoSimulate(join);
|
| + GotoNoSimulate(join);
|
| set_current_block(other_map);
|
| }
|
|
|
| @@ -5809,7 +5820,6 @@ HValue* HOptimizedGraphBuilder::HandleKeyedElementAccess(
|
| HValue* val,
|
| Expression* expr,
|
| BailoutId ast_id,
|
| - int position,
|
| bool is_store,
|
| bool* has_side_effects) {
|
| ASSERT(!expr->IsPropertyName());
|
| @@ -5831,7 +5841,7 @@ HValue* HOptimizedGraphBuilder::HandleKeyedElementAccess(
|
| }
|
| } else if (types != NULL && !types->is_empty()) {
|
| return HandlePolymorphicElementAccess(
|
| - obj, key, val, types, ast_id, position, is_store,
|
| + obj, key, val, types, ast_id, is_store,
|
| expr->GetStoreMode(), has_side_effects);
|
| } else {
|
| if (is_store) {
|
| @@ -5849,7 +5859,6 @@ HValue* HOptimizedGraphBuilder::HandleKeyedElementAccess(
|
| }
|
| AddInstruction(instr);
|
| }
|
| - if (position != RelocInfo::kNoPosition) instr->set_position(position);
|
| *has_side_effects = instr->HasObservableSideEffects();
|
| return instr;
|
| }
|
| @@ -5948,12 +5957,11 @@ bool HOptimizedGraphBuilder::TryArgumentsAccess(Property* expr) {
|
|
|
| void HOptimizedGraphBuilder::PushLoad(Property* expr,
|
| HValue* object,
|
| - HValue* key,
|
| - int position) {
|
| + HValue* key) {
|
| ValueContext for_value(this, ARGUMENTS_NOT_ALLOWED);
|
| Push(object);
|
| if (key != NULL) Push(key);
|
| - BuildLoad(expr, position, expr->LoadId());
|
| + BuildLoad(expr, expr->LoadId());
|
| }
|
|
|
|
|
| @@ -5966,7 +5974,6 @@ static bool AreStringTypes(SmallMapList* types) {
|
|
|
|
|
| void HOptimizedGraphBuilder::BuildLoad(Property* expr,
|
| - int position,
|
| BailoutId ast_id) {
|
| HInstruction* instr = NULL;
|
| if (expr->IsStringAccess()) {
|
| @@ -5995,7 +6002,7 @@ void HOptimizedGraphBuilder::BuildLoad(Property* expr,
|
| PropertyAccessInfo info(isolate(), types->first(), name);
|
| if (!info.CanLoadAsMonomorphic(types)) {
|
| return HandlePolymorphicLoadNamedField(
|
| - position, ast_id, expr->LoadId(), object, types, name);
|
| + ast_id, expr->LoadId(), object, types, name);
|
| }
|
|
|
| BuildCheckHeapObject(object);
|
| @@ -6020,7 +6027,7 @@ void HOptimizedGraphBuilder::BuildLoad(Property* expr,
|
|
|
| bool has_side_effects = false;
|
| HValue* load = HandleKeyedElementAccess(
|
| - obj, key, NULL, expr, ast_id, position,
|
| + obj, key, NULL, expr, ast_id,
|
| false, // is_store
|
| &has_side_effects);
|
| if (has_side_effects) {
|
| @@ -6034,7 +6041,6 @@ void HOptimizedGraphBuilder::BuildLoad(Property* expr,
|
| }
|
| return ast_context()->ReturnValue(load);
|
| }
|
| - instr->set_position(position);
|
| return ast_context()->ReturnInstruction(instr, ast_id);
|
| }
|
|
|
| @@ -6052,7 +6058,7 @@ void HOptimizedGraphBuilder::VisitProperty(Property* expr) {
|
| CHECK_ALIVE(VisitForValue(expr->key()));
|
| }
|
|
|
| - BuildLoad(expr, expr->position(), expr->id());
|
| + BuildLoad(expr, expr->id());
|
| }
|
|
|
|
|
| @@ -6165,7 +6171,6 @@ bool HOptimizedGraphBuilder::TryCallPolymorphicAsMonomorphic(
|
| int argument_count = expr->arguments()->length() + 1; // Includes receiver.
|
| HCallConstantFunction* call =
|
| New<HCallConstantFunction>(expr->target(), argument_count);
|
| - call->set_position(expr->position());
|
| PreProcessCall(call);
|
| AddInstruction(call);
|
| if (!ast_context()->IsEffect()) Push(call);
|
| @@ -6229,9 +6234,9 @@ void HOptimizedGraphBuilder::HandlePolymorphicCallNamed(
|
| HBasicBlock* empty_smi_block = graph()->CreateBasicBlock();
|
| HBasicBlock* not_smi_block = graph()->CreateBasicBlock();
|
| number_block = graph()->CreateBasicBlock();
|
| - current_block()->Finish(New<HIsSmiAndBranch>(
|
| + FinishCurrentBlock(New<HIsSmiAndBranch>(
|
| receiver, empty_smi_block, not_smi_block));
|
| - empty_smi_block->Goto(number_block);
|
| + Goto(empty_smi_block, number_block);
|
| set_current_block(not_smi_block);
|
| } else {
|
| BuildCheckHeapObject(receiver);
|
| @@ -6256,10 +6261,10 @@ void HOptimizedGraphBuilder::HandlePolymorphicCallNamed(
|
| expr->set_map_check();
|
| }
|
|
|
| - current_block()->Finish(compare);
|
| + FinishCurrentBlock(compare);
|
|
|
| if (expr->check_type() == NUMBER_CHECK) {
|
| - if_true->Goto(number_block);
|
| + Goto(if_true, number_block);
|
| if_true = number_block;
|
| number_block->SetJoinId(expr->id());
|
| }
|
| @@ -6282,13 +6287,12 @@ void HOptimizedGraphBuilder::HandlePolymorphicCallNamed(
|
| } else {
|
| HCallConstantFunction* call =
|
| New<HCallConstantFunction>(expr->target(), argument_count);
|
| - call->set_position(expr->position());
|
| PreProcessCall(call);
|
| AddInstruction(call);
|
| if (!ast_context()->IsEffect()) Push(call);
|
| }
|
|
|
| - if (current_block() != NULL) current_block()->Goto(join);
|
| + if (current_block() != NULL) Goto(join);
|
| set_current_block(if_false);
|
| }
|
|
|
| @@ -6304,13 +6308,12 @@ void HOptimizedGraphBuilder::HandlePolymorphicCallNamed(
|
| FinishExitWithHardDeoptimization("Unknown map in polymorphic call", join);
|
| } else {
|
| HCallNamed* call = New<HCallNamed>(name, argument_count);
|
| - call->set_position(expr->position());
|
| PreProcessCall(call);
|
|
|
| if (join != NULL) {
|
| AddInstruction(call);
|
| if (!ast_context()->IsEffect()) Push(call);
|
| - current_block()->Goto(join);
|
| + Goto(join);
|
| } else {
|
| return ast_context()->ReturnInstruction(call, expr->id());
|
| }
|
| @@ -6612,12 +6615,12 @@ bool HOptimizedGraphBuilder::TryInline(CallKind call_kind,
|
| // return value will always evaluate to true, in a value context the
|
| // return value is the newly allocated receiver.
|
| if (call_context()->IsTest()) {
|
| - current_block()->Goto(inlined_test_context()->if_true(), state);
|
| + Goto(inlined_test_context()->if_true(), state);
|
| } else if (call_context()->IsEffect()) {
|
| - current_block()->Goto(function_return(), state);
|
| + Goto(function_return(), state);
|
| } else {
|
| ASSERT(call_context()->IsValue());
|
| - current_block()->AddLeaveInlined(implicit_return_value, state);
|
| + AddLeaveInlined(implicit_return_value, state);
|
| }
|
| } else if (state->inlining_kind() == SETTER_CALL_RETURN) {
|
| // Falling off the end of an inlined setter call. The returned value is
|
| @@ -6626,21 +6629,21 @@ bool HOptimizedGraphBuilder::TryInline(CallKind call_kind,
|
| if (call_context()->IsTest()) {
|
| inlined_test_context()->ReturnValue(implicit_return_value);
|
| } else if (call_context()->IsEffect()) {
|
| - current_block()->Goto(function_return(), state);
|
| + Goto(function_return(), state);
|
| } else {
|
| ASSERT(call_context()->IsValue());
|
| - current_block()->AddLeaveInlined(implicit_return_value, state);
|
| + AddLeaveInlined(implicit_return_value, state);
|
| }
|
| } else {
|
| // Falling off the end of a normal inlined function. This basically means
|
| // returning undefined.
|
| if (call_context()->IsTest()) {
|
| - current_block()->Goto(inlined_test_context()->if_false(), state);
|
| + Goto(inlined_test_context()->if_false(), state);
|
| } else if (call_context()->IsEffect()) {
|
| - current_block()->Goto(function_return(), state);
|
| + Goto(function_return(), state);
|
| } else {
|
| ASSERT(call_context()->IsValue());
|
| - current_block()->AddLeaveInlined(undefined, state);
|
| + AddLeaveInlined(undefined, state);
|
| }
|
| }
|
| }
|
| @@ -6662,13 +6665,13 @@ bool HOptimizedGraphBuilder::TryInline(CallKind call_kind,
|
| entry->RegisterReturnTarget(if_true, zone());
|
| if_true->SetJoinId(ast_id);
|
| HBasicBlock* true_target = TestContext::cast(ast_context())->if_true();
|
| - if_true->Goto(true_target, function_state());
|
| + Goto(if_true, true_target, function_state());
|
| }
|
| if (if_false->HasPredecessor()) {
|
| entry->RegisterReturnTarget(if_false, zone());
|
| if_false->SetJoinId(ast_id);
|
| HBasicBlock* false_target = TestContext::cast(ast_context())->if_false();
|
| - if_false->Goto(false_target, function_state());
|
| + Goto(if_false, false_target, function_state());
|
| }
|
| set_current_block(NULL);
|
| return true;
|
| @@ -6775,7 +6778,6 @@ bool HOptimizedGraphBuilder::TryInlineBuiltinFunctionCall(Call* expr,
|
| Drop(1); // Receiver.
|
| HInstruction* op =
|
| HUnaryMathOperation::New(zone(), context, argument, id);
|
| - op->set_position(expr->position());
|
| if (drop_extra) Drop(1); // Optionally drop the function.
|
| ast_context()->ReturnInstruction(op, expr->id());
|
| return true;
|
| @@ -6865,7 +6867,6 @@ bool HOptimizedGraphBuilder::TryInlineBuiltinMethodCall(
|
| Drop(1); // Receiver.
|
| HInstruction* op =
|
| HUnaryMathOperation::New(zone(), context, argument, id);
|
| - op->set_position(expr->position());
|
| ast_context()->ReturnInstruction(op, expr->id());
|
| return true;
|
| }
|
| @@ -6994,7 +6995,6 @@ bool HOptimizedGraphBuilder::TryCallApply(Call* expr) {
|
| wrapped_receiver,
|
| length,
|
| elements);
|
| - result->set_position(expr->position());
|
| ast_context()->ReturnInstruction(result, expr->id());
|
| return true;
|
| } else {
|
| @@ -7032,7 +7032,6 @@ bool HOptimizedGraphBuilder::TryCallApply(Call* expr) {
|
| known_function,
|
| arguments_count);
|
| Drop(arguments_count);
|
| - call->set_position(expr->position());
|
| ast_context()->ReturnInstruction(call, expr->id());
|
| return true;
|
| }
|
| @@ -7063,7 +7062,6 @@ void HOptimizedGraphBuilder::VisitCall(Call* expr) {
|
| CHECK_ALIVE(VisitArgumentList(expr->arguments()));
|
|
|
| call = New<HCallKeyed>(key, argument_count);
|
| - call->set_position(expr->position());
|
| Drop(argument_count + 1); // 1 is the key.
|
| return ast_context()->ReturnInstruction(call, expr->id());
|
| }
|
| @@ -7117,7 +7115,6 @@ void HOptimizedGraphBuilder::VisitCall(Call* expr) {
|
| } else {
|
| call = PreProcessCall(New<HCallNamed>(name, argument_count));
|
| }
|
| -
|
| } else {
|
| VariableProxy* proxy = expr->expression()->AsVariableProxy();
|
| if (proxy != NULL && proxy->var()->is_possibly_eval(isolate())) {
|
| @@ -7230,7 +7227,6 @@ void HOptimizedGraphBuilder::VisitCall(Call* expr) {
|
| }
|
| }
|
|
|
| - call->set_position(expr->position());
|
| return ast_context()->ReturnInstruction(call, expr->id());
|
| }
|
|
|
| @@ -7248,6 +7244,7 @@ void HOptimizedGraphBuilder::VisitCallNew(CallNew* expr) {
|
| ASSERT(!HasStackOverflow());
|
| ASSERT(current_block() != NULL);
|
| ASSERT(current_block()->HasPredecessor());
|
| + if (!FLAG_opt_code_positions) SetSourcePosition(expr->position());
|
| int argument_count = expr->arguments()->length() + 1; // Plus constructor.
|
| Factory* factory = isolate()->factory();
|
|
|
| @@ -7339,7 +7336,6 @@ void HOptimizedGraphBuilder::VisitCallNew(CallNew* expr) {
|
| environment()->SetExpressionStackAt(receiver_index, function);
|
| HInstruction* call =
|
| PreProcessCall(New<HCallNew>(function, argument_count));
|
| - call->set_position(expr->position());
|
| return ast_context()->ReturnInstruction(call, expr->id());
|
| } else {
|
| // The constructor function is both an operand to the instruction and an
|
| @@ -7359,7 +7355,6 @@ void HOptimizedGraphBuilder::VisitCallNew(CallNew* expr) {
|
| call = New<HCallNew>(constructor, argument_count);
|
| }
|
| Drop(argument_count);
|
| - call->set_position(expr->position());
|
| return ast_context()->ReturnInstruction(call, expr->id());
|
| }
|
| }
|
| @@ -7590,6 +7585,7 @@ void HOptimizedGraphBuilder::VisitCountOperation(CountOperation* expr) {
|
| ASSERT(!HasStackOverflow());
|
| ASSERT(current_block() != NULL);
|
| ASSERT(current_block()->HasPredecessor());
|
| + if (!FLAG_opt_code_positions) SetSourcePosition(expr->position());
|
| Expression* target = expr->expression();
|
| VariableProxy* proxy = target->AsVariableProxy();
|
| Property* prop = target->AsProperty();
|
| @@ -7622,7 +7618,6 @@ void HOptimizedGraphBuilder::VisitCountOperation(CountOperation* expr) {
|
| case Variable::UNALLOCATED:
|
| HandleGlobalVariableAssignment(var,
|
| after,
|
| - expr->position(),
|
| expr->AssignmentId());
|
| break;
|
|
|
| @@ -7680,7 +7675,7 @@ void HOptimizedGraphBuilder::VisitCountOperation(CountOperation* expr) {
|
| key = Top();
|
| }
|
|
|
| - CHECK_ALIVE(PushLoad(prop, object, key, expr->position()));
|
| + CHECK_ALIVE(PushLoad(prop, object, key));
|
|
|
| after = BuildIncrement(returns_original_input, expr);
|
|
|
| @@ -8090,7 +8085,7 @@ void HOptimizedGraphBuilder::VisitLogicalExpression(BinaryOperation* expr) {
|
| HBranch* test = is_logical_and
|
| ? New<HBranch>(left_value, expected, eval_right, empty_block)
|
| : New<HBranch>(left_value, expected, empty_block, eval_right);
|
| - current_block()->Finish(test);
|
| + FinishCurrentBlock(test);
|
|
|
| set_current_block(eval_right);
|
| Drop(1); // Value of the left subexpression.
|
| @@ -8147,10 +8142,10 @@ void HOptimizedGraphBuilder::VisitLogicalExpression(BinaryOperation* expr) {
|
| void HOptimizedGraphBuilder::VisitArithmeticExpression(BinaryOperation* expr) {
|
| CHECK_ALIVE(VisitForValue(expr->left()));
|
| CHECK_ALIVE(VisitForValue(expr->right()));
|
| + if (!FLAG_opt_code_positions) SetSourcePosition(expr->position());
|
| HValue* right = Pop();
|
| HValue* left = Pop();
|
| HInstruction* instr = BuildBinaryOperation(expr, left, right);
|
| - instr->set_position(expr->position());
|
| return ast_context()->ReturnInstruction(instr, expr->id());
|
| }
|
|
|
| @@ -8159,9 +8154,9 @@ void HOptimizedGraphBuilder::HandleLiteralCompareTypeof(CompareOperation* expr,
|
| Expression* sub_expr,
|
| Handle<String> check) {
|
| CHECK_ALIVE(VisitForTypeOf(sub_expr));
|
| + if (!FLAG_opt_code_positions) SetSourcePosition(expr->position());
|
| HValue* value = Pop();
|
| HTypeofIsAndBranch* instr = new(zone()) HTypeofIsAndBranch(value, check);
|
| - instr->set_position(expr->position());
|
| return ast_context()->ReturnControl(instr, expr->id());
|
| }
|
|
|
| @@ -8183,6 +8178,8 @@ void HOptimizedGraphBuilder::VisitCompareOperation(CompareOperation* expr) {
|
| ASSERT(current_block() != NULL);
|
| ASSERT(current_block()->HasPredecessor());
|
|
|
| + if (!FLAG_opt_code_positions) SetSourcePosition(expr->position());
|
| +
|
| // Check for a few fast cases. The AST visiting behavior must be in sync
|
| // with the full codegen: We don't push both left and right values onto
|
| // the expression stack when one side is a special-case literal.
|
| @@ -8207,7 +8204,6 @@ void HOptimizedGraphBuilder::VisitCompareOperation(CompareOperation* expr) {
|
| Handle<String> rhs = Handle<String>::cast(literal->value());
|
| HClassOfTestAndBranch* instr =
|
| new(zone()) HClassOfTestAndBranch(value, rhs);
|
| - instr->set_position(expr->position());
|
| return ast_context()->ReturnControl(instr, expr->id());
|
| }
|
|
|
| @@ -8229,7 +8225,6 @@ void HOptimizedGraphBuilder::VisitCompareOperation(CompareOperation* expr) {
|
| if (IsLiteralCompareBool(isolate(), left, op, right)) {
|
| HCompareObjectEqAndBranch* result =
|
| New<HCompareObjectEqAndBranch>(left, right);
|
| - result->set_position(expr->position());
|
| return ast_context()->ReturnControl(result, expr->id());
|
| }
|
|
|
| @@ -8261,13 +8256,11 @@ void HOptimizedGraphBuilder::VisitCompareOperation(CompareOperation* expr) {
|
| // assumed to stay the same for this instanceof.
|
| if (target.is_null()) {
|
| HInstanceOf* result = new(zone()) HInstanceOf(context, left, right);
|
| - result->set_position(expr->position());
|
| return ast_context()->ReturnInstruction(result, expr->id());
|
| } else {
|
| Add<HCheckValue>(right, target);
|
| HInstanceOfKnownGlobal* result =
|
| New<HInstanceOfKnownGlobal>(left, target);
|
| - result->set_position(expr->position());
|
| return ast_context()->ReturnInstruction(result, expr->id());
|
| }
|
|
|
| @@ -8280,7 +8273,6 @@ void HOptimizedGraphBuilder::VisitCompareOperation(CompareOperation* expr) {
|
| // TODO(olivf) InvokeFunction produces a check for the parameter count,
|
| // even though we are certain to pass the correct number of arguments here.
|
| HInstruction* result = New<HInvokeFunction>(function, 2);
|
| - result->set_position(expr->position());
|
| return ast_context()->ReturnInstruction(result, expr->id());
|
| }
|
|
|
| @@ -8304,7 +8296,6 @@ void HOptimizedGraphBuilder::VisitCompareOperation(CompareOperation* expr) {
|
| AddCheckMap(right, map);
|
| HCompareObjectEqAndBranch* result =
|
| New<HCompareObjectEqAndBranch>(left, right);
|
| - result->set_position(expr->position());
|
| return ast_context()->ReturnControl(result, expr->id());
|
| } else {
|
| BuildCheckHeapObject(left);
|
| @@ -8313,7 +8304,6 @@ void HOptimizedGraphBuilder::VisitCompareOperation(CompareOperation* expr) {
|
| AddInstruction(HCheckInstanceType::NewIsSpecObject(right, zone()));
|
| HCompareObjectEqAndBranch* result =
|
| New<HCompareObjectEqAndBranch>(left, right);
|
| - result->set_position(expr->position());
|
| return ast_context()->ReturnControl(result, expr->id());
|
| }
|
| }
|
| @@ -8328,7 +8318,6 @@ void HOptimizedGraphBuilder::VisitCompareOperation(CompareOperation* expr) {
|
| AddInstruction(HCheckInstanceType::NewIsInternalizedString(right, zone()));
|
| HCompareObjectEqAndBranch* result =
|
| New<HCompareObjectEqAndBranch>(left, right);
|
| - result->set_position(expr->position());
|
| return ast_context()->ReturnControl(result, expr->id());
|
| } else if (combined_type->Is(Type::String())) {
|
| BuildCheckHeapObject(left);
|
| @@ -8337,7 +8326,6 @@ void HOptimizedGraphBuilder::VisitCompareOperation(CompareOperation* expr) {
|
| AddInstruction(HCheckInstanceType::NewIsString(right, zone()));
|
| HStringCompareAndBranch* result =
|
| New<HStringCompareAndBranch>(left, right, op);
|
| - result->set_position(expr->position());
|
| return ast_context()->ReturnControl(result, expr->id());
|
| } else if (combined_type->NumClasses() == 1 && Token::IsEqualityOp(op)) {
|
| BuildCheckHeapObject(left);
|
| @@ -8346,7 +8334,6 @@ void HOptimizedGraphBuilder::VisitCompareOperation(CompareOperation* expr) {
|
| BuildCheckMap(right, combined_type->Classes().Current());
|
| HCompareObjectEqAndBranch* result =
|
| New<HCompareObjectEqAndBranch>(left, right);
|
| - result->set_position(expr->position());
|
| return ast_context()->ReturnInstruction(result, expr->id());
|
| } else if (combined_type->Is(Type::Receiver()) && Token::IsEqualityOp(op)) {
|
| BuildCheckHeapObject(left);
|
| @@ -8355,7 +8342,6 @@ void HOptimizedGraphBuilder::VisitCompareOperation(CompareOperation* expr) {
|
| AddInstruction(HCheckInstanceType::NewIsSpecObject(right, zone()));
|
| HCompareObjectEqAndBranch* result =
|
| New<HCompareObjectEqAndBranch>(left, right);
|
| - result->set_position(expr->position());
|
| return ast_context()->ReturnInstruction(result, expr->id());
|
| } else {
|
| if (combined_rep.IsTagged() || combined_rep.IsNone()) {
|
| @@ -8363,13 +8349,11 @@ void HOptimizedGraphBuilder::VisitCompareOperation(CompareOperation* expr) {
|
| new(zone()) HCompareGeneric(context, left, right, op);
|
| result->set_observed_input_representation(1, left_rep);
|
| result->set_observed_input_representation(2, right_rep);
|
| - result->set_position(expr->position());
|
| return ast_context()->ReturnInstruction(result, expr->id());
|
| } else {
|
| HCompareNumericAndBranch* result =
|
| New<HCompareNumericAndBranch>(left, right, op);
|
| result->set_observed_input_representation(left_rep, right_rep);
|
| - result->set_position(expr->position());
|
| return ast_context()->ReturnControl(result, expr->id());
|
| }
|
| }
|
| @@ -8383,6 +8367,7 @@ void HOptimizedGraphBuilder::HandleLiteralCompareNil(CompareOperation* expr,
|
| ASSERT(current_block() != NULL);
|
| ASSERT(current_block()->HasPredecessor());
|
| ASSERT(expr->op() == Token::EQ || expr->op() == Token::EQ_STRICT);
|
| + if (!FLAG_opt_code_positions) SetSourcePosition(expr->position());
|
| CHECK_ALIVE(VisitForValue(sub_expr));
|
| HValue* value = Pop();
|
| if (expr->op() == Token::EQ_STRICT) {
|
| @@ -8391,7 +8376,6 @@ void HOptimizedGraphBuilder::HandleLiteralCompareNil(CompareOperation* expr,
|
| : graph()->GetConstantUndefined();
|
| HCompareObjectEqAndBranch* instr =
|
| New<HCompareObjectEqAndBranch>(value, nil_constant);
|
| - instr->set_position(expr->position());
|
| return ast_context()->ReturnControl(instr, expr->id());
|
| } else {
|
| ASSERT_EQ(Token::EQ, expr->op());
|
| @@ -8399,7 +8383,7 @@ void HOptimizedGraphBuilder::HandleLiteralCompareNil(CompareOperation* expr,
|
| ? handle(Type::Any(), isolate_)
|
| : expr->combined_type();
|
| HIfContinuation continuation;
|
| - BuildCompareNil(value, type, expr->position(), &continuation);
|
| + BuildCompareNil(value, type, &continuation);
|
| return ast_context()->ReturnContinuation(&continuation, expr->id());
|
| }
|
| }
|
| @@ -8983,8 +8967,8 @@ void HOptimizedGraphBuilder::GenerateSetValueOf(CallRuntime* call) {
|
| HBasicBlock* if_smi = graph()->CreateBasicBlock();
|
| HBasicBlock* if_heap_object = graph()->CreateBasicBlock();
|
| HBasicBlock* join = graph()->CreateBasicBlock();
|
| - current_block()->Finish(New<HIsSmiAndBranch>(object, if_smi, if_heap_object));
|
| - if_smi->Goto(join);
|
| + FinishCurrentBlock(New<HIsSmiAndBranch>(object, if_smi, if_heap_object));
|
| + Goto(if_smi, join);
|
|
|
| // Check if object is a JSValue.
|
| set_current_block(if_heap_object);
|
| @@ -8994,14 +8978,14 @@ void HOptimizedGraphBuilder::GenerateSetValueOf(CallRuntime* call) {
|
| HBasicBlock* not_js_value = graph()->CreateBasicBlock();
|
| typecheck->SetSuccessorAt(0, if_js_value);
|
| typecheck->SetSuccessorAt(1, not_js_value);
|
| - current_block()->Finish(typecheck);
|
| - not_js_value->Goto(join);
|
| + FinishCurrentBlock(typecheck);
|
| + Goto(not_js_value, join);
|
|
|
| // Create in-object property store to kValueOffset.
|
| set_current_block(if_js_value);
|
| Add<HStoreNamedField>(object,
|
| HObjectAccess::ForJSObjectOffset(JSValue::kValueOffset), value);
|
| - if_js_value->Goto(join);
|
| + Goto(if_js_value, join);
|
| join->SetJoinId(call->id());
|
| set_current_block(join);
|
| return ast_context()->ReturnValue(value);
|
| @@ -9160,19 +9144,19 @@ void HOptimizedGraphBuilder::GenerateCallFunction(CallRuntime* call) {
|
| HBasicBlock* join = graph()->CreateBasicBlock();
|
| typecheck->SetSuccessorAt(0, if_jsfunction);
|
| typecheck->SetSuccessorAt(1, if_nonfunction);
|
| - current_block()->Finish(typecheck);
|
| + FinishCurrentBlock(typecheck);
|
|
|
| set_current_block(if_jsfunction);
|
| HInstruction* invoke_result = Add<HInvokeFunction>(function, arg_count);
|
| Drop(arg_count);
|
| Push(invoke_result);
|
| - if_jsfunction->Goto(join);
|
| + Goto(if_jsfunction, join);
|
|
|
| set_current_block(if_nonfunction);
|
| HInstruction* call_result = Add<HCallFunction>(function, arg_count);
|
| Drop(arg_count);
|
| Push(call_result);
|
| - if_nonfunction->Goto(join);
|
| + Goto(if_nonfunction, join);
|
|
|
| set_current_block(join);
|
| join->SetJoinId(call->id());
|
|
|