| Index: runtime/vm/flow_graph_builder.cc
|
| ===================================================================
|
| --- runtime/vm/flow_graph_builder.cc (revision 37783)
|
| +++ runtime/vm/flow_graph_builder.cc (working copy)
|
| @@ -125,7 +125,8 @@
|
| if (label != label_) return NULL;
|
| if (break_target_ == NULL) {
|
| break_target_ =
|
| - new JoinEntryInstr(owner()->AllocateBlockId(), owner()->try_index());
|
| + new(owner()->isolate()) JoinEntryInstr(owner()->AllocateBlockId(),
|
| + owner()->try_index());
|
| }
|
| return break_target_;
|
| }
|
| @@ -182,7 +183,8 @@
|
| if (label != this->label()) return NULL;
|
| if (continue_target_ == NULL) {
|
| continue_target_ =
|
| - new JoinEntryInstr(owner()->AllocateBlockId(), try_index());
|
| + new(owner()->isolate()) JoinEntryInstr(owner()->AllocateBlockId(),
|
| + try_index());
|
| }
|
| return continue_target_;
|
| }
|
| @@ -225,7 +227,8 @@
|
| if (label != case_labels_[i]) continue;
|
| if (case_targets_[i] == NULL) {
|
| case_targets_[i] =
|
| - new JoinEntryInstr(owner()->AllocateBlockId(), try_index());
|
| + new(owner()->isolate()) JoinEntryInstr(owner()->AllocateBlockId(),
|
| + try_index());
|
| }
|
| return case_targets_[i];
|
| }
|
| @@ -248,7 +251,7 @@
|
| : 0),
|
| num_stack_locals_(parsed_function->num_stack_locals()),
|
| exit_collector_(exit_collector),
|
| - guarded_fields_(new ZoneGrowableArray<const Field*>()),
|
| + guarded_fields_(new(I) ZoneGrowableArray<const Field*>()),
|
| last_used_block_id_(0), // 0 is used for the graph entry.
|
| try_index_(CatchClauseNode::kInvalidTryIndex),
|
| catch_try_index_(CatchClauseNode::kInvalidTryIndex),
|
| @@ -353,7 +356,7 @@
|
| intptr_t join_id = caller_graph_->max_block_id() + 1;
|
| caller_graph_->set_max_block_id(join_id);
|
| JoinEntryInstr* join =
|
| - new JoinEntryInstr(join_id, CatchClauseNode::kInvalidTryIndex);
|
| + new(I) JoinEntryInstr(join_id, CatchClauseNode::kInvalidTryIndex);
|
| join->InheritDeoptTargetAfter(isolate(), call_);
|
|
|
| // The dominator set of the join is the intersection of the dominator
|
| @@ -372,7 +375,7 @@
|
| GrowableArray<BlockEntryInstr*> join_dominators;
|
| for (intptr_t i = 0; i < num_exits; ++i) {
|
| // Add the control-flow edge.
|
| - GotoInstr* goto_instr = new GotoInstr(join);
|
| + GotoInstr* goto_instr = new(I) GotoInstr(join);
|
| goto_instr->InheritDeoptTarget(isolate(), ReturnAt(i));
|
| LastInstructionAt(i)->LinkTo(goto_instr);
|
| ExitBlockAt(i)->set_last_instruction(LastInstructionAt(i)->next());
|
| @@ -418,7 +421,7 @@
|
| // If the call has uses, create a phi of the returns.
|
| if (call_->HasUses()) {
|
| // Add a phi of the return values.
|
| - PhiInstr* phi = new PhiInstr(join, num_exits);
|
| + PhiInstr* phi = new(I) PhiInstr(join, num_exits);
|
| phi->set_ssa_temp_index(caller_graph_->alloc_ssa_temp_index());
|
| phi->mark_alive();
|
| for (intptr_t i = 0; i < num_exits; ++i) {
|
| @@ -456,19 +459,20 @@
|
| // goes to the rest of the caller graph. It is removed as unreachable code
|
| // by the constant propagation.
|
| TargetEntryInstr* false_block =
|
| - new TargetEntryInstr(caller_graph_->allocate_block_id(),
|
| - call_block->try_index());
|
| + new(I) TargetEntryInstr(caller_graph_->allocate_block_id(),
|
| + call_block->try_index());
|
| false_block->InheritDeoptTargetAfter(isolate(), call_);
|
| false_block->LinkTo(call_->next());
|
| call_block->ReplaceAsPredecessorWith(false_block);
|
|
|
| ConstantInstr* true_const = caller_graph_->GetConstant(Bool::True());
|
| BranchInstr* branch =
|
| - new BranchInstr(new StrictCompareInstr(call_block->start_pos(),
|
| - Token::kEQ_STRICT,
|
| - new Value(true_const),
|
| - new Value(true_const),
|
| - false)); // No number check.
|
| + new(I) BranchInstr(
|
| + new(I) StrictCompareInstr(call_block->start_pos(),
|
| + Token::kEQ_STRICT,
|
| + new(I) Value(true_const),
|
| + new(I) Value(true_const),
|
| + false)); // No number check.
|
| branch->InheritDeoptTarget(isolate(), call_);
|
| *branch->true_successor_address() = callee_entry;
|
| *branch->false_successor_address() = false_block;
|
| @@ -574,7 +578,7 @@
|
| exit()->LinkTo(definition);
|
| }
|
| exit_ = definition;
|
| - return new Value(definition);
|
| + return new(I) Value(definition);
|
| }
|
|
|
|
|
| @@ -608,7 +612,7 @@
|
|
|
| void EffectGraphVisitor::AddReturnExit(intptr_t token_pos, Value* value) {
|
| ASSERT(is_open());
|
| - ReturnInstr* return_instr = new ReturnInstr(token_pos, value);
|
| + ReturnInstr* return_instr = new(I) ReturnInstr(token_pos, value);
|
| AddInstruction(return_instr);
|
| InlineExitCollector* exit_collector = owner()->exit_collector();
|
| if (exit_collector != NULL) {
|
| @@ -621,7 +625,7 @@
|
| void EffectGraphVisitor::Goto(JoinEntryInstr* join) {
|
| ASSERT(is_open());
|
| if (is_empty()) {
|
| - entry_ = new GotoInstr(join);
|
| + entry_ = new(I) GotoInstr(join);
|
| } else {
|
| exit()->Goto(join);
|
| }
|
| @@ -671,7 +675,7 @@
|
| exit_ = true_exit;
|
| } else {
|
| JoinEntryInstr* join =
|
| - new JoinEntryInstr(owner()->AllocateBlockId(), owner()->try_index());
|
| + new(I) JoinEntryInstr(owner()->AllocateBlockId(), owner()->try_index());
|
| true_exit->Goto(join);
|
| false_exit->Goto(join);
|
| exit_ = join;
|
| @@ -699,9 +703,9 @@
|
| Append(test_fragment);
|
| } else {
|
| JoinEntryInstr* join =
|
| - new JoinEntryInstr(owner()->AllocateBlockId(), owner()->try_index());
|
| + new(I) JoinEntryInstr(owner()->AllocateBlockId(), owner()->try_index());
|
| CheckStackOverflowInstr* check =
|
| - new CheckStackOverflowInstr(token_pos, owner()->loop_depth());
|
| + new(I) CheckStackOverflowInstr(token_pos, owner()->loop_depth());
|
| join->LinkTo(check);
|
| check->LinkTo(test_fragment.entry());
|
| Goto(join);
|
| @@ -716,7 +720,7 @@
|
|
|
| PushArgumentInstr* EffectGraphVisitor::PushArgument(Value* value) {
|
| owner_->add_args_pushed(1);
|
| - PushArgumentInstr* result = new PushArgumentInstr(value);
|
| + PushArgumentInstr* result = new(I) PushArgumentInstr(value);
|
| AddInstruction(result);
|
| return result;
|
| }
|
| @@ -725,7 +729,7 @@
|
| Definition* EffectGraphVisitor::BuildStoreTemp(const LocalVariable& local,
|
| Value* value) {
|
| ASSERT(!local.is_captured());
|
| - return new StoreLocalInstr(local, value);
|
| + return new(I) StoreLocalInstr(local, value);
|
| }
|
|
|
|
|
| @@ -747,15 +751,15 @@
|
| intptr_t delta =
|
| owner()->context_level() - local.owner()->context_level();
|
| ASSERT(delta >= 0);
|
| - Value* context = Bind(new CurrentContextInstr());
|
| + Value* context = Bind(new(I) CurrentContextInstr());
|
| while (delta-- > 0) {
|
| - context = Bind(new LoadFieldInstr(
|
| + context = Bind(new(I) LoadFieldInstr(
|
| context, Context::parent_offset(), Type::ZoneHandle(I, Type::null()),
|
| Scanner::kNoSourcePos));
|
| }
|
| - Value* tmp_val = Bind(new LoadLocalInstr(*tmp_var));
|
| + Value* tmp_val = Bind(new(I) LoadLocalInstr(*tmp_var));
|
| StoreInstanceFieldInstr* store =
|
| - new StoreInstanceFieldInstr(Context::variable_offset(local.index()),
|
| + new(I) StoreInstanceFieldInstr(Context::variable_offset(local.index()),
|
| context,
|
| tmp_val,
|
| kEmitStoreBarrier,
|
| @@ -763,37 +767,37 @@
|
| Do(store);
|
| return ExitTempLocalScope(tmp_var);
|
| } else {
|
| - return new StoreLocalInstr(local, value);
|
| + return new(I) StoreLocalInstr(local, value);
|
| }
|
| }
|
|
|
|
|
| Definition* EffectGraphVisitor::BuildLoadLocal(const LocalVariable& local) {
|
| if (local.IsConst()) {
|
| - return new ConstantInstr(*local.ConstValue());
|
| + return new(I) ConstantInstr(*local.ConstValue());
|
| } else if (local.is_captured()) {
|
| intptr_t delta =
|
| owner()->context_level() - local.owner()->context_level();
|
| ASSERT(delta >= 0);
|
| - Value* context = Bind(new CurrentContextInstr());
|
| + Value* context = Bind(new(I) CurrentContextInstr());
|
| while (delta-- > 0) {
|
| - context = Bind(new LoadFieldInstr(
|
| + context = Bind(new(I) LoadFieldInstr(
|
| context, Context::parent_offset(), Type::ZoneHandle(I, Type::null()),
|
| Scanner::kNoSourcePos));
|
| }
|
| - return new LoadFieldInstr(context,
|
| + return new(I) LoadFieldInstr(context,
|
| Context::variable_offset(local.index()),
|
| local.type(),
|
| Scanner::kNoSourcePos);
|
| } else {
|
| - return new LoadLocalInstr(local);
|
| + return new(I) LoadLocalInstr(local);
|
| }
|
| }
|
|
|
|
|
| // Stores current context into the 'variable'
|
| void EffectGraphVisitor::BuildSaveContext(const LocalVariable& variable) {
|
| - Value* context = Bind(new CurrentContextInstr());
|
| + Value* context = Bind(new(I) CurrentContextInstr());
|
| Do(BuildStoreLocal(variable, context));
|
| }
|
|
|
| @@ -801,7 +805,7 @@
|
| // Loads context saved in 'context_variable' into the current context.
|
| void EffectGraphVisitor::BuildRestoreContext(const LocalVariable& variable) {
|
| Value* load_saved_context = Bind(BuildLoadLocal(variable));
|
| - AddInstruction(new StoreContextInstr(load_saved_context));
|
| + AddInstruction(new(I) StoreContextInstr(load_saved_context));
|
| }
|
|
|
|
|
| @@ -811,7 +815,8 @@
|
| ASSERT(!branches.is_empty());
|
| for (intptr_t i = 0; i < branches.length(); i++) {
|
| TargetEntryInstr* target =
|
| - new TargetEntryInstr(owner()->AllocateBlockId(), owner()->try_index());
|
| + new(I) TargetEntryInstr(owner()->AllocateBlockId(),
|
| + owner()->try_index());
|
| *(branches[i]) = target;
|
| target->Goto(join);
|
| }
|
| @@ -834,13 +839,14 @@
|
|
|
| if (branches.length() == 1) {
|
| TargetEntryInstr* target =
|
| - new TargetEntryInstr(owner()->AllocateBlockId(), owner()->try_index());
|
| + new(I) TargetEntryInstr(owner()->AllocateBlockId(),
|
| + owner()->try_index());
|
| *(branches[0]) = target;
|
| return target;
|
| }
|
|
|
| JoinEntryInstr* join =
|
| - new JoinEntryInstr(owner()->AllocateBlockId(), owner()->try_index());
|
| + new(I) JoinEntryInstr(owner()->AllocateBlockId(), owner()->try_index());
|
| ConnectBranchesTo(branches, join);
|
| return join;
|
| }
|
| @@ -858,16 +864,16 @@
|
|
|
| void TestGraphVisitor::ReturnValue(Value* value) {
|
| if (FLAG_enable_type_checks) {
|
| - value = Bind(new AssertBooleanInstr(condition_token_pos(), value));
|
| + value = Bind(new(I) AssertBooleanInstr(condition_token_pos(), value));
|
| }
|
| - Value* constant_true = Bind(new ConstantInstr(Bool::True()));
|
| + Value* constant_true = Bind(new(I) ConstantInstr(Bool::True()));
|
| StrictCompareInstr* comp =
|
| - new StrictCompareInstr(condition_token_pos(),
|
| - Token::kEQ_STRICT,
|
| - value,
|
| - constant_true,
|
| - false); // No number check.
|
| - BranchInstr* branch = new BranchInstr(comp);
|
| + new(I) StrictCompareInstr(condition_token_pos(),
|
| + Token::kEQ_STRICT,
|
| + value,
|
| + constant_true,
|
| + false); // No number check.
|
| + BranchInstr* branch = new(I) BranchInstr(comp);
|
| AddInstruction(branch);
|
| CloseFragment();
|
|
|
| @@ -880,18 +886,18 @@
|
| BranchInstr* branch;
|
| if (Token::IsStrictEqualityOperator(comp->kind())) {
|
| ASSERT(comp->IsStrictCompare());
|
| - branch = new BranchInstr(comp);
|
| + branch = new(I) BranchInstr(comp);
|
| } else if (Token::IsEqualityOperator(comp->kind()) &&
|
| (comp->left()->BindsToConstantNull() ||
|
| comp->right()->BindsToConstantNull())) {
|
| - branch = new BranchInstr(new StrictCompareInstr(
|
| + branch = new(I) BranchInstr(new(I) StrictCompareInstr(
|
| comp->token_pos(),
|
| (comp->kind() == Token::kEQ) ? Token::kEQ_STRICT : Token::kNE_STRICT,
|
| comp->left(),
|
| comp->right(),
|
| false)); // No number check.
|
| } else {
|
| - branch = new BranchInstr(comp);
|
| + branch = new(I) BranchInstr(comp);
|
| branch->set_is_checked(FLAG_enable_type_checks);
|
| }
|
| AddInstruction(branch);
|
| @@ -903,14 +909,14 @@
|
|
|
| void TestGraphVisitor::MergeBranchWithNegate(BooleanNegateInstr* neg) {
|
| ASSERT(!FLAG_enable_type_checks);
|
| - Value* constant_true = Bind(new ConstantInstr(Bool::True()));
|
| + Value* constant_true = Bind(new(I) ConstantInstr(Bool::True()));
|
| StrictCompareInstr* comp =
|
| - new StrictCompareInstr(condition_token_pos(),
|
| + new(I) StrictCompareInstr(condition_token_pos(),
|
| Token::kNE_STRICT,
|
| neg->value(),
|
| constant_true,
|
| false); // No number check.
|
| - BranchInstr* branch = new BranchInstr(comp);
|
| + BranchInstr* branch = new(I) BranchInstr(comp);
|
| AddInstruction(branch);
|
| CloseFragment();
|
| true_successor_addresses_.Add(branch->true_successor_address());
|
| @@ -1009,8 +1015,8 @@
|
| const Function& function = owner()->parsed_function()->function();
|
| if ((node->token_pos() != Scanner::kNoSourcePos) &&
|
| !function.is_native() && FLAG_enable_debugger) {
|
| - AddInstruction(new DebugStepCheckInstr(node->token_pos(),
|
| - PcDescriptors::kRuntimeCall));
|
| + AddInstruction(new(I) DebugStepCheckInstr(node->token_pos(),
|
| + PcDescriptors::kRuntimeCall));
|
| }
|
|
|
| if (FLAG_enable_type_checks) {
|
| @@ -1048,7 +1054,7 @@
|
|
|
| // <Expression> ::= Literal { literal: Instance }
|
| void EffectGraphVisitor::VisitLiteralNode(LiteralNode* node) {
|
| - ReturnDefinition(new ConstantInstr(node->literal()));
|
| + ReturnDefinition(new(I) ConstantInstr(node->literal()));
|
| }
|
|
|
|
|
| @@ -1065,13 +1071,13 @@
|
| // Type may be malbounded, but not malformed.
|
| ASSERT(type.IsFinalized() && !type.IsMalformed());
|
| if (type.IsInstantiated()) {
|
| - ReturnDefinition(new ConstantInstr(type));
|
| + ReturnDefinition(new(I) ConstantInstr(type));
|
| } else {
|
| const Class& instantiator_class = Class::ZoneHandle(
|
| I, owner()->parsed_function()->function().Owner());
|
| Value* instantiator_value = BuildInstantiatorTypeArguments(
|
| node->token_pos(), instantiator_class, NULL);
|
| - ReturnDefinition(new InstantiateTypeInstr(
|
| + ReturnDefinition(new(I) InstantiateTypeInstr(
|
| node->token_pos(), type, instantiator_class, instantiator_value));
|
| }
|
| }
|
| @@ -1136,7 +1142,7 @@
|
| node->type(),
|
| node->dst_name())) {
|
| // Drop the value and 0 additional temporaries.
|
| - checked_value = new DropTempsInstr(0, for_value.value());
|
| + checked_value = new(I) DropTempsInstr(0, for_value.value());
|
| } else {
|
| checked_value = BuildAssertAssignable(node->expr()->token_pos(),
|
| for_value.value(),
|
| @@ -1173,8 +1179,8 @@
|
| ValueGraphVisitor for_right(owner());
|
| node->right()->Visit(&for_right);
|
| Value* right_value = for_right.value();
|
| - for_right.Do(new AssertBooleanInstr(node->right()->token_pos(),
|
| - right_value));
|
| + for_right.Do(new(I) AssertBooleanInstr(node->right()->token_pos(),
|
| + right_value));
|
| if (node->kind() == Token::kAND) {
|
| Join(for_left, for_right, empty);
|
| } else {
|
| @@ -1202,12 +1208,12 @@
|
| PushArgumentInstr* push_right = PushArgument(for_right_value.value());
|
|
|
| ZoneGrowableArray<PushArgumentInstr*>* arguments =
|
| - new ZoneGrowableArray<PushArgumentInstr*>(2);
|
| + new(I) ZoneGrowableArray<PushArgumentInstr*>(2);
|
| arguments->Add(push_left);
|
| arguments->Add(push_right);
|
| const String& name = String::ZoneHandle(I, Symbols::New(node->TokenName()));
|
| const intptr_t kNumArgsChecked = 2;
|
| - InstanceCallInstr* call = new InstanceCallInstr(node->token_pos(),
|
| + InstanceCallInstr* call = new(I) InstanceCallInstr(node->token_pos(),
|
| name,
|
| node->kind(),
|
| arguments,
|
| @@ -1236,27 +1242,28 @@
|
| Value* right_value = for_right.value();
|
| if (FLAG_enable_type_checks) {
|
| right_value =
|
| - for_right.Bind(new AssertBooleanInstr(node->right()->token_pos(),
|
| - right_value));
|
| + for_right.Bind(new(I) AssertBooleanInstr(node->right()->token_pos(),
|
| + right_value));
|
| }
|
| - Value* constant_true = for_right.Bind(new ConstantInstr(Bool::True()));
|
| + Value* constant_true = for_right.Bind(new(I) ConstantInstr(Bool::True()));
|
| Value* compare =
|
| - for_right.Bind(new StrictCompareInstr(node->token_pos(),
|
| - Token::kEQ_STRICT,
|
| - right_value,
|
| - constant_true,
|
| - false)); // No number check.
|
| + for_right.Bind(new(I) StrictCompareInstr(node->token_pos(),
|
| + Token::kEQ_STRICT,
|
| + right_value,
|
| + constant_true,
|
| + false)); // No number check.
|
| for_right.Do(BuildStoreExprTemp(compare));
|
|
|
| if (node->kind() == Token::kAND) {
|
| ValueGraphVisitor for_false(owner());
|
| - Value* constant_false = for_false.Bind(new ConstantInstr(Bool::False()));
|
| + Value* constant_false =
|
| + for_false.Bind(new(I) ConstantInstr(Bool::False()));
|
| for_false.Do(BuildStoreExprTemp(constant_false));
|
| Join(for_test, for_right, for_false);
|
| } else {
|
| ASSERT(node->kind() == Token::kOR);
|
| ValueGraphVisitor for_true(owner());
|
| - Value* constant_true = for_true.Bind(new ConstantInstr(Bool::True()));
|
| + Value* constant_true = for_true.Bind(new(I) ConstantInstr(Bool::True()));
|
| for_true.Do(BuildStoreExprTemp(constant_true));
|
| Join(for_test, for_true, for_right);
|
| }
|
| @@ -1293,18 +1300,18 @@
|
| Append(for_right_value);
|
| PushArgumentInstr* push_right = PushArgument(for_right_value.value());
|
|
|
| - Value* mask_value = Bind(new ConstantInstr(
|
| + Value* mask_value = Bind(new(I) ConstantInstr(
|
| Integer::ZoneHandle(I, Integer::New(node->mask32(), Heap::kOld))));
|
| PushArgumentInstr* push_mask = PushArgument(mask_value);
|
|
|
| ZoneGrowableArray<PushArgumentInstr*>* arguments =
|
| - new ZoneGrowableArray<PushArgumentInstr*>(3);
|
| + new(I) ZoneGrowableArray<PushArgumentInstr*>(3);
|
| arguments->Add(push_left);
|
| arguments->Add(push_right);
|
| // Call to special method 'BinaryOpAndMaskName(node)'.
|
| arguments->Add(push_mask);
|
| const intptr_t kNumArgsChecked = 2;
|
| - InstanceCallInstr* call = new InstanceCallInstr(node->token_pos(),
|
| + InstanceCallInstr* call = new(I) InstanceCallInstr(node->token_pos(),
|
| BinaryOpAndMaskName(node),
|
| Token::kILLEGAL,
|
| arguments,
|
| @@ -1372,7 +1379,7 @@
|
|
|
|
|
| Value* EffectGraphVisitor::BuildNullValue() {
|
| - return Bind(new ConstantInstr(Object::ZoneHandle(I, Object::null())));
|
| + return Bind(new(I) ConstantInstr(Object::ZoneHandle(I, Object::null())));
|
| }
|
|
|
|
|
| @@ -1393,12 +1400,12 @@
|
| &instantiator,
|
| &instantiator_type_arguments);
|
| }
|
| - return new AssertAssignableInstr(token_pos,
|
| - value,
|
| - instantiator,
|
| - instantiator_type_arguments,
|
| - dst_type,
|
| - dst_name);
|
| + return new(I) AssertAssignableInstr(token_pos,
|
| + value,
|
| + instantiator,
|
| + instantiator_type_arguments,
|
| + dst_type,
|
| + dst_name);
|
| }
|
|
|
|
|
| @@ -1450,7 +1457,7 @@
|
| EffectGraphVisitor for_left_value(owner());
|
| node->left()->Visit(&for_left_value);
|
| Append(for_left_value);
|
| - ReturnDefinition(new ConstantInstr(Bool::Get(!negate_result)));
|
| + ReturnDefinition(new(I) ConstantInstr(Bool::Get(!negate_result)));
|
| return;
|
| }
|
| ValueGraphVisitor for_left_value(owner());
|
| @@ -1468,19 +1475,19 @@
|
| &push_type_args);
|
| }
|
| ZoneGrowableArray<PushArgumentInstr*>* arguments =
|
| - new ZoneGrowableArray<PushArgumentInstr*>(5);
|
| + new(I) ZoneGrowableArray<PushArgumentInstr*>(5);
|
| arguments->Add(push_left);
|
| arguments->Add(push_instantiator);
|
| arguments->Add(push_type_args);
|
| ASSERT(!node->right()->AsTypeNode()->type().IsNull());
|
| Value* type_arg = Bind(
|
| - new ConstantInstr(node->right()->AsTypeNode()->type()));
|
| + new(I) ConstantInstr(node->right()->AsTypeNode()->type()));
|
| arguments->Add(PushArgument(type_arg));
|
| const Bool& negate = Bool::Get(node->kind() == Token::kISNOT);
|
| - Value* negate_arg = Bind(new ConstantInstr(negate));
|
| + Value* negate_arg = Bind(new(I) ConstantInstr(negate));
|
| arguments->Add(PushArgument(negate_arg));
|
| const intptr_t kNumArgsChecked = 1;
|
| - InstanceCallInstr* call = new InstanceCallInstr(
|
| + InstanceCallInstr* call = new(I) InstanceCallInstr(
|
| node->token_pos(),
|
| Library::PrivateCoreLibName(Symbols::_instanceOf()),
|
| node->kind(),
|
| @@ -1526,14 +1533,14 @@
|
| &push_type_args);
|
| }
|
| ZoneGrowableArray<PushArgumentInstr*>* arguments =
|
| - new ZoneGrowableArray<PushArgumentInstr*>(4);
|
| + new(I) ZoneGrowableArray<PushArgumentInstr*>(4);
|
| arguments->Add(push_left);
|
| arguments->Add(push_instantiator);
|
| arguments->Add(push_type_args);
|
| - Value* type_arg = Bind(new ConstantInstr(type));
|
| + Value* type_arg = Bind(new(I) ConstantInstr(type));
|
| arguments->Add(PushArgument(type_arg));
|
| const intptr_t kNumArgsChecked = 1;
|
| - InstanceCallInstr* call = new InstanceCallInstr(
|
| + InstanceCallInstr* call = new(I) InstanceCallInstr(
|
| node->token_pos(),
|
| Library::PrivateCoreLibName(Symbols::_as()),
|
| node->kind(),
|
| @@ -1555,7 +1562,7 @@
|
| ValueGraphVisitor for_right_value(owner());
|
| right->Visit(&for_right_value);
|
| Append(for_right_value);
|
| - StrictCompareInstr* comp = new StrictCompareInstr(token_pos,
|
| + StrictCompareInstr* comp = new(I) StrictCompareInstr(token_pos,
|
| kind,
|
| for_left_value.value(),
|
| for_right_value.value(),
|
| @@ -1567,7 +1574,6 @@
|
| // <Expression> :: Comparison { kind: Token::Kind
|
| // left: <Expression>
|
| // right: <Expression> }
|
| -// TODO(srdjan): Implement new equality.
|
| void EffectGraphVisitor::VisitComparisonNode(ComparisonNode* node) {
|
| if (Token::IsTypeTestOperator(node->kind())) {
|
| BuildTypeTest(node);
|
| @@ -1601,7 +1607,7 @@
|
| }
|
|
|
| ZoneGrowableArray<PushArgumentInstr*>* arguments =
|
| - new ZoneGrowableArray<PushArgumentInstr*>(2);
|
| + new(I) ZoneGrowableArray<PushArgumentInstr*>(2);
|
|
|
| ValueGraphVisitor for_left_value(owner());
|
| node->left()->Visit(&for_left_value);
|
| @@ -1616,8 +1622,8 @@
|
| arguments->Add(push_right);
|
|
|
| Definition* result =
|
| - new InstanceCallInstr(node->token_pos(),
|
| - Symbols::EqualOperator(),
|
| + new(I) InstanceCallInstr(node->token_pos(),
|
| + Symbols::EqualOperator(),
|
| Token::kEQ, // Result is negated later for kNE.
|
| arguments,
|
| Object::null_array(),
|
| @@ -1626,17 +1632,17 @@
|
| if (node->kind() == Token::kNE) {
|
| if (FLAG_enable_type_checks) {
|
| Value* value = Bind(result);
|
| - result = new AssertBooleanInstr(node->token_pos(), value);
|
| + result = new(I) AssertBooleanInstr(node->token_pos(), value);
|
| }
|
| Value* value = Bind(result);
|
| - result = new BooleanNegateInstr(value);
|
| + result = new(I) BooleanNegateInstr(value);
|
| }
|
| ReturnDefinition(result);
|
| return;
|
| }
|
|
|
| ZoneGrowableArray<PushArgumentInstr*>* arguments =
|
| - new ZoneGrowableArray<PushArgumentInstr*>(2);
|
| + new(I) ZoneGrowableArray<PushArgumentInstr*>(2);
|
|
|
| ValueGraphVisitor for_left_value(owner());
|
| node->left()->Visit(&for_left_value);
|
| @@ -1652,7 +1658,7 @@
|
|
|
| ASSERT(Token::IsRelationalOperator(node->kind()));
|
| InstanceCallInstr* comp =
|
| - new InstanceCallInstr(node->token_pos(),
|
| + new(I) InstanceCallInstr(node->token_pos(),
|
| String::ZoneHandle(
|
| I, Symbols::New(node->TokenName())),
|
| node->kind(),
|
| @@ -1673,9 +1679,9 @@
|
| Value* value = for_value.value();
|
| if (FLAG_enable_type_checks) {
|
| value =
|
| - Bind(new AssertBooleanInstr(node->operand()->token_pos(), value));
|
| + Bind(new(I) AssertBooleanInstr(node->operand()->token_pos(), value));
|
| }
|
| - BooleanNegateInstr* negate = new BooleanNegateInstr(value);
|
| + BooleanNegateInstr* negate = new(I) BooleanNegateInstr(value);
|
| ReturnDefinition(negate);
|
| return;
|
| }
|
| @@ -1685,10 +1691,10 @@
|
| Append(for_value);
|
| PushArgumentInstr* push_value = PushArgument(for_value.value());
|
| ZoneGrowableArray<PushArgumentInstr*>* arguments =
|
| - new ZoneGrowableArray<PushArgumentInstr*>(1);
|
| + new(I) ZoneGrowableArray<PushArgumentInstr*>(1);
|
| arguments->Add(push_value);
|
| InstanceCallInstr* call =
|
| - new InstanceCallInstr(node->token_pos(),
|
| + new(I) InstanceCallInstr(node->token_pos(),
|
| String::ZoneHandle(
|
| I, Symbols::New(node->TokenName())),
|
| node->kind(),
|
| @@ -1791,8 +1797,8 @@
|
| // Compute the start of the statements fragment.
|
| JoinEntryInstr* statement_start = NULL;
|
| if (node->label() == NULL) {
|
| - statement_start = new JoinEntryInstr(owner()->AllocateBlockId(),
|
| - owner()->try_index());
|
| + statement_start = new(I) JoinEntryInstr(owner()->AllocateBlockId(),
|
| + owner()->try_index());
|
| } else {
|
| // The case nodes are nested inside a SequenceNode that is the body of a
|
| // SwitchNode. The SwitchNode on the nesting stack contains the
|
| @@ -1843,8 +1849,8 @@
|
| exit_instruction = statement_exit;
|
| } else {
|
| if (statement_exit != NULL) {
|
| - JoinEntryInstr* join = new JoinEntryInstr(owner()->AllocateBlockId(),
|
| - owner()->try_index());
|
| + JoinEntryInstr* join = new(I) JoinEntryInstr(owner()->AllocateBlockId(),
|
| + owner()->try_index());
|
| statement_exit->Goto(join);
|
| next_target->Goto(join);
|
| exit_instruction = join;
|
| @@ -1921,19 +1927,19 @@
|
|
|
| // Tie do-while loop (test is after the body).
|
| JoinEntryInstr* body_entry_join =
|
| - new JoinEntryInstr(owner()->AllocateBlockId(),
|
| - owner()->try_index());
|
| + new(I) JoinEntryInstr(owner()->AllocateBlockId(),
|
| + owner()->try_index());
|
| Goto(body_entry_join);
|
| Instruction* body_exit = AppendFragment(body_entry_join, for_body);
|
|
|
| JoinEntryInstr* join = nested_loop.continue_target();
|
| if ((body_exit != NULL) || (join != NULL)) {
|
| if (join == NULL) {
|
| - join = new JoinEntryInstr(owner()->AllocateBlockId(),
|
| - owner()->try_index());
|
| + join = new(I) JoinEntryInstr(owner()->AllocateBlockId(),
|
| + owner()->try_index());
|
| }
|
| - CheckStackOverflowInstr* check =
|
| - new CheckStackOverflowInstr(node->token_pos(), owner()->loop_depth());
|
| + CheckStackOverflowInstr* check = new(I) CheckStackOverflowInstr(
|
| + node->token_pos(), owner()->loop_depth());
|
| join->LinkTo(check);
|
| check->LinkTo(for_test.entry());
|
| if (body_exit != NULL) {
|
| @@ -1982,7 +1988,7 @@
|
| JoinEntryInstr* continue_join = nested_loop.continue_target();
|
| if ((continue_join != NULL) || for_body.is_open()) {
|
| JoinEntryInstr* loop_entry =
|
| - new JoinEntryInstr(owner()->AllocateBlockId(), owner()->try_index());
|
| + new(I) JoinEntryInstr(owner()->AllocateBlockId(), owner()->try_index());
|
| if (continue_join != NULL) {
|
| if (for_body.is_open()) for_body.Goto(continue_join);
|
| Instruction* current = AppendFragment(continue_join, for_increment);
|
| @@ -1994,7 +2000,8 @@
|
| Goto(loop_entry);
|
| exit_ = loop_entry;
|
| AddInstruction(
|
| - new CheckStackOverflowInstr(node->token_pos(), owner()->loop_depth()));
|
| + new(I) CheckStackOverflowInstr(node->token_pos(),
|
| + owner()->loop_depth()));
|
| }
|
|
|
| if (node->condition() == NULL) {
|
| @@ -2082,7 +2089,7 @@
|
|
|
|
|
| LocalVariable* EffectGraphVisitor::EnterTempLocalScope(Value* value) {
|
| - Do(new PushTempInstr(value));
|
| + Do(new(I) PushTempInstr(value));
|
| owner()->AllocateTemp();
|
|
|
| ASSERT(value->definition()->temp_index() == (owner()->temp_count() - 1));
|
| @@ -2090,19 +2097,19 @@
|
| char name[64];
|
| OS::SNPrint(name, 64, ":tmp_local%" Pd, index);
|
| LocalVariable* var =
|
| - new LocalVariable(0,
|
| - String::ZoneHandle(I, Symbols::New(name)),
|
| - *value->Type()->ToAbstractType());
|
| + new(I) LocalVariable(0,
|
| + String::ZoneHandle(I, Symbols::New(name)),
|
| + *value->Type()->ToAbstractType());
|
| var->set_index(index);
|
| return var;
|
| }
|
|
|
|
|
| Definition* EffectGraphVisitor::ExitTempLocalScope(LocalVariable* var) {
|
| - Value* tmp = Bind(new LoadLocalInstr(*var));
|
| + Value* tmp = Bind(new(I) LoadLocalInstr(*var));
|
| owner()->DeallocateTemps(1);
|
| ASSERT(GetCurrentTempLocalIndex() == var->index());
|
| - return new DropTempsInstr(1, tmp);
|
| + return new(I) DropTempsInstr(1, tmp);
|
| }
|
|
|
|
|
| @@ -2114,7 +2121,7 @@
|
| Append(for_value);
|
| Value* temp_val = for_value.value();
|
| node->TempAt(i)->set_index(GetCurrentTempLocalIndex());
|
| - Do(new PushTempInstr(temp_val));
|
| + Do(new(I) PushTempInstr(temp_val));
|
| owner()->AllocateTemp();
|
| }
|
| }
|
| @@ -2133,7 +2140,7 @@
|
| intptr_t num_temps = node->num_temps();
|
| if (num_temps > 0) {
|
| owner()->DeallocateTemps(num_temps);
|
| - Do(new DropTempsInstr(num_temps));
|
| + Do(new(I) DropTempsInstr(num_temps));
|
| }
|
| }
|
|
|
| @@ -2156,7 +2163,7 @@
|
| intptr_t num_temps = node->num_temps();
|
| if (num_temps > 0) {
|
| owner()->DeallocateTemps(num_temps);
|
| - ReturnDefinition(new DropTempsInstr(num_temps, result_value));
|
| + ReturnDefinition(new(I) DropTempsInstr(num_temps, result_value));
|
| } else {
|
| ReturnValue(result_value);
|
| }
|
| @@ -2169,18 +2176,19 @@
|
| Value* element_type = BuildInstantiatedTypeArguments(node->token_pos(),
|
| type_args);
|
| Value* num_elements =
|
| - Bind(new ConstantInstr(Smi::ZoneHandle(I, Smi::New(node->length()))));
|
| - CreateArrayInstr* create = new CreateArrayInstr(node->token_pos(),
|
| - element_type,
|
| - num_elements);
|
| + Bind(new(I) ConstantInstr(Smi::ZoneHandle(I, Smi::New(node->length()))));
|
| + CreateArrayInstr* create = new(I) CreateArrayInstr(node->token_pos(),
|
| + element_type,
|
| + num_elements);
|
| Value* array_val = Bind(create);
|
|
|
| { LocalVariable* tmp_var = EnterTempLocalScope(array_val);
|
| const intptr_t class_id = kArrayCid;
|
| const intptr_t deopt_id = Isolate::kNoDeoptId;
|
| for (int i = 0; i < node->length(); ++i) {
|
| - Value* array = Bind(new LoadLocalInstr(*tmp_var));
|
| - Value* index = Bind(new ConstantInstr(Smi::ZoneHandle(I, Smi::New(i))));
|
| + Value* array = Bind(new(I) LoadLocalInstr(*tmp_var));
|
| + Value* index =
|
| + Bind(new(I) ConstantInstr(Smi::ZoneHandle(I, Smi::New(i))));
|
| ValueGraphVisitor for_value(owner());
|
| node->ElementAt(i)->Visit(&for_value);
|
| Append(for_value);
|
| @@ -2190,7 +2198,7 @@
|
| ? kNoStoreBarrier
|
| : kEmitStoreBarrier;
|
| const intptr_t index_scale = Instance::ElementSizeFor(class_id);
|
| - StoreIndexedInstr* store = new StoreIndexedInstr(
|
| + StoreIndexedInstr* store = new(I) StoreIndexedInstr(
|
| array, index, for_value.value(), emit_store_barrier,
|
| index_scale, class_id, deopt_id, node->token_pos());
|
| Do(store);
|
| @@ -2206,7 +2214,7 @@
|
| node->value()->Visit(&for_argument);
|
| Append(for_argument);
|
| StringInterpolateInstr* instr =
|
| - new StringInterpolateInstr(for_argument.value(), node->token_pos());
|
| + new(I) StringInterpolateInstr(for_argument.value(), node->token_pos());
|
| ReturnDefinition(instr);
|
| }
|
|
|
| @@ -2217,7 +2225,7 @@
|
| if (function.IsImplicitStaticClosureFunction()) {
|
| const Instance& closure =
|
| Instance::ZoneHandle(I, function.ImplicitStaticClosure());
|
| - ReturnDefinition(new ConstantInstr(closure));
|
| + ReturnDefinition(new(I) ConstantInstr(closure));
|
| return;
|
| }
|
| const bool is_implicit = function.IsImplicitInstanceClosureFunction();
|
| @@ -2254,7 +2262,7 @@
|
| }
|
| }
|
| ZoneGrowableArray<PushArgumentInstr*>* arguments =
|
| - new ZoneGrowableArray<PushArgumentInstr*>(1);
|
| + new(I) ZoneGrowableArray<PushArgumentInstr*>(1);
|
| ASSERT(function.context_scope() != ContextScope::null());
|
|
|
| // The function type of a closure may have type arguments. In that case,
|
| @@ -2274,59 +2282,59 @@
|
| NULL);
|
| arguments->Add(PushArgument(type_arguments));
|
| }
|
| - AllocateObjectInstr* alloc = new AllocateObjectInstr(node->token_pos(),
|
| - cls,
|
| - arguments);
|
| + AllocateObjectInstr* alloc = new(I) AllocateObjectInstr(node->token_pos(),
|
| + cls,
|
| + arguments);
|
| alloc->set_closure_function(function);
|
|
|
| Value* closure_val = Bind(alloc);
|
| { LocalVariable* closure_tmp_var = EnterTempLocalScope(closure_val);
|
| // Store function.
|
| - Value* closure_tmp_val = Bind(new LoadLocalInstr(*closure_tmp_var));
|
| + Value* closure_tmp_val = Bind(new(I) LoadLocalInstr(*closure_tmp_var));
|
| Value* func_val =
|
| - Bind(new ConstantInstr(Function::ZoneHandle(I, function.raw())));
|
| - Do(new StoreInstanceFieldInstr(Closure::function_offset(),
|
| - closure_tmp_val,
|
| - func_val,
|
| - kEmitStoreBarrier,
|
| - node->token_pos()));
|
| + Bind(new(I) ConstantInstr(Function::ZoneHandle(I, function.raw())));
|
| + Do(new(I) StoreInstanceFieldInstr(Closure::function_offset(),
|
| + closure_tmp_val,
|
| + func_val,
|
| + kEmitStoreBarrier,
|
| + node->token_pos()));
|
| if (is_implicit) {
|
| // Create new context containing the receiver.
|
| const intptr_t kNumContextVariables = 1; // The receiver.
|
| Value* allocated_context =
|
| - Bind(new AllocateContextInstr(node->token_pos(),
|
| - kNumContextVariables));
|
| + Bind(new(I) AllocateContextInstr(node->token_pos(),
|
| + kNumContextVariables));
|
| { LocalVariable* context_tmp_var = EnterTempLocalScope(allocated_context);
|
| // Store receiver in context.
|
| - Value* context_tmp_val = Bind(new LoadLocalInstr(*context_tmp_var));
|
| + Value* context_tmp_val = Bind(new(I) LoadLocalInstr(*context_tmp_var));
|
| ValueGraphVisitor for_receiver(owner());
|
| node->receiver()->Visit(&for_receiver);
|
| Append(for_receiver);
|
| Value* receiver = for_receiver.value();
|
| - Do(new StoreInstanceFieldInstr(Context::variable_offset(0),
|
| - context_tmp_val,
|
| - receiver,
|
| - kEmitStoreBarrier,
|
| - node->token_pos()));
|
| + Do(new(I) StoreInstanceFieldInstr(Context::variable_offset(0),
|
| + context_tmp_val,
|
| + receiver,
|
| + kEmitStoreBarrier,
|
| + node->token_pos()));
|
| // Store new context in closure.
|
| - closure_tmp_val = Bind(new LoadLocalInstr(*closure_tmp_var));
|
| - context_tmp_val = Bind(new LoadLocalInstr(*context_tmp_var));
|
| - Do(new StoreInstanceFieldInstr(Closure::context_offset(),
|
| - closure_tmp_val,
|
| - context_tmp_val,
|
| - kEmitStoreBarrier,
|
| - node->token_pos()));
|
| + closure_tmp_val = Bind(new(I) LoadLocalInstr(*closure_tmp_var));
|
| + context_tmp_val = Bind(new(I) LoadLocalInstr(*context_tmp_var));
|
| + Do(new(I) StoreInstanceFieldInstr(Closure::context_offset(),
|
| + closure_tmp_val,
|
| + context_tmp_val,
|
| + kEmitStoreBarrier,
|
| + node->token_pos()));
|
| Do(ExitTempLocalScope(context_tmp_var));
|
| }
|
| } else {
|
| // Store current context in closure.
|
| - closure_tmp_val = Bind(new LoadLocalInstr(*closure_tmp_var));
|
| - Value* context = Bind(new CurrentContextInstr());
|
| - Do(new StoreInstanceFieldInstr(Closure::context_offset(),
|
| - closure_tmp_val,
|
| - context,
|
| - kEmitStoreBarrier,
|
| - node->token_pos()));
|
| + closure_tmp_val = Bind(new(I) LoadLocalInstr(*closure_tmp_var));
|
| + Value* context = Bind(new(I) CurrentContextInstr());
|
| + Do(new(I) StoreInstanceFieldInstr(Closure::context_offset(),
|
| + closure_tmp_val,
|
| + context,
|
| + kEmitStoreBarrier,
|
| + node->token_pos()));
|
| }
|
| ReturnDefinition(ExitTempLocalScope(closure_tmp_var));
|
| }
|
| @@ -2352,12 +2360,12 @@
|
| Append(for_receiver);
|
| PushArgumentInstr* push_receiver = PushArgument(for_receiver.value());
|
| ZoneGrowableArray<PushArgumentInstr*>* arguments =
|
| - new ZoneGrowableArray<PushArgumentInstr*>(
|
| + new(I) ZoneGrowableArray<PushArgumentInstr*>(
|
| node->arguments()->length() + 1);
|
| arguments->Add(push_receiver);
|
|
|
| BuildPushArguments(*node->arguments(), arguments);
|
| - InstanceCallInstr* call = new InstanceCallInstr(
|
| + InstanceCallInstr* call = new(I) InstanceCallInstr(
|
| node->token_pos(),
|
| node->function_name(),
|
| Token::kILLEGAL,
|
| @@ -2403,10 +2411,10 @@
|
| // arguments: <ArgumentList> }
|
| void EffectGraphVisitor::VisitStaticCallNode(StaticCallNode* node) {
|
| ZoneGrowableArray<PushArgumentInstr*>* arguments =
|
| - new ZoneGrowableArray<PushArgumentInstr*>(node->arguments()->length());
|
| + new(I) ZoneGrowableArray<PushArgumentInstr*>(node->arguments()->length());
|
| BuildPushArguments(*node->arguments(), arguments);
|
| StaticCallInstr* call =
|
| - new StaticCallInstr(node->token_pos(),
|
| + new(I) StaticCallInstr(node->token_pos(),
|
| node->function(),
|
| node->arguments()->names(),
|
| arguments,
|
| @@ -2431,8 +2439,8 @@
|
| LocalVariable* tmp_var = EnterTempLocalScope(for_closure.value());
|
|
|
| ZoneGrowableArray<PushArgumentInstr*>* arguments =
|
| - new ZoneGrowableArray<PushArgumentInstr*>(node->arguments()->length());
|
| - Value* closure_val = Bind(new LoadLocalInstr(*tmp_var));
|
| + new(I) ZoneGrowableArray<PushArgumentInstr*>(node->arguments()->length());
|
| + Value* closure_val = Bind(new(I) LoadLocalInstr(*tmp_var));
|
| PushArgumentInstr* push_closure = PushArgument(closure_val);
|
| arguments->Add(push_closure);
|
| BuildPushArguments(*node->arguments(), arguments);
|
| @@ -2440,17 +2448,17 @@
|
| // Save context around the call.
|
| ASSERT(owner()->parsed_function()->saved_current_context_var() != NULL);
|
| BuildSaveContext(*owner()->parsed_function()->saved_current_context_var());
|
| - closure_val = Bind(new LoadLocalInstr(*tmp_var));
|
| - LoadFieldInstr* context_load = new LoadFieldInstr(
|
| + closure_val = Bind(new(I) LoadLocalInstr(*tmp_var));
|
| + LoadFieldInstr* context_load = new(I) LoadFieldInstr(
|
| closure_val,
|
| Closure::context_offset(),
|
| AbstractType::ZoneHandle(I, AbstractType::null()),
|
| node->token_pos());
|
| context_load->set_is_immutable(true);
|
| Value* context_val = Bind(context_load);
|
| - AddInstruction(new StoreContextInstr(context_val));
|
| - closure_val = Bind(new LoadLocalInstr(*tmp_var));
|
| - LoadFieldInstr* function_load = new LoadFieldInstr(
|
| + AddInstruction(new(I) StoreContextInstr(context_val));
|
| + closure_val = Bind(new(I) LoadLocalInstr(*tmp_var));
|
| + LoadFieldInstr* function_load = new(I) LoadFieldInstr(
|
| closure_val,
|
| Closure::function_offset(),
|
| AbstractType::ZoneHandle(I, AbstractType::null()),
|
| @@ -2458,10 +2466,10 @@
|
| function_load->set_is_immutable(true);
|
| Value* function_val = Bind(function_load);
|
| Definition* closure_call =
|
| - new ClosureCallInstr(function_val, node, arguments);
|
| + new(I) ClosureCallInstr(function_val, node, arguments);
|
| if (result_needed) {
|
| Value* result = Bind(closure_call);
|
| - Do(new StoreLocalInstr(*tmp_var, result));
|
| + Do(new(I) StoreLocalInstr(*tmp_var, result));
|
| // Restore context from temp.
|
| BuildRestoreContext(
|
| *owner()->parsed_function()->saved_current_context_var());
|
| @@ -2487,9 +2495,9 @@
|
|
|
|
|
| void EffectGraphVisitor::VisitCloneContextNode(CloneContextNode* node) {
|
| - Value* context = Bind(new CurrentContextInstr());
|
| - Value* clone = Bind(new CloneContextInstr(node->token_pos(), context));
|
| - AddInstruction(new StoreContextInstr(clone));
|
| + Value* context = Bind(new(I) CurrentContextInstr());
|
| + Value* clone = Bind(new(I) CloneContextInstr(node->token_pos(), context));
|
| + AddInstruction(new(I) StoreContextInstr(clone));
|
| }
|
|
|
|
|
| @@ -2498,14 +2506,15 @@
|
| const bool cls_is_parameterized = cls.NumTypeArguments() > 0;
|
|
|
| ZoneGrowableArray<PushArgumentInstr*>* allocate_arguments =
|
| - new ZoneGrowableArray<PushArgumentInstr*>(cls_is_parameterized ? 1 : 0);
|
| + new(I) ZoneGrowableArray<PushArgumentInstr*>(
|
| + cls_is_parameterized ? 1 : 0);
|
| if (cls_is_parameterized) {
|
| Value* type_args = BuildInstantiatedTypeArguments(node->token_pos(),
|
| node->type_arguments());
|
| allocate_arguments->Add(PushArgument(type_args));
|
| }
|
|
|
| - Definition* allocation = new AllocateObjectInstr(
|
| + Definition* allocation = new(I) AllocateObjectInstr(
|
| node->token_pos(),
|
| Class::ZoneHandle(I, node->constructor().Owner()),
|
| allocate_arguments);
|
| @@ -2517,17 +2526,17 @@
|
| void EffectGraphVisitor::BuildConstructorCall(
|
| ConstructorCallNode* node,
|
| PushArgumentInstr* push_alloc_value) {
|
| - Value* ctor_arg = Bind(
|
| - new ConstantInstr(Smi::ZoneHandle(I, Smi::New(Function::kCtorPhaseAll))));
|
| + Value* ctor_arg = Bind(new(I) ConstantInstr(
|
| + Smi::ZoneHandle(I, Smi::New(Function::kCtorPhaseAll))));
|
| PushArgumentInstr* push_ctor_arg = PushArgument(ctor_arg);
|
|
|
| ZoneGrowableArray<PushArgumentInstr*>* arguments =
|
| - new ZoneGrowableArray<PushArgumentInstr*>(2);
|
| + new(I) ZoneGrowableArray<PushArgumentInstr*>(2);
|
| arguments->Add(push_alloc_value);
|
| arguments->Add(push_ctor_arg);
|
|
|
| BuildPushArguments(*node->arguments(), arguments);
|
| - Do(new StaticCallInstr(node->token_pos(),
|
| + Do(new(I) StaticCallInstr(node->token_pos(),
|
| node->constructor(),
|
| node->arguments()->names(),
|
| arguments,
|
| @@ -2562,7 +2571,7 @@
|
| void EffectGraphVisitor::VisitConstructorCallNode(ConstructorCallNode* node) {
|
| if (node->constructor().IsFactory()) {
|
| ZoneGrowableArray<PushArgumentInstr*>* arguments =
|
| - new ZoneGrowableArray<PushArgumentInstr*>();
|
| + new(I) ZoneGrowableArray<PushArgumentInstr*>();
|
| PushArgumentInstr* push_type_arguments = PushArgument(
|
| BuildInstantiatedTypeArguments(node->token_pos(),
|
| node->type_arguments()));
|
| @@ -2570,7 +2579,7 @@
|
| ASSERT(arguments->length() == 1);
|
| BuildPushArguments(*node->arguments(), arguments);
|
| StaticCallInstr* call =
|
| - new StaticCallInstr(node->token_pos(),
|
| + new(I) StaticCallInstr(node->token_pos(),
|
| node->constructor(),
|
| node->arguments()->names(),
|
| arguments,
|
| @@ -2636,7 +2645,7 @@
|
| ASSERT(!type.IsMalformedOrMalbounded());
|
| type_arguments = type.arguments();
|
| type_arguments = type_arguments.Canonicalize();
|
| - return Bind(new ConstantInstr(type_arguments));
|
| + return Bind(new(I) ConstantInstr(type_arguments));
|
| }
|
| Function& outer_function =
|
| Function::Handle(I, owner()->parsed_function()->function().raw());
|
| @@ -2662,7 +2671,7 @@
|
| instantiator_class.type_arguments_field_offset();
|
| ASSERT(type_arguments_field_offset != Class::kNoTypeArguments);
|
|
|
| - return Bind(new LoadFieldInstr(
|
| + return Bind(new(I) LoadFieldInstr(
|
| instantiator,
|
| type_arguments_field_offset,
|
| Type::ZoneHandle(I, Type::null()), // Not an instance, no type.
|
| @@ -2674,7 +2683,7 @@
|
| intptr_t token_pos,
|
| const TypeArguments& type_arguments) {
|
| if (type_arguments.IsNull() || type_arguments.IsInstantiated()) {
|
| - return Bind(new ConstantInstr(type_arguments));
|
| + return Bind(new(I) ConstantInstr(type_arguments));
|
| }
|
| // The type arguments are uninstantiated.
|
| const Class& instantiator_class = Class::ZoneHandle(
|
| @@ -2687,7 +2696,7 @@
|
| if (use_instantiator_type_args) {
|
| return instantiator_value;
|
| } else {
|
| - return Bind(new InstantiateTypeArgumentsInstr(token_pos,
|
| + return Bind(new(I) InstantiateTypeArgumentsInstr(token_pos,
|
| type_arguments,
|
| instantiator_class,
|
| instantiator_value));
|
| @@ -2711,7 +2720,7 @@
|
|
|
| Value* allocate = BuildObjectAllocation(node);
|
| { LocalVariable* tmp_var = EnterTempLocalScope(allocate);
|
| - Value* allocated_tmp = Bind(new LoadLocalInstr(*tmp_var));
|
| + Value* allocated_tmp = Bind(new(I) LoadLocalInstr(*tmp_var));
|
| PushArgumentInstr* push_allocated_value = PushArgument(allocated_tmp);
|
| BuildConstructorCall(node, push_allocated_value);
|
| ReturnDefinition(ExitTempLocalScope(tmp_var));
|
| @@ -2725,11 +2734,11 @@
|
| Append(for_receiver);
|
| PushArgumentInstr* push_receiver = PushArgument(for_receiver.value());
|
| ZoneGrowableArray<PushArgumentInstr*>* arguments =
|
| - new ZoneGrowableArray<PushArgumentInstr*>(1);
|
| + new(I) ZoneGrowableArray<PushArgumentInstr*>(1);
|
| arguments->Add(push_receiver);
|
| const String& name =
|
| String::ZoneHandle(I, Field::GetterSymbol(node->field_name()));
|
| - InstanceCallInstr* call = new InstanceCallInstr(
|
| + InstanceCallInstr* call = new(I) InstanceCallInstr(
|
| node->token_pos(),
|
| name,
|
| Token::kGET,
|
| @@ -2765,34 +2774,34 @@
|
|
|
| void EffectGraphVisitor::VisitInstanceSetterNode(InstanceSetterNode* node) {
|
| ZoneGrowableArray<PushArgumentInstr*>* arguments =
|
| - new ZoneGrowableArray<PushArgumentInstr*>(2);
|
| + new(I) ZoneGrowableArray<PushArgumentInstr*>(2);
|
| BuildInstanceSetterArguments(node, arguments, kResultNotNeeded);
|
| const String& name =
|
| String::ZoneHandle(I, Field::SetterSymbol(node->field_name()));
|
| - InstanceCallInstr* call = new InstanceCallInstr(node->token_pos(),
|
| - name,
|
| - Token::kSET,
|
| - arguments,
|
| - Object::null_array(),
|
| - 2, // Checked arg count.
|
| - owner()->ic_data_array());
|
| + InstanceCallInstr* call = new(I) InstanceCallInstr(node->token_pos(),
|
| + name,
|
| + Token::kSET,
|
| + arguments,
|
| + Object::null_array(),
|
| + 2, // Checked arg count.
|
| + owner()->ic_data_array());
|
| ReturnDefinition(call);
|
| }
|
|
|
|
|
| void ValueGraphVisitor::VisitInstanceSetterNode(InstanceSetterNode* node) {
|
| ZoneGrowableArray<PushArgumentInstr*>* arguments =
|
| - new ZoneGrowableArray<PushArgumentInstr*>(2);
|
| + new(I) ZoneGrowableArray<PushArgumentInstr*>(2);
|
| BuildInstanceSetterArguments(node, arguments, kResultNeeded);
|
| const String& name =
|
| String::ZoneHandle(I, Field::SetterSymbol(node->field_name()));
|
| - Do(new InstanceCallInstr(node->token_pos(),
|
| - name,
|
| - Token::kSET,
|
| - arguments,
|
| - Object::null_array(),
|
| - 2, // Checked argument count.
|
| - owner()->ic_data_array()));
|
| + Do(new(I) InstanceCallInstr(node->token_pos(),
|
| + name,
|
| + Token::kSET,
|
| + arguments,
|
| + Object::null_array(),
|
| + 2, // Checked argument count.
|
| + owner()->ic_data_array()));
|
| ReturnDefinition(BuildLoadExprTemp());
|
| }
|
|
|
| @@ -2801,7 +2810,7 @@
|
| const String& getter_name =
|
| String::ZoneHandle(I, Field::GetterSymbol(node->field_name()));
|
| ZoneGrowableArray<PushArgumentInstr*>* arguments =
|
| - new ZoneGrowableArray<PushArgumentInstr*>();
|
| + new(I) ZoneGrowableArray<PushArgumentInstr*>();
|
| Function& getter_function = Function::ZoneHandle(I, Function::null());
|
| if (node->is_super_getter()) {
|
| // Statically resolved instance getter, i.e. "super getter".
|
| @@ -2809,7 +2818,7 @@
|
| getter_function = Resolver::ResolveDynamicAnyArgs(node->cls(), getter_name);
|
| if (getter_function.IsNull()) {
|
| // Resolve and call noSuchMethod.
|
| - ArgumentListNode* arguments = new ArgumentListNode(node->token_pos());
|
| + ArgumentListNode* arguments = new(I) ArgumentListNode(node->token_pos());
|
| arguments->Add(node->receiver());
|
| StaticCallInstr* call =
|
| BuildStaticNoSuchMethodCall(node->cls(),
|
| @@ -2859,11 +2868,12 @@
|
| }
|
| }
|
| ASSERT(!getter_function.IsNull());
|
| - StaticCallInstr* call = new StaticCallInstr(node->token_pos(),
|
| - getter_function,
|
| - Object::null_array(), // No names
|
| - arguments,
|
| - owner()->ic_data_array());
|
| + StaticCallInstr* call = new(I) StaticCallInstr(
|
| + node->token_pos(),
|
| + getter_function,
|
| + Object::null_array(), // No names
|
| + arguments,
|
| + owner()->ic_data_array());
|
| ReturnDefinition(call);
|
| }
|
|
|
| @@ -2873,7 +2883,7 @@
|
| const String& setter_name =
|
| String::ZoneHandle(I, Field::SetterSymbol(node->field_name()));
|
| ZoneGrowableArray<PushArgumentInstr*>* arguments =
|
| - new ZoneGrowableArray<PushArgumentInstr*>(1);
|
| + new(I) ZoneGrowableArray<PushArgumentInstr*>(1);
|
| // A super setter is an instance setter whose setter function is
|
| // resolved at compile time (in the caller instance getter's super class).
|
| // Unlike a static getter, a super getter has a receiver parameter.
|
| @@ -2887,7 +2897,7 @@
|
| if (is_super_setter) {
|
| ASSERT(node->receiver() != NULL);
|
| // Resolve and call noSuchMethod.
|
| - ArgumentListNode* arguments = new ArgumentListNode(node->token_pos());
|
| + ArgumentListNode* arguments = new(I) ArgumentListNode(node->token_pos());
|
| arguments->Add(node->receiver());
|
| arguments->Add(node->value());
|
| call = BuildStaticNoSuchMethodCall(
|
| @@ -2899,7 +2909,7 @@
|
| true); // Super invocation.
|
| } else {
|
| // Throw a NoSuchMethodError.
|
| - ArgumentListNode* arguments = new ArgumentListNode(node->token_pos());
|
| + ArgumentListNode* arguments = new(I) ArgumentListNode(node->token_pos());
|
| arguments->Add(node->value());
|
| call = BuildThrowNoSuchMethodError(
|
| node->token_pos(),
|
| @@ -2931,11 +2941,11 @@
|
| }
|
| arguments->Add(PushArgument(value));
|
|
|
| - call = new StaticCallInstr(node->token_pos(),
|
| - setter_function,
|
| - Object::null_array(), // No names.
|
| - arguments,
|
| - owner()->ic_data_array());
|
| + call = new(I) StaticCallInstr(node->token_pos(),
|
| + setter_function,
|
| + Object::null_array(), // No names.
|
| + arguments,
|
| + owner()->ic_data_array());
|
| }
|
| if (result_is_needed) {
|
| Do(call);
|
| @@ -2975,10 +2985,10 @@
|
| }
|
|
|
|
|
| -static LoadLocalInstr* BuildLoadThisVar(LocalScope* scope) {
|
| +LoadLocalInstr* EffectGraphVisitor::BuildLoadThisVar(LocalScope* scope) {
|
| LocalVariable* receiver_var = scope->LookupVariable(Symbols::This(),
|
| true); // Test only.
|
| - return new LoadLocalInstr(*receiver_var);
|
| + return new(I) LoadLocalInstr(*receiver_var);
|
| }
|
|
|
|
|
| @@ -2992,15 +3002,15 @@
|
| LocalVariable* other_var =
|
| node->scope()->LookupVariable(Symbols::Other(),
|
| true); // Test only.
|
| - Value* other = Bind(new LoadLocalInstr(*other_var));
|
| + Value* other = Bind(new(I) LoadLocalInstr(*other_var));
|
| // Receiver is not a number because numbers override equality.
|
| const bool kNoNumberCheck = false;
|
| StrictCompareInstr* compare =
|
| - new StrictCompareInstr(node->token_pos(),
|
| - Token::kEQ_STRICT,
|
| - receiver,
|
| - other,
|
| - kNoNumberCheck);
|
| + new(I) StrictCompareInstr(node->token_pos(),
|
| + Token::kEQ_STRICT,
|
| + receiver,
|
| + other,
|
| + kNoNumberCheck);
|
| return ReturnDefinition(compare);
|
| }
|
| case MethodRecognizer::kStringBaseLength:
|
| @@ -3010,7 +3020,7 @@
|
| // avoid hoisting them since we can't hoist the preceding class-check.
|
| // This is because of externalization of strings that affects their
|
| // class-id.
|
| - LoadFieldInstr* load = new LoadFieldInstr(
|
| + LoadFieldInstr* load = new(I) LoadFieldInstr(
|
| receiver,
|
| String::length_offset(),
|
| Type::ZoneHandle(I, Type::SmiType()),
|
| @@ -3021,11 +3031,11 @@
|
| return ReturnDefinition(load);
|
| }
|
| ASSERT(kind == MethodRecognizer::kStringBaseIsEmpty);
|
| - Value* zero_val = Bind(new ConstantInstr(
|
| + Value* zero_val = Bind(new(I) ConstantInstr(
|
| Smi::ZoneHandle(I, Smi::New(0))));
|
| Value* load_val = Bind(load);
|
| StrictCompareInstr* compare =
|
| - new StrictCompareInstr(node->token_pos(),
|
| + new(I) StrictCompareInstr(node->token_pos(),
|
| Token::kEQ_STRICT,
|
| load_val,
|
| zero_val,
|
| @@ -3037,7 +3047,7 @@
|
| case MethodRecognizer::kImmutableArrayLength:
|
| case MethodRecognizer::kTypedDataLength: {
|
| Value* receiver = Bind(BuildLoadThisVar(node->scope()));
|
| - LoadFieldInstr* load = new LoadFieldInstr(
|
| + LoadFieldInstr* load = new(I) LoadFieldInstr(
|
| receiver,
|
| OffsetForLengthGetter(kind),
|
| Type::ZoneHandle(I, Type::SmiType()),
|
| @@ -3050,20 +3060,20 @@
|
| case MethodRecognizer::kClassIDgetID: {
|
| LocalVariable* value_var =
|
| node->scope()->LookupVariable(Symbols::Value(), true);
|
| - Value* value = Bind(new LoadLocalInstr(*value_var));
|
| - LoadClassIdInstr* load = new LoadClassIdInstr(value);
|
| + Value* value = Bind(new(I) LoadLocalInstr(*value_var));
|
| + LoadClassIdInstr* load = new(I) LoadClassIdInstr(value);
|
| return ReturnDefinition(load);
|
| }
|
| case MethodRecognizer::kGrowableArrayCapacity: {
|
| Value* receiver = Bind(BuildLoadThisVar(node->scope()));
|
| - LoadFieldInstr* data_load = new LoadFieldInstr(
|
| + LoadFieldInstr* data_load = new(I) LoadFieldInstr(
|
| receiver,
|
| Array::data_offset(),
|
| Type::ZoneHandle(I, Type::DynamicType()),
|
| node->token_pos());
|
| data_load->set_result_cid(kArrayCid);
|
| Value* data = Bind(data_load);
|
| - LoadFieldInstr* length_load = new LoadFieldInstr(
|
| + LoadFieldInstr* length_load = new(I) LoadFieldInstr(
|
| data,
|
| Array::length_offset(),
|
| Type::ZoneHandle(I, Type::SmiType()),
|
| @@ -3077,7 +3087,7 @@
|
| }
|
| }
|
| InlineBailout("EffectGraphVisitor::VisitNativeBodyNode");
|
| - NativeCallInstr* native_call = new NativeCallInstr(node);
|
| + NativeCallInstr* native_call = new(I) NativeCallInstr(node);
|
| ReturnDefinition(native_call);
|
| }
|
|
|
| @@ -3109,7 +3119,7 @@
|
| if (node->value()->IsLiteralNode() ||
|
| node->value()->IsLoadLocalNode()) {
|
| if (FLAG_enable_debugger) {
|
| - AddInstruction(new DebugStepCheckInstr(node->token_pos(),
|
| + AddInstruction(new(I) DebugStepCheckInstr(node->token_pos(),
|
| PcDescriptors::kRuntimeCall));
|
| }
|
| }
|
| @@ -3134,7 +3144,7 @@
|
| ValueGraphVisitor for_instance(owner());
|
| node->instance()->Visit(&for_instance);
|
| Append(for_instance);
|
| - LoadFieldInstr* load = new LoadFieldInstr(
|
| + LoadFieldInstr* load = new(I) LoadFieldInstr(
|
| for_instance.value(),
|
| &node->field(),
|
| AbstractType::ZoneHandle(I, node->field().type()),
|
| @@ -3171,25 +3181,25 @@
|
|
|
| store_value = Bind(BuildStoreExprTemp(store_value));
|
| GuardFieldClassInstr* guard_field_class =
|
| - new GuardFieldClassInstr(store_value,
|
| + new(I) GuardFieldClassInstr(store_value,
|
| node->field(),
|
| I->GetNextDeoptId());
|
| AddInstruction(guard_field_class);
|
|
|
| store_value = Bind(BuildLoadExprTemp());
|
| GuardFieldLengthInstr* guard_field_length =
|
| - new GuardFieldLengthInstr(store_value,
|
| + new(I) GuardFieldLengthInstr(store_value,
|
| node->field(),
|
| I->GetNextDeoptId());
|
| AddInstruction(guard_field_length);
|
|
|
| store_value = Bind(BuildLoadExprTemp());
|
| StoreInstanceFieldInstr* store =
|
| - new StoreInstanceFieldInstr(node->field(),
|
| - for_instance.value(),
|
| - store_value,
|
| - kEmitStoreBarrier,
|
| - node->token_pos());
|
| + new(I) StoreInstanceFieldInstr(node->field(),
|
| + for_instance.value(),
|
| + store_value,
|
| + kEmitStoreBarrier,
|
| + node->token_pos());
|
| store->set_is_initialization(true); // Maybe initializing store.
|
| ReturnDefinition(store);
|
| }
|
| @@ -3200,11 +3210,11 @@
|
| ASSERT(node->field().value() != Object::sentinel().raw());
|
| ASSERT(node->field().value() != Object::transition_sentinel().raw());
|
| Definition* result =
|
| - new ConstantInstr(Instance::ZoneHandle(I, node->field().value()));
|
| + new(I) ConstantInstr(Instance::ZoneHandle(I, node->field().value()));
|
| return ReturnDefinition(result);
|
| }
|
| - Value* field_value = Bind(new ConstantInstr(node->field()));
|
| - LoadStaticFieldInstr* load = new LoadStaticFieldInstr(field_value);
|
| + Value* field_value = Bind(new(I) ConstantInstr(node->field()));
|
| + LoadStaticFieldInstr* load = new(I) LoadStaticFieldInstr(field_value);
|
| ReturnDefinition(load);
|
| }
|
|
|
| @@ -3221,7 +3231,7 @@
|
| store_value = for_value.value();
|
| }
|
| StoreStaticFieldInstr* store =
|
| - new StoreStaticFieldInstr(node->field(), store_value);
|
| + new(I) StoreStaticFieldInstr(node->field(), store_value);
|
|
|
| if (result_is_needed) {
|
| Do(store);
|
| @@ -3252,7 +3262,7 @@
|
| if (super_function->IsNull()) {
|
| // Could not resolve super operator. Generate call noSuchMethod() of the
|
| // super class instead.
|
| - ArgumentListNode* arguments = new ArgumentListNode(node->token_pos());
|
| + ArgumentListNode* arguments = new(I) ArgumentListNode(node->token_pos());
|
| arguments->Add(node->array());
|
| arguments->Add(node->index_expr());
|
| StaticCallInstr* call =
|
| @@ -3267,7 +3277,7 @@
|
| }
|
| }
|
| ZoneGrowableArray<PushArgumentInstr*>* arguments =
|
| - new ZoneGrowableArray<PushArgumentInstr*>(2);
|
| + new(I) ZoneGrowableArray<PushArgumentInstr*>(2);
|
| ValueGraphVisitor for_array(owner());
|
| node->array()->Visit(&for_array);
|
| Append(for_array);
|
| @@ -3280,7 +3290,7 @@
|
|
|
| if (super_function != NULL) {
|
| // Generate static call to super operator.
|
| - StaticCallInstr* load = new StaticCallInstr(node->token_pos(),
|
| + StaticCallInstr* load = new(I) StaticCallInstr(node->token_pos(),
|
| *super_function,
|
| Object::null_array(),
|
| arguments,
|
| @@ -3289,7 +3299,7 @@
|
| } else {
|
| // Generate dynamic call to index operator.
|
| const intptr_t checked_argument_count = 1;
|
| - InstanceCallInstr* load = new InstanceCallInstr(node->token_pos(),
|
| + InstanceCallInstr* load = new(I) InstanceCallInstr(node->token_pos(),
|
| Symbols::IndexToken(),
|
| Token::kINDEX,
|
| arguments,
|
| @@ -3313,7 +3323,7 @@
|
| if (super_function->IsNull()) {
|
| // Could not resolve super operator. Generate call noSuchMethod() of the
|
| // super class instead.
|
| - ArgumentListNode* arguments = new ArgumentListNode(node->token_pos());
|
| + ArgumentListNode* arguments = new(I) ArgumentListNode(node->token_pos());
|
| arguments->Add(node->array());
|
| arguments->Add(node->index_expr());
|
| arguments->Add(node->value());
|
| @@ -3335,7 +3345,7 @@
|
| }
|
|
|
| ZoneGrowableArray<PushArgumentInstr*>* arguments =
|
| - new ZoneGrowableArray<PushArgumentInstr*>(3);
|
| + new(I) ZoneGrowableArray<PushArgumentInstr*>(3);
|
| ValueGraphVisitor for_array(owner());
|
| node->array()->Visit(&for_array);
|
| Append(for_array);
|
| @@ -3361,7 +3371,7 @@
|
| // Generate static call to super operator []=.
|
|
|
| StaticCallInstr* store =
|
| - new StaticCallInstr(node->token_pos(),
|
| + new(I) StaticCallInstr(node->token_pos(),
|
| *super_function,
|
| Object::null_array(),
|
| arguments,
|
| @@ -3378,7 +3388,7 @@
|
| const String& name =
|
| String::ZoneHandle(I, Symbols::New(Token::Str(Token::kASSIGN_INDEX)));
|
| InstanceCallInstr* store =
|
| - new InstanceCallInstr(node->token_pos(),
|
| + new(I) InstanceCallInstr(node->token_pos(),
|
| name,
|
| Token::kASSIGN_INDEX,
|
| arguments,
|
| @@ -3413,16 +3423,16 @@
|
|
|
| void EffectGraphVisitor::UnchainContexts(intptr_t n) {
|
| if (n > 0) {
|
| - Value* context = Bind(new CurrentContextInstr());
|
| + Value* context = Bind(new(I) CurrentContextInstr());
|
| while (n-- > 0) {
|
| context = Bind(
|
| - new LoadFieldInstr(context,
|
| - Context::parent_offset(),
|
| - // Not an instance, no type.
|
| - Type::ZoneHandle(I, Type::null()),
|
| - Scanner::kNoSourcePos));
|
| + new(I) LoadFieldInstr(context,
|
| + Context::parent_offset(),
|
| + // Not an instance, no type.
|
| + Type::ZoneHandle(I, Type::null()),
|
| + Scanner::kNoSourcePos));
|
| }
|
| - AddInstruction(new StoreContextInstr(context));
|
| + AddInstruction(new(I) StoreContextInstr(context));
|
| }
|
| }
|
|
|
| @@ -3444,8 +3454,8 @@
|
| // Allocate and chain a new context.
|
| // Allocate context computation (uses current CTX)
|
| Value* allocated_context =
|
| - Bind(new AllocateContextInstr(node->token_pos(),
|
| - num_context_variables));
|
| + Bind(new(I) AllocateContextInstr(node->token_pos(),
|
| + num_context_variables));
|
| { LocalVariable* tmp_var = EnterTempLocalScope(allocated_context);
|
| // If this node_sequence is the body of the function being compiled, and
|
| // if this function allocates context variables, but none of its enclosing
|
| @@ -3453,23 +3463,23 @@
|
| // allocated context but saved on entry and restored on exit as to prevent
|
| // memory leaks.
|
| // In this case, the parser pre-allocates a variable to save the context.
|
| - Value* tmp_val = Bind(new LoadLocalInstr(*tmp_var));
|
| + Value* tmp_val = Bind(new(I) LoadLocalInstr(*tmp_var));
|
| Value* parent_context = NULL;
|
| if (MustSaveRestoreContext(node)) {
|
| BuildSaveContext(
|
| *owner()->parsed_function()->saved_entry_context_var());
|
| parent_context = Bind(
|
| - new ConstantInstr(Object::ZoneHandle(I, Object::null())));
|
| + new(I) ConstantInstr(Object::ZoneHandle(I, Object::null())));
|
| } else {
|
| - parent_context = Bind(new CurrentContextInstr());
|
| + parent_context = Bind(new(I) CurrentContextInstr());
|
| }
|
| - Do(new StoreInstanceFieldInstr(Context::parent_offset(),
|
| + Do(new(I) StoreInstanceFieldInstr(Context::parent_offset(),
|
| tmp_val,
|
| parent_context,
|
| kEmitStoreBarrier,
|
| Scanner::kNoSourcePos));
|
| AddInstruction(
|
| - new StoreContextInstr(Bind(ExitTempLocalScope(tmp_var))));
|
| + new(I) StoreContextInstr(Bind(ExitTempLocalScope(tmp_var))));
|
| }
|
|
|
| // If this node_sequence is the body of the function being compiled, copy
|
| @@ -3486,7 +3496,7 @@
|
| if (parameter.is_captured()) {
|
| // Create a temporary local describing the original position.
|
| const String& temp_name = Symbols::TempParam();
|
| - LocalVariable* temp_local = new LocalVariable(
|
| + LocalVariable* temp_local = new(I) LocalVariable(
|
| 0, // Token index.
|
| temp_name,
|
| Type::ZoneHandle(I, Type::DynamicType())); // Type.
|
| @@ -3498,7 +3508,7 @@
|
| // Write NULL to the source location to detect buggy accesses and
|
| // allow GC of passed value if it gets overwritten by a new value in
|
| // the function.
|
| - Value* null_constant = Bind(new ConstantInstr(
|
| + Value* null_constant = Bind(new(I) ConstantInstr(
|
| Object::ZoneHandle(I, Object::null())));
|
| Do(BuildStoreLocal(*temp_local, null_constant));
|
| }
|
| @@ -3512,7 +3522,7 @@
|
| BuildSaveContext(
|
| *owner()->parsed_function()->saved_entry_context_var());
|
| AddInstruction(
|
| - new StoreContextInstr(Bind(new ConstantInstr(Object::ZoneHandle(
|
| + new(I) StoreContextInstr(Bind(new(I) ConstantInstr(Object::ZoneHandle(
|
| I, I->object_store()->empty_context())))));
|
| }
|
|
|
| @@ -3526,7 +3536,7 @@
|
| if (!function.IsImplicitGetterFunction() &&
|
| !function.IsImplicitSetterFunction()) {
|
| CheckStackOverflowInstr* check =
|
| - new CheckStackOverflowInstr(function.token_pos(), 0);
|
| + new(I) CheckStackOverflowInstr(function.token_pos(), 0);
|
| // If we are inlining don't actually attach the stack check. We must still
|
| // create the stack check in order to allocate a deopt id.
|
| if (!owner()->IsInlining()) {
|
| @@ -3626,13 +3636,14 @@
|
|
|
| if (for_try.is_open()) {
|
| JoinEntryInstr* after_try =
|
| - new JoinEntryInstr(owner()->AllocateBlockId(), original_handler_index);
|
| + new(I) JoinEntryInstr(owner()->AllocateBlockId(),
|
| + original_handler_index);
|
| for_try.Goto(after_try);
|
| for_try.exit_ = after_try;
|
| }
|
|
|
| JoinEntryInstr* try_entry =
|
| - new JoinEntryInstr(owner()->AllocateBlockId(), try_handler_index);
|
| + new(I) JoinEntryInstr(owner()->AllocateBlockId(), try_handler_index);
|
|
|
| Goto(try_entry);
|
| AppendFragment(try_entry, for_try);
|
| @@ -3664,7 +3675,7 @@
|
| ASSERT(!catch_block->stacktrace_var().is_captured());
|
|
|
| CatchBlockEntryInstr* catch_entry =
|
| - new CatchBlockEntryInstr(owner()->AllocateBlockId(),
|
| + new(I) CatchBlockEntryInstr(owner()->AllocateBlockId(),
|
| catch_handler_index,
|
| catch_block->handler_types(),
|
| try_handler_index,
|
| @@ -3675,7 +3686,7 @@
|
| AppendFragment(catch_entry, for_catch);
|
|
|
| if (for_catch.is_open()) {
|
| - JoinEntryInstr* join = new JoinEntryInstr(owner()->AllocateBlockId(),
|
| + JoinEntryInstr* join = new(I) JoinEntryInstr(owner()->AllocateBlockId(),
|
| original_handler_index);
|
| for_catch.Goto(join);
|
| if (is_open()) Goto(join);
|
| @@ -3699,7 +3710,7 @@
|
| for_finally.BuildLoadLocal(catch_block->stacktrace_var()));
|
| for_finally.PushArgument(stacktrace);
|
| for_finally.AddInstruction(
|
| - new ReThrowInstr(catch_block->token_pos(), catch_handler_index));
|
| + new(I) ReThrowInstr(catch_block->token_pos(), catch_handler_index));
|
| for_finally.CloseFragment();
|
| }
|
| ASSERT(!for_finally.is_open());
|
| @@ -3707,7 +3718,7 @@
|
| const Array& types = Array::ZoneHandle(I, Array::New(1, Heap::kOld));
|
| types.SetAt(0, Type::Handle(I, Type::DynamicType()));
|
| CatchBlockEntryInstr* finally_entry =
|
| - new CatchBlockEntryInstr(owner()->AllocateBlockId(),
|
| + new(I) CatchBlockEntryInstr(owner()->AllocateBlockId(),
|
| original_handler_index,
|
| types,
|
| catch_handler_index,
|
| @@ -3753,13 +3764,13 @@
|
| // We are guaranteed to find noSuchMethod of class Object.
|
| ASSERT(!no_such_method_func.IsNull());
|
| ZoneGrowableArray<PushArgumentInstr*>* push_arguments =
|
| - new ZoneGrowableArray<PushArgumentInstr*>(2);
|
| + new(I) ZoneGrowableArray<PushArgumentInstr*>(2);
|
| BuildPushArguments(*args, push_arguments);
|
| - return new StaticCallInstr(args_pos,
|
| - no_such_method_func,
|
| - Object::null_array(),
|
| - push_arguments,
|
| - owner()->ic_data_array());
|
| + return new(I) StaticCallInstr(args_pos,
|
| + no_such_method_func,
|
| + Object::null_array(),
|
| + push_arguments,
|
| + owner()->ic_data_array());
|
| }
|
|
|
|
|
| @@ -3770,7 +3781,7 @@
|
| ArgumentListNode* function_arguments,
|
| int invocation_type) {
|
| ZoneGrowableArray<PushArgumentInstr*>* arguments =
|
| - new ZoneGrowableArray<PushArgumentInstr*>();
|
| + new(I) ZoneGrowableArray<PushArgumentInstr*>();
|
| // Object receiver, actually a class literal of the unresolved method's owner.
|
| Type& type = Type::ZoneHandle(
|
| I,
|
| @@ -3780,33 +3791,33 @@
|
| Heap::kOld));
|
| type ^= ClassFinalizer::FinalizeType(
|
| function_class, type, ClassFinalizer::kCanonicalize);
|
| - Value* receiver_value = Bind(new ConstantInstr(type));
|
| + Value* receiver_value = Bind(new(I) ConstantInstr(type));
|
| arguments->Add(PushArgument(receiver_value));
|
| // String memberName.
|
| const String& member_name =
|
| String::ZoneHandle(I, Symbols::New(function_name));
|
| - Value* member_name_value = Bind(new ConstantInstr(member_name));
|
| + Value* member_name_value = Bind(new(I) ConstantInstr(member_name));
|
| arguments->Add(PushArgument(member_name_value));
|
| // Smi invocation_type.
|
| - Value* invocation_type_value = Bind(new ConstantInstr(
|
| + Value* invocation_type_value = Bind(new(I) ConstantInstr(
|
| Smi::ZoneHandle(I, Smi::New(invocation_type))));
|
| arguments->Add(PushArgument(invocation_type_value));
|
| // List arguments.
|
| if (function_arguments == NULL) {
|
| Value* arguments_value = Bind(
|
| - new ConstantInstr(Array::ZoneHandle(I, Array::null())));
|
| + new(I) ConstantInstr(Array::ZoneHandle(I, Array::null())));
|
| arguments->Add(PushArgument(arguments_value));
|
| } else {
|
| ValueGraphVisitor array_val(owner());
|
| ArrayNode* array =
|
| - new ArrayNode(token_pos, Type::ZoneHandle(I, Type::ArrayType()),
|
| + new(I) ArrayNode(token_pos, Type::ZoneHandle(I, Type::ArrayType()),
|
| function_arguments->nodes());
|
| array->Visit(&array_val);
|
| Append(array_val);
|
| arguments->Add(PushArgument(array_val.value()));
|
| }
|
| // List argumentNames.
|
| - ConstantInstr* cinstr = new ConstantInstr(
|
| + ConstantInstr* cinstr = new(I) ConstantInstr(
|
| (function_arguments == NULL) ? Array::ZoneHandle(I, Array::null())
|
| : function_arguments->names());
|
| Value* argument_names_value = Bind(cinstr);
|
| @@ -3814,7 +3825,7 @@
|
|
|
| // List existingArgumentNames.
|
| Value* existing_argument_names_value =
|
| - Bind(new ConstantInstr(Array::ZoneHandle(I, Array::null())));
|
| + Bind(new(I) ConstantInstr(Array::ZoneHandle(I, Array::null())));
|
| arguments->Add(PushArgument(existing_argument_names_value));
|
| // Resolve and call NoSuchMethodError._throwNew.
|
| const Library& core_lib = Library::Handle(I, Library::CoreLibrary());
|
| @@ -3828,11 +3839,11 @@
|
| arguments->length(),
|
| Object::null_array()));
|
| ASSERT(!func.IsNull());
|
| - return new StaticCallInstr(token_pos,
|
| - func,
|
| - Object::null_array(), // No names.
|
| - arguments,
|
| - owner()->ic_data_array());
|
| + return new(I) StaticCallInstr(token_pos,
|
| + func,
|
| + Object::null_array(), // No names.
|
| + arguments,
|
| + owner()->ic_data_array());
|
| }
|
|
|
|
|
| @@ -3843,13 +3854,13 @@
|
| PushArgument(for_exception.value());
|
| Instruction* instr = NULL;
|
| if (node->stacktrace() == NULL) {
|
| - instr = new ThrowInstr(node->token_pos());
|
| + instr = new(I) ThrowInstr(node->token_pos());
|
| } else {
|
| ValueGraphVisitor for_stack_trace(owner());
|
| node->stacktrace()->Visit(&for_stack_trace);
|
| Append(for_stack_trace);
|
| PushArgument(for_stack_trace.value());
|
| - instr = new ReThrowInstr(node->token_pos(), owner()->catch_try_index());
|
| + instr = new(I) ReThrowInstr(node->token_pos(), owner()->catch_try_index());
|
| }
|
| AddInstruction(instr);
|
| }
|
| @@ -3866,7 +3877,7 @@
|
| // so that the fragment is not closed in the middle of an expression.
|
| void ValueGraphVisitor::VisitThrowNode(ThrowNode* node) {
|
| BuildThrowNode(node);
|
| - ReturnDefinition(new ConstantInstr(
|
| + ReturnDefinition(new(I) ConstantInstr(
|
| Instance::ZoneHandle(I, Instance::null())));
|
| }
|
|
|
| @@ -3884,7 +3895,7 @@
|
| BuildRestoreContext(node->context_var());
|
|
|
| JoinEntryInstr* finally_entry =
|
| - new JoinEntryInstr(owner()->AllocateBlockId(), owner()->try_index());
|
| + new(I) JoinEntryInstr(owner()->AllocateBlockId(), owner()->try_index());
|
| EffectGraphVisitor for_finally_block(owner());
|
| node->finally_block()->Visit(&for_finally_block);
|
|
|
| @@ -3894,7 +3905,7 @@
|
|
|
| if (for_finally_block.is_open()) {
|
| JoinEntryInstr* after_finally =
|
| - new JoinEntryInstr(owner()->AllocateBlockId(), owner()->try_index());
|
| + new(I) JoinEntryInstr(owner()->AllocateBlockId(), owner()->try_index());
|
| for_finally_block.Goto(after_finally);
|
| for_finally_block.exit_ = after_finally;
|
| }
|
| @@ -3914,9 +3925,10 @@
|
| AstPrinter::PrintFunctionScope(*parsed_function());
|
| }
|
| TargetEntryInstr* normal_entry =
|
| - new TargetEntryInstr(AllocateBlockId(),
|
| - CatchClauseNode::kInvalidTryIndex);
|
| - graph_entry_ = new GraphEntryInstr(parsed_function(), normal_entry, osr_id_);
|
| + new(I) TargetEntryInstr(AllocateBlockId(),
|
| + CatchClauseNode::kInvalidTryIndex);
|
| + graph_entry_ =
|
| + new(I) GraphEntryInstr(parsed_function(), normal_entry, osr_id_);
|
| EffectGraphVisitor for_effect(this);
|
| parsed_function()->node_sequence()->Visit(&for_effect);
|
| AppendFragment(normal_entry, for_effect);
|
| @@ -3930,14 +3942,14 @@
|
| PruneUnreachable();
|
| }
|
|
|
| - FlowGraph* graph = new FlowGraph(*this, graph_entry_, last_used_block_id_);
|
| + FlowGraph* graph = new(I) FlowGraph(*this, graph_entry_, last_used_block_id_);
|
| return graph;
|
| }
|
|
|
|
|
| void FlowGraphBuilder::PruneUnreachable() {
|
| ASSERT(osr_id_ != Isolate::kNoDeoptId);
|
| - BitVector* block_marks = new BitVector(last_used_block_id_ + 1);
|
| + BitVector* block_marks = new(I) BitVector(last_used_block_id_ + 1);
|
| bool found = graph_entry_->PruneUnreachable(this, graph_entry_, NULL, osr_id_,
|
| block_marks);
|
| ASSERT(found);
|
|
|