| Index: src/hydrogen.cc
|
| diff --git a/src/hydrogen.cc b/src/hydrogen.cc
|
| index 53fb00e8c4c45912176bf4df749387cb390adc6d..2c918d63383db54ecc148b1a7b7c33fc1af50777 100644
|
| --- a/src/hydrogen.cc
|
| +++ b/src/hydrogen.cc
|
| @@ -55,19 +55,19 @@ namespace internal {
|
| HBasicBlock::HBasicBlock(HGraph* graph)
|
| : block_id_(graph->GetNextBlockID()),
|
| graph_(graph),
|
| - phis_(4),
|
| + phis_(4, graph->zone()),
|
| first_(NULL),
|
| last_(NULL),
|
| end_(NULL),
|
| loop_information_(NULL),
|
| - predecessors_(2),
|
| + predecessors_(2, graph->zone()),
|
| dominator_(NULL),
|
| - dominated_blocks_(4),
|
| + dominated_blocks_(4, graph->zone()),
|
| last_environment_(NULL),
|
| argument_count_(-1),
|
| first_instruction_index_(-1),
|
| last_instruction_index_(-1),
|
| - deleted_phis_(4),
|
| + deleted_phis_(4, graph->zone()),
|
| parent_loop_header_(NULL),
|
| is_inline_return_target_(false),
|
| is_deoptimizing_(false),
|
| @@ -76,7 +76,7 @@ HBasicBlock::HBasicBlock(HGraph* graph)
|
|
|
| void HBasicBlock::AttachLoopInformation() {
|
| ASSERT(!IsLoopHeader());
|
| - loop_information_ = new(zone()) HLoopInformation(this);
|
| + loop_information_ = new(zone()) HLoopInformation(this, zone());
|
| }
|
|
|
|
|
| @@ -88,7 +88,7 @@ void HBasicBlock::DetachLoopInformation() {
|
|
|
| void HBasicBlock::AddPhi(HPhi* phi) {
|
| ASSERT(!IsStartBlock());
|
| - phis_.Add(phi);
|
| + phis_.Add(phi, zone());
|
| phi->SetBlock(this);
|
| }
|
|
|
| @@ -119,13 +119,14 @@ void HBasicBlock::AddInstruction(HInstruction* instr) {
|
| HDeoptimize* HBasicBlock::CreateDeoptimize(
|
| HDeoptimize::UseEnvironment has_uses) {
|
| ASSERT(HasEnvironment());
|
| - if (has_uses == HDeoptimize::kNoUses) return new(zone()) HDeoptimize(0);
|
| + if (has_uses == HDeoptimize::kNoUses)
|
| + return new(zone()) HDeoptimize(0, zone());
|
|
|
| HEnvironment* environment = last_environment();
|
| - HDeoptimize* instr = new(zone()) HDeoptimize(environment->length());
|
| + HDeoptimize* instr = new(zone()) HDeoptimize(environment->length(), zone());
|
| for (int i = 0; i < environment->length(); i++) {
|
| HValue* val = environment->values()->at(i);
|
| - instr->AddEnvironmentValue(val);
|
| + instr->AddEnvironmentValue(val, zone());
|
| }
|
|
|
| return instr;
|
| @@ -141,7 +142,7 @@ HSimulate* HBasicBlock::CreateSimulate(int ast_id) {
|
| int push_count = environment->push_count();
|
| int pop_count = environment->pop_count();
|
|
|
| - HSimulate* instr = new(zone()) HSimulate(ast_id, pop_count);
|
| + HSimulate* instr = new(zone()) HSimulate(ast_id, pop_count, zone());
|
| for (int i = push_count - 1; i >= 0; --i) {
|
| instr->AddPushedValue(environment->ExpressionStackAt(i));
|
| }
|
| @@ -278,7 +279,7 @@ void HBasicBlock::RegisterPredecessor(HBasicBlock* pred) {
|
| SetInitialEnvironment(pred->last_environment()->Copy());
|
| }
|
|
|
| - predecessors_.Add(pred);
|
| + predecessors_.Add(pred, zone());
|
| }
|
|
|
|
|
| @@ -291,7 +292,7 @@ void HBasicBlock::AddDominatedBlock(HBasicBlock* block) {
|
| dominated_blocks_[index]->block_id() < block->block_id()) {
|
| ++index;
|
| }
|
| - dominated_blocks_.InsertAt(index, block);
|
| + dominated_blocks_.InsertAt(index, block, zone());
|
| }
|
|
|
|
|
| @@ -404,7 +405,7 @@ void HBasicBlock::Verify() {
|
|
|
|
|
| void HLoopInformation::RegisterBackEdge(HBasicBlock* block) {
|
| - this->back_edges_.Add(block);
|
| + this->back_edges_.Add(block, block->zone());
|
| AddBlock(block);
|
| }
|
|
|
| @@ -430,7 +431,7 @@ void HLoopInformation::AddBlock(HBasicBlock* block) {
|
| AddBlock(block->parent_loop_header());
|
| } else {
|
| block->set_parent_loop_header(loop_header());
|
| - blocks_.Add(block);
|
| + blocks_.Add(block, block->zone());
|
| for (int i = 0; i < block->predecessors()->length(); ++i) {
|
| AddBlock(block->predecessors()->at(i));
|
| }
|
| @@ -451,8 +452,8 @@ class ReachabilityAnalyzer BASE_EMBEDDED {
|
| int block_count,
|
| HBasicBlock* dont_visit)
|
| : visited_count_(0),
|
| - stack_(16),
|
| - reachable_(block_count, ZONE),
|
| + stack_(16, entry_block->zone()),
|
| + reachable_(block_count, entry_block->zone()),
|
| dont_visit_(dont_visit) {
|
| PushBlock(entry_block);
|
| Analyze();
|
| @@ -466,7 +467,7 @@ class ReachabilityAnalyzer BASE_EMBEDDED {
|
| if (block != NULL && block != dont_visit_ &&
|
| !reachable_.Contains(block->block_id())) {
|
| reachable_.Add(block->block_id());
|
| - stack_.Add(block);
|
| + stack_.Add(block, block->zone());
|
| visited_count_++;
|
| }
|
| }
|
| @@ -604,7 +605,8 @@ HConstant* HGraph::GetConstantHole() {
|
|
|
|
|
| HGraphBuilder::HGraphBuilder(CompilationInfo* info,
|
| - TypeFeedbackOracle* oracle)
|
| + TypeFeedbackOracle* oracle,
|
| + Zone* zone)
|
| : function_state_(NULL),
|
| initial_function_state_(this, info, oracle, NORMAL_RETURN),
|
| ast_context_(NULL),
|
| @@ -612,8 +614,8 @@ HGraphBuilder::HGraphBuilder(CompilationInfo* info,
|
| graph_(NULL),
|
| current_block_(NULL),
|
| inlined_count_(0),
|
| - globals_(10),
|
| - zone_(info->isolate()->zone()),
|
| + globals_(10, zone),
|
| + zone_(zone),
|
| inline_bailout_(false) {
|
| // This is not initialized in the initializer list because the
|
| // constructor for the initial state relies on function_state_ == NULL
|
| @@ -672,15 +674,16 @@ void HBasicBlock::FinishExit(HControlInstruction* instruction) {
|
| }
|
|
|
|
|
| -HGraph::HGraph(CompilationInfo* info)
|
| +HGraph::HGraph(CompilationInfo* info, Zone* zone)
|
| : isolate_(info->isolate()),
|
| next_block_id_(0),
|
| entry_block_(NULL),
|
| - blocks_(8),
|
| - values_(16),
|
| - phi_list_(NULL) {
|
| + blocks_(8, zone),
|
| + values_(16, zone),
|
| + phi_list_(NULL),
|
| + zone_(zone) {
|
| start_environment_ =
|
| - new(zone()) HEnvironment(NULL, info->scope(), info->closure());
|
| + new(zone) HEnvironment(NULL, info->scope(), info->closure(), zone);
|
| start_environment_->set_ast_id(AstNode::kFunctionEntryId);
|
| entry_block_ = CreateBasicBlock();
|
| entry_block_->SetInitialEnvironment(start_environment_);
|
| @@ -730,7 +733,7 @@ Handle<Code> HGraph::Compile(CompilationInfo* info, Zone* zone) {
|
|
|
| HBasicBlock* HGraph::CreateBasicBlock() {
|
| HBasicBlock* result = new(zone()) HBasicBlock(this);
|
| - blocks_.Add(result);
|
| + blocks_.Add(result, zone());
|
| return result;
|
| }
|
|
|
| @@ -753,7 +756,7 @@ void HGraph::OrderBlocks() {
|
| HPhase phase("H_Block ordering");
|
| BitVector visited(blocks_.length(), zone());
|
|
|
| - ZoneList<HBasicBlock*> reverse_result(8);
|
| + ZoneList<HBasicBlock*> reverse_result(8, zone());
|
| HBasicBlock* start = blocks_[0];
|
| Postorder(start, &visited, &reverse_result, NULL);
|
|
|
| @@ -761,7 +764,7 @@ void HGraph::OrderBlocks() {
|
| int index = 0;
|
| for (int i = reverse_result.length() - 1; i >= 0; --i) {
|
| HBasicBlock* b = reverse_result[i];
|
| - blocks_.Add(b);
|
| + blocks_.Add(b, zone());
|
| b->set_block_id(index++);
|
| }
|
| }
|
| @@ -807,7 +810,7 @@ void HGraph::Postorder(HBasicBlock* block,
|
| ASSERT(block->end()->SecondSuccessor() == NULL ||
|
| order->Contains(block->end()->SecondSuccessor()) ||
|
| block->end()->SecondSuccessor()->IsLoopHeader());
|
| - order->Add(block);
|
| + order->Add(block, zone());
|
| }
|
|
|
|
|
| @@ -849,9 +852,9 @@ void HGraph::EliminateRedundantPhis() {
|
| // Worklist of phis that can potentially be eliminated. Initialized with
|
| // all phi nodes. When elimination of a phi node modifies another phi node
|
| // the modified phi node is added to the worklist.
|
| - ZoneList<HPhi*> worklist(blocks_.length());
|
| + ZoneList<HPhi*> worklist(blocks_.length(), zone());
|
| for (int i = 0; i < blocks_.length(); ++i) {
|
| - worklist.AddAll(*blocks_[i]->phis());
|
| + worklist.AddAll(*blocks_[i]->phis(), zone());
|
| }
|
|
|
| while (!worklist.is_empty()) {
|
| @@ -869,7 +872,7 @@ void HGraph::EliminateRedundantPhis() {
|
| for (HUseIterator it(phi->uses()); !it.Done(); it.Advance()) {
|
| HValue* value = it.value();
|
| value->SetOperandAt(it.index(), replacement);
|
| - if (value->IsPhi()) worklist.Add(HPhi::cast(value));
|
| + if (value->IsPhi()) worklist.Add(HPhi::cast(value), zone());
|
| }
|
| block->RemovePhi(phi);
|
| }
|
| @@ -881,18 +884,18 @@ void HGraph::EliminateUnreachablePhis() {
|
| HPhase phase("H_Unreachable phi elimination", this);
|
|
|
| // Initialize worklist.
|
| - ZoneList<HPhi*> phi_list(blocks_.length());
|
| - ZoneList<HPhi*> worklist(blocks_.length());
|
| + ZoneList<HPhi*> phi_list(blocks_.length(), zone());
|
| + ZoneList<HPhi*> worklist(blocks_.length(), zone());
|
| for (int i = 0; i < blocks_.length(); ++i) {
|
| for (int j = 0; j < blocks_[i]->phis()->length(); j++) {
|
| HPhi* phi = blocks_[i]->phis()->at(j);
|
| - phi_list.Add(phi);
|
| + phi_list.Add(phi, zone());
|
| // We can't eliminate phis in the receiver position in the environment
|
| // because in case of throwing an error we need this value to
|
| // construct a stack trace.
|
| if (phi->HasRealUses() || phi->IsReceiver()) {
|
| phi->set_is_live(true);
|
| - worklist.Add(phi);
|
| + worklist.Add(phi, zone());
|
| }
|
| }
|
| }
|
| @@ -904,7 +907,7 @@ void HGraph::EliminateUnreachablePhis() {
|
| HValue* operand = phi->OperandAt(i);
|
| if (operand->IsPhi() && !HPhi::cast(operand)->is_live()) {
|
| HPhi::cast(operand)->set_is_live(true);
|
| - worklist.Add(HPhi::cast(operand));
|
| + worklist.Add(HPhi::cast(operand), zone());
|
| }
|
| }
|
| }
|
| @@ -951,11 +954,11 @@ bool HGraph::CheckConstPhiUses() {
|
|
|
| void HGraph::CollectPhis() {
|
| int block_count = blocks_.length();
|
| - phi_list_ = new ZoneList<HPhi*>(block_count);
|
| + phi_list_ = new(zone()) ZoneList<HPhi*>(block_count, zone());
|
| for (int i = 0; i < block_count; ++i) {
|
| for (int j = 0; j < blocks_[i]->phis()->length(); ++j) {
|
| HPhi* phi = blocks_[i]->phis()->at(j);
|
| - phi_list_->Add(phi);
|
| + phi_list_->Add(phi, zone());
|
| }
|
| }
|
| }
|
| @@ -976,7 +979,7 @@ void HGraph::InferTypes(ZoneList<HValue*>* worklist) {
|
| HValue* use = it.value();
|
| if (!in_worklist.Contains(use->id())) {
|
| in_worklist.Add(use->id());
|
| - worklist->Add(use);
|
| + worklist->Add(use, zone());
|
| }
|
| }
|
| }
|
| @@ -987,7 +990,7 @@ void HGraph::InferTypes(ZoneList<HValue*>* worklist) {
|
| class HRangeAnalysis BASE_EMBEDDED {
|
| public:
|
| explicit HRangeAnalysis(HGraph* graph) :
|
| - graph_(graph), zone_(graph->isolate()->zone()), changed_ranges_(16) { }
|
| + graph_(graph), zone_(graph->zone()), changed_ranges_(16, zone_) { }
|
|
|
| void Analyze();
|
|
|
| @@ -1132,7 +1135,7 @@ void HRangeAnalysis::RollBackTo(int index) {
|
| void HRangeAnalysis::AddRange(HValue* value, Range* range) {
|
| Range* original_range = value->range();
|
| value->AddNewRange(range, zone_);
|
| - changed_ranges_.Add(value);
|
| + changed_ranges_.Add(value, zone_);
|
| Range* new_range = value->range();
|
| TraceRange("Updated range of %d set to [%d,%d]\n",
|
| value->id(),
|
| @@ -1260,18 +1263,18 @@ HValue* HValueMap::Lookup(HValue* value) const {
|
| }
|
|
|
|
|
| -void HValueMap::Resize(int new_size) {
|
| +void HValueMap::Resize(int new_size, Zone* zone) {
|
| ASSERT(new_size > count_);
|
| // Hashing the values into the new array has no more collisions than in the
|
| // old hash map, so we can use the existing lists_ array, if we are careful.
|
|
|
| // Make sure we have at least one free element.
|
| if (free_list_head_ == kNil) {
|
| - ResizeLists(lists_size_ << 1);
|
| + ResizeLists(lists_size_ << 1, zone);
|
| }
|
|
|
| HValueMapListElement* new_array =
|
| - ZONE->NewArray<HValueMapListElement>(new_size);
|
| + zone->NewArray<HValueMapListElement>(new_size);
|
| memset(new_array, 0, sizeof(HValueMapListElement) * new_size);
|
|
|
| HValueMapListElement* old_array = array_;
|
| @@ -1289,14 +1292,14 @@ void HValueMap::Resize(int new_size) {
|
| if (old_array[i].value != NULL) {
|
| int current = old_array[i].next;
|
| while (current != kNil) {
|
| - Insert(lists_[current].value);
|
| + Insert(lists_[current].value, zone);
|
| int next = lists_[current].next;
|
| lists_[current].next = free_list_head_;
|
| free_list_head_ = current;
|
| current = next;
|
| }
|
| // Rehash the directly stored value.
|
| - Insert(old_array[i].value);
|
| + Insert(old_array[i].value, zone);
|
| }
|
| }
|
| }
|
| @@ -1305,11 +1308,11 @@ void HValueMap::Resize(int new_size) {
|
| }
|
|
|
|
|
| -void HValueMap::ResizeLists(int new_size) {
|
| +void HValueMap::ResizeLists(int new_size, Zone* zone) {
|
| ASSERT(new_size > lists_size_);
|
|
|
| HValueMapListElement* new_lists =
|
| - ZONE->NewArray<HValueMapListElement>(new_size);
|
| + zone->NewArray<HValueMapListElement>(new_size);
|
| memset(new_lists, 0, sizeof(HValueMapListElement) * new_size);
|
|
|
| HValueMapListElement* old_lists = lists_;
|
| @@ -1328,10 +1331,10 @@ void HValueMap::ResizeLists(int new_size) {
|
| }
|
|
|
|
|
| -void HValueMap::Insert(HValue* value) {
|
| +void HValueMap::Insert(HValue* value, Zone* zone) {
|
| ASSERT(value != NULL);
|
| // Resizing when half of the hashtable is filled up.
|
| - if (count_ >= array_size_ >> 1) Resize(array_size_ << 1);
|
| + if (count_ >= array_size_ >> 1) Resize(array_size_ << 1, zone);
|
| ASSERT(count_ < array_size_);
|
| count_++;
|
| uint32_t pos = Bound(static_cast<uint32_t>(value->Hashcode()));
|
| @@ -1340,7 +1343,7 @@ void HValueMap::Insert(HValue* value) {
|
| array_[pos].next = kNil;
|
| } else {
|
| if (free_list_head_ == kNil) {
|
| - ResizeLists(lists_size_ << 1);
|
| + ResizeLists(lists_size_ << 1, zone);
|
| }
|
| int new_element_pos = free_list_head_;
|
| ASSERT(new_element_pos != kNil);
|
| @@ -1478,12 +1481,14 @@ class HGlobalValueNumberer BASE_EMBEDDED {
|
| : graph_(graph),
|
| info_(info),
|
| removed_side_effects_(false),
|
| - block_side_effects_(graph->blocks()->length()),
|
| - loop_side_effects_(graph->blocks()->length()),
|
| + block_side_effects_(graph->blocks()->length(), graph->zone()),
|
| + loop_side_effects_(graph->blocks()->length(), graph->zone()),
|
| visited_on_paths_(graph->zone(), graph->blocks()->length()) {
|
| ASSERT(info->isolate()->heap()->allow_allocation(false));
|
| - block_side_effects_.AddBlock(GVNFlagSet(), graph_->blocks()->length());
|
| - loop_side_effects_.AddBlock(GVNFlagSet(), graph_->blocks()->length());
|
| + block_side_effects_.AddBlock(GVNFlagSet(), graph_->blocks()->length(),
|
| + graph_->zone());
|
| + loop_side_effects_.AddBlock(GVNFlagSet(), graph_->blocks()->length(),
|
| + graph_->zone());
|
| }
|
| ~HGlobalValueNumberer() {
|
| ASSERT(!info_->isolate()->heap()->allow_allocation(true));
|
| @@ -1509,7 +1514,7 @@ class HGlobalValueNumberer BASE_EMBEDDED {
|
|
|
| HGraph* graph() { return graph_; }
|
| CompilationInfo* info() { return info_; }
|
| - Zone* zone() { return graph_->zone(); }
|
| + Zone* zone() const { return graph_->zone(); }
|
|
|
| HGraph* graph_;
|
| CompilationInfo* info_;
|
| @@ -1949,7 +1954,7 @@ class GvnBasicBlockState: public ZoneObject {
|
| // GvnBasicBlockState instances.
|
| void HGlobalValueNumberer::AnalyzeGraph() {
|
| HBasicBlock* entry_block = graph_->entry_block();
|
| - HValueMap* entry_map = new(zone()) HValueMap();
|
| + HValueMap* entry_map = new(zone()) HValueMap(zone());
|
| GvnBasicBlockState* current =
|
| GvnBasicBlockState::CreateEntry(zone(), entry_block, entry_map);
|
|
|
| @@ -1993,7 +1998,7 @@ void HGlobalValueNumberer::AnalyzeGraph() {
|
| if (instr->HasSideEffects()) removed_side_effects_ = true;
|
| instr->DeleteAndReplaceWith(other);
|
| } else {
|
| - map->Add(instr);
|
| + map->Add(instr, zone());
|
| }
|
| }
|
| if (instr->CheckFlag(HValue::kTrackSideEffectDominators)) {
|
| @@ -2049,7 +2054,7 @@ class HInferRepresentation BASE_EMBEDDED {
|
| public:
|
| explicit HInferRepresentation(HGraph* graph)
|
| : graph_(graph),
|
| - worklist_(8),
|
| + worklist_(8, graph->zone()),
|
| in_worklist_(graph->GetMaximumValueID(), graph->zone()) { }
|
|
|
| void Analyze();
|
| @@ -2061,7 +2066,7 @@ class HInferRepresentation BASE_EMBEDDED {
|
| void AddDependantsToWorklist(HValue* current);
|
| void InferBasedOnUses(HValue* current);
|
|
|
| - Zone* zone() { return graph_->zone(); }
|
| + Zone* zone() const { return graph_->zone(); }
|
|
|
| HGraph* graph_;
|
| ZoneList<HValue*> worklist_;
|
| @@ -2073,7 +2078,7 @@ void HInferRepresentation::AddToWorklist(HValue* current) {
|
| if (current->representation().IsSpecialization()) return;
|
| if (!current->CheckFlag(HValue::kFlexibleRepresentation)) return;
|
| if (in_worklist_.Contains(current->id())) return;
|
| - worklist_.Add(current);
|
| + worklist_.Add(current, zone());
|
| in_worklist_.Add(current->id());
|
| }
|
|
|
| @@ -2184,12 +2189,12 @@ void HInferRepresentation::Analyze() {
|
| // bit-vector of length <number of phis>.
|
| const ZoneList<HPhi*>* phi_list = graph_->phi_list();
|
| int phi_count = phi_list->length();
|
| - ZoneList<BitVector*> connected_phis(phi_count);
|
| + ZoneList<BitVector*> connected_phis(phi_count, graph_->zone());
|
| for (int i = 0; i < phi_count; ++i) {
|
| phi_list->at(i)->InitRealUses(i);
|
| BitVector* connected_set = new(zone()) BitVector(phi_count, graph_->zone());
|
| connected_set->Add(i);
|
| - connected_phis.Add(connected_set);
|
| + connected_phis.Add(connected_set, zone());
|
| }
|
|
|
| // (2) Do a fixed point iteration to find the set of connected phis. A
|
| @@ -2298,9 +2303,9 @@ void HGraph::InitializeInferredTypes(int from_inclusive, int to_inclusive) {
|
| i = last_back_edge->block_id();
|
| // Update phis of the loop header now after the whole loop body is
|
| // guaranteed to be processed.
|
| - ZoneList<HValue*> worklist(block->phis()->length());
|
| + ZoneList<HValue*> worklist(block->phis()->length(), zone());
|
| for (int j = 0; j < block->phis()->length(); ++j) {
|
| - worklist.Add(block->phis()->at(j));
|
| + worklist.Add(block->phis()->at(j), zone());
|
| }
|
| InferTypes(&worklist);
|
| }
|
| @@ -2367,8 +2372,8 @@ void HGraph::InsertRepresentationChangeForUse(HValue* value,
|
| HConstant* constant = HConstant::cast(value);
|
| // Try to create a new copy of the constant with the new representation.
|
| new_value = is_truncating
|
| - ? constant->CopyToTruncatedInt32()
|
| - : constant->CopyToRepresentation(to);
|
| + ? constant->CopyToTruncatedInt32(zone())
|
| + : constant->CopyToRepresentation(to, zone());
|
| }
|
|
|
| if (new_value == NULL) {
|
| @@ -2787,7 +2792,7 @@ void HGraphBuilder::VisitExpressions(ZoneList<Expression*>* exprs) {
|
|
|
|
|
| HGraph* HGraphBuilder::CreateGraph() {
|
| - graph_ = new(zone()) HGraph(info());
|
| + graph_ = new(zone()) HGraph(info(), zone());
|
| if (FLAG_hydrogen_stats) HStatistics::Instance()->Initialize(info());
|
|
|
| {
|
| @@ -3138,20 +3143,22 @@ static bool BoundsCheckKeyMatch(void* key1, void* key2) {
|
|
|
| class BoundsCheckTable : private ZoneHashMap {
|
| public:
|
| - BoundsCheckBbData** LookupOrInsert(BoundsCheckKey* key) {
|
| + BoundsCheckBbData** LookupOrInsert(BoundsCheckKey* key, Zone* zone) {
|
| return reinterpret_cast<BoundsCheckBbData**>(
|
| - &(Lookup(key, key->Hash(), true)->value));
|
| + &(Lookup(key, key->Hash(), true, ZoneAllocationPolicy(zone))->value));
|
| }
|
|
|
| - void Insert(BoundsCheckKey* key, BoundsCheckBbData* data) {
|
| - Lookup(key, key->Hash(), true)->value = data;
|
| + void Insert(BoundsCheckKey* key, BoundsCheckBbData* data, Zone* zone) {
|
| + Lookup(key, key->Hash(), true, ZoneAllocationPolicy(zone))->value = data;
|
| }
|
|
|
| void Delete(BoundsCheckKey* key) {
|
| Remove(key, key->Hash());
|
| }
|
|
|
| - BoundsCheckTable() : ZoneHashMap(BoundsCheckKeyMatch) { }
|
| + explicit BoundsCheckTable(Zone* zone)
|
| + : ZoneHashMap(BoundsCheckKeyMatch, ZoneHashMap::kDefaultHashMapCapacity,
|
| + ZoneAllocationPolicy(zone)) { }
|
| };
|
|
|
|
|
| @@ -3174,8 +3181,8 @@ void HGraph::EliminateRedundantBoundsChecks(HBasicBlock* bb,
|
|
|
| int32_t offset;
|
| BoundsCheckKey* key =
|
| - BoundsCheckKey::Create(bb->zone(), check, &offset);
|
| - BoundsCheckBbData** data_p = table->LookupOrInsert(key);
|
| + BoundsCheckKey::Create(zone(), check, &offset);
|
| + BoundsCheckBbData** data_p = table->LookupOrInsert(key, zone());
|
| BoundsCheckBbData* data = *data_p;
|
| if (data == NULL) {
|
| bb_data_list = new(zone()) BoundsCheckBbData(key,
|
| @@ -3197,14 +3204,14 @@ void HGraph::EliminateRedundantBoundsChecks(HBasicBlock* bb,
|
| int32_t new_upper_offset = offset > data->UpperOffset()
|
| ? offset
|
| : data->UpperOffset();
|
| - bb_data_list = new(bb->zone()) BoundsCheckBbData(key,
|
| - new_lower_offset,
|
| - new_upper_offset,
|
| - bb,
|
| - check,
|
| - bb_data_list,
|
| - data);
|
| - table->Insert(key, bb_data_list);
|
| + bb_data_list = new(zone()) BoundsCheckBbData(key,
|
| + new_lower_offset,
|
| + new_upper_offset,
|
| + bb,
|
| + check,
|
| + bb_data_list,
|
| + data);
|
| + table->Insert(key, bb_data_list, zone());
|
| }
|
| }
|
|
|
| @@ -3217,7 +3224,7 @@ void HGraph::EliminateRedundantBoundsChecks(HBasicBlock* bb,
|
| data = data->NextInBasicBlock()) {
|
| data->RemoveZeroOperations();
|
| if (data->FatherInDominatorTree()) {
|
| - table->Insert(data->Key(), data->FatherInDominatorTree());
|
| + table->Insert(data->Key(), data->FatherInDominatorTree(), zone());
|
| } else {
|
| table->Delete(data->Key());
|
| }
|
| @@ -3228,7 +3235,7 @@ void HGraph::EliminateRedundantBoundsChecks(HBasicBlock* bb,
|
| void HGraph::EliminateRedundantBoundsChecks() {
|
| HPhase phase("H_Eliminate bounds checks", this);
|
| AssertNoAllocation no_gc;
|
| - BoundsCheckTable checks_table;
|
| + BoundsCheckTable checks_table(zone());
|
| EliminateRedundantBoundsChecks(entry_block(), &checks_table);
|
| }
|
|
|
| @@ -3348,9 +3355,9 @@ void HGraphBuilder::PushAndAdd(HInstruction* instr) {
|
| template <class Instruction>
|
| HInstruction* HGraphBuilder::PreProcessCall(Instruction* call) {
|
| int count = call->argument_count();
|
| - ZoneList<HValue*> arguments(count);
|
| + ZoneList<HValue*> arguments(count, zone());
|
| for (int i = 0; i < count; ++i) {
|
| - arguments.Add(Pop());
|
| + arguments.Add(Pop(), zone());
|
| }
|
|
|
| while (!arguments.is_empty()) {
|
| @@ -3850,13 +3857,13 @@ bool HGraphBuilder::PreProcessOsrEntry(IterationStatement* statement) {
|
| int first_expression_index = environment()->first_expression_index();
|
| int length = environment()->length();
|
| ZoneList<HUnknownOSRValue*>* osr_values =
|
| - new(zone()) ZoneList<HUnknownOSRValue*>(length);
|
| + new(zone()) ZoneList<HUnknownOSRValue*>(length, zone());
|
|
|
| for (int i = 0; i < first_expression_index; ++i) {
|
| HUnknownOSRValue* osr_value = new(zone()) HUnknownOSRValue;
|
| AddInstruction(osr_value);
|
| environment()->Bind(i, osr_value);
|
| - osr_values->Add(osr_value);
|
| + osr_values->Add(osr_value, zone());
|
| }
|
|
|
| if (first_expression_index != length) {
|
| @@ -3865,7 +3872,7 @@ bool HGraphBuilder::PreProcessOsrEntry(IterationStatement* statement) {
|
| HUnknownOSRValue* osr_value = new(zone()) HUnknownOSRValue;
|
| AddInstruction(osr_value);
|
| environment()->Push(osr_value);
|
| - osr_values->Add(osr_value);
|
| + osr_values->Add(osr_value, zone());
|
| }
|
| }
|
|
|
| @@ -4493,7 +4500,7 @@ void HGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) {
|
| // of the property values and is the value of the entire expression.
|
| PushAndAdd(literal);
|
|
|
| - expr->CalculateEmitStore();
|
| + expr->CalculateEmitStore(zone());
|
|
|
| for (int i = 0; i < expr->properties()->length(); i++) {
|
| ObjectLiteral::Property* property = expr->properties()->at(i);
|
| @@ -4683,7 +4690,7 @@ HInstruction* HGraphBuilder::BuildStoreNamedField(HValue* object,
|
| ASSERT(lookup->IsFound());
|
| if (smi_and_map_check) {
|
| AddInstruction(new(zone()) HCheckNonSmi(object));
|
| - AddInstruction(HCheckMaps::NewWithTransitions(object, type));
|
| + AddInstruction(HCheckMaps::NewWithTransitions(object, type, zone()));
|
| }
|
|
|
| // If the property does not exist yet, we have to check that it wasn't made
|
| @@ -4828,14 +4835,15 @@ void HGraphBuilder::HandlePolymorphicLoadNamedField(Property* expr,
|
| // for all maps. Requires special map check on the set of all handled maps.
|
| HInstruction* instr;
|
| if (count == types->length() && is_monomorphic_field) {
|
| - AddInstruction(new(zone()) HCheckMaps(object, types));
|
| + AddInstruction(new(zone()) HCheckMaps(object, types, zone()));
|
| instr = BuildLoadNamedField(object, expr, map, &lookup, false);
|
| } else {
|
| HValue* context = environment()->LookupContext();
|
| instr = new(zone()) HLoadNamedFieldPolymorphic(context,
|
| object,
|
| types,
|
| - name);
|
| + name,
|
| + zone());
|
| }
|
|
|
| instr->set_position(expr->position());
|
| @@ -4922,7 +4930,7 @@ void HGraphBuilder::HandlePolymorphicStoreNamedField(Assignment* expr,
|
| void HGraphBuilder::HandlePropertyAssignment(Assignment* expr) {
|
| Property* prop = expr->target()->AsProperty();
|
| ASSERT(prop != NULL);
|
| - expr->RecordTypeFeedback(oracle());
|
| + expr->RecordTypeFeedback(oracle(), zone());
|
| CHECK_ALIVE(VisitForValue(prop->obj()));
|
|
|
| HValue* value = NULL;
|
| @@ -5093,7 +5101,7 @@ void HGraphBuilder::HandleCompoundAssignment(Assignment* expr) {
|
| return ast_context()->ReturnValue(Pop());
|
|
|
| } else if (prop != NULL) {
|
| - prop->RecordTypeFeedback(oracle());
|
| + prop->RecordTypeFeedback(oracle(), zone());
|
|
|
| if (prop->key()->IsPropertyName()) {
|
| // Named property.
|
| @@ -5152,7 +5160,7 @@ void HGraphBuilder::HandleCompoundAssignment(Assignment* expr) {
|
| PushAndAdd(instr);
|
| if (instr->HasObservableSideEffects()) AddSimulate(operation->id());
|
|
|
| - expr->RecordTypeFeedback(oracle());
|
| + expr->RecordTypeFeedback(oracle(), zone());
|
| HandleKeyedElementAccess(obj, key, instr, expr, expr->AssignmentId(),
|
| RelocInfo::kNoPosition,
|
| true, // is_store
|
| @@ -5200,7 +5208,7 @@ void HGraphBuilder::VisitAssignment(Assignment* expr) {
|
| // We insert a use of the old value to detect unsupported uses of const
|
| // variables (e.g. initialization inside a loop).
|
| HValue* old_value = environment()->Lookup(var);
|
| - AddInstruction(new HUseConst(old_value));
|
| + AddInstruction(new(zone()) HUseConst(old_value));
|
| }
|
| } else if (var->mode() == CONST_HARMONY) {
|
| if (expr->op() != Token::INIT_CONST_HARMONY) {
|
| @@ -5327,7 +5335,7 @@ HLoadNamedField* HGraphBuilder::BuildLoadNamedField(HValue* object,
|
| bool smi_and_map_check) {
|
| if (smi_and_map_check) {
|
| AddInstruction(new(zone()) HCheckNonSmi(object));
|
| - AddInstruction(HCheckMaps::NewWithTransitions(object, type));
|
| + AddInstruction(HCheckMaps::NewWithTransitions(object, type, zone()));
|
| }
|
|
|
| int index = lookup->GetLocalFieldIndexFromMap(*type);
|
| @@ -5371,7 +5379,7 @@ HInstruction* HGraphBuilder::BuildLoadNamed(HValue* obj,
|
| true);
|
| } else if (lookup.IsFound() && lookup.type() == CONSTANT_FUNCTION) {
|
| AddInstruction(new(zone()) HCheckNonSmi(obj));
|
| - AddInstruction(HCheckMaps::NewWithTransitions(obj, map));
|
| + AddInstruction(HCheckMaps::NewWithTransitions(obj, map, zone()));
|
| Handle<JSFunction> function(lookup.GetConstantFunctionFromMap(*map));
|
| return new(zone()) HConstant(function, Representation::Tagged());
|
| } else {
|
| @@ -5484,7 +5492,7 @@ HInstruction* HGraphBuilder::BuildMonomorphicElementAccess(HValue* object,
|
| Handle<Map> map,
|
| bool is_store) {
|
| HInstruction* mapcheck =
|
| - AddInstruction(new(zone()) HCheckMaps(object, map, dependency));
|
| + AddInstruction(new(zone()) HCheckMaps(object, map, zone(), dependency));
|
| // No GVNFlag is necessary for ElementsKind if there is an explicit dependency
|
| // on a HElementsTransition instruction. The flag can also be removed if the
|
| // map to check has FAST_HOLEY_ELEMENTS, since there can be no further
|
| @@ -5501,7 +5509,7 @@ HInstruction* HGraphBuilder::BuildMonomorphicElementAccess(HValue* object,
|
| HInstruction* elements = AddInstruction(new(zone()) HLoadElements(object));
|
| if (is_store && (fast_elements || fast_smi_only_elements)) {
|
| HCheckMaps* check_cow_map = new(zone()) HCheckMaps(
|
| - elements, isolate()->factory()->fixed_array_map());
|
| + elements, isolate()->factory()->fixed_array_map(), zone());
|
| check_cow_map->ClearGVNFlag(kDependsOnElementsKind);
|
| AddInstruction(check_cow_map);
|
| }
|
| @@ -5608,7 +5616,7 @@ HValue* HGraphBuilder::HandlePolymorphicElementAccess(HValue* object,
|
| return is_store ? NULL : instr;
|
| }
|
|
|
| - AddInstruction(HCheckInstanceType::NewIsSpecObject(object));
|
| + AddInstruction(HCheckInstanceType::NewIsSpecObject(object, zone()));
|
| HBasicBlock* join = graph()->CreateBasicBlock();
|
|
|
| HInstruction* elements_kind_instr =
|
| @@ -5655,7 +5663,7 @@ HValue* HGraphBuilder::HandlePolymorphicElementAccess(HValue* object,
|
| if (is_store && !IsFastDoubleElementsKind(elements_kind)) {
|
| AddInstruction(new(zone()) HCheckMaps(
|
| elements, isolate()->factory()->fixed_array_map(),
|
| - elements_kind_branch));
|
| + zone(), elements_kind_branch));
|
| }
|
| // TODO(jkummerow): The need for these two blocks could be avoided
|
| // in one of two ways:
|
| @@ -5862,7 +5870,7 @@ void HGraphBuilder::VisitProperty(Property* expr) {
|
| ASSERT(!HasStackOverflow());
|
| ASSERT(current_block() != NULL);
|
| ASSERT(current_block()->HasPredecessor());
|
| - expr->RecordTypeFeedback(oracle());
|
| + expr->RecordTypeFeedback(oracle(), zone());
|
|
|
| if (TryArgumentsAccess(expr)) return;
|
|
|
| @@ -5873,13 +5881,13 @@ void HGraphBuilder::VisitProperty(Property* expr) {
|
| HValue* array = Pop();
|
| AddInstruction(new(zone()) HCheckNonSmi(array));
|
| HInstruction* mapcheck =
|
| - AddInstruction(HCheckInstanceType::NewIsJSArray(array));
|
| + AddInstruction(HCheckInstanceType::NewIsJSArray(array, zone()));
|
| instr = new(zone()) HJSArrayLength(array, mapcheck);
|
|
|
| } else if (expr->IsStringLength()) {
|
| HValue* string = Pop();
|
| AddInstruction(new(zone()) HCheckNonSmi(string));
|
| - AddInstruction(HCheckInstanceType::NewIsString(string));
|
| + AddInstruction(HCheckInstanceType::NewIsString(string, zone()));
|
| instr = new(zone()) HStringLength(string);
|
| } else if (expr->IsStringAccess()) {
|
| CHECK_ALIVE(VisitForValue(expr->key()));
|
| @@ -5947,7 +5955,8 @@ void HGraphBuilder::AddCheckConstantFunction(Call* expr,
|
| // its prototypes.
|
| if (smi_and_map_check) {
|
| AddInstruction(new(zone()) HCheckNonSmi(receiver));
|
| - AddInstruction(HCheckMaps::NewWithTransitions(receiver, receiver_map));
|
| + AddInstruction(HCheckMaps::NewWithTransitions(receiver, receiver_map,
|
| + zone()));
|
| }
|
| if (!expr->holder().is_null()) {
|
| AddInstruction(new(zone()) HCheckPrototypeMaps(
|
| @@ -6282,7 +6291,7 @@ bool HGraphBuilder::TryInline(CallKind call_kind,
|
| // The scope info might not have been set if a lazily compiled
|
| // function is inlined before being called for the first time.
|
| Handle<ScopeInfo> target_scope_info =
|
| - ScopeInfo::Create(target_info.scope());
|
| + ScopeInfo::Create(target_info.scope(), zone());
|
| target_shared->set_scope_info(*target_scope_info);
|
| }
|
| target_shared->EnableDeoptimizationSupport(*target_info.code());
|
| @@ -6301,7 +6310,8 @@ bool HGraphBuilder::TryInline(CallKind call_kind,
|
| TypeFeedbackOracle target_oracle(
|
| Handle<Code>(target_shared->code()),
|
| Handle<Context>(target->context()->global_context()),
|
| - isolate());
|
| + isolate(),
|
| + zone());
|
| // The function state is new-allocated because we need to delete it
|
| // in two different places.
|
| FunctionState* target_state = new FunctionState(
|
| @@ -6321,8 +6331,9 @@ bool HGraphBuilder::TryInline(CallKind call_kind,
|
| //
|
| // TODO(kmillikin): implement the same inlining on other platforms so we
|
| // can remove the unsightly ifdefs in this function.
|
| - HConstant* context = new HConstant(Handle<Context>(target->context()),
|
| - Representation::Tagged());
|
| + HConstant* context =
|
| + new(zone()) HConstant(Handle<Context>(target->context()),
|
| + Representation::Tagged());
|
| AddInstruction(context);
|
| inner_env->BindContext(context);
|
| #endif
|
| @@ -6337,9 +6348,9 @@ bool HGraphBuilder::TryInline(CallKind call_kind,
|
| if (function->scope()->arguments() != NULL) {
|
| HEnvironment* arguments_env = inner_env->arguments_environment();
|
| int arguments_count = arguments_env->parameter_count();
|
| - arguments_values = new(zone()) ZoneList<HValue*>(arguments_count);
|
| + arguments_values = new(zone()) ZoneList<HValue*>(arguments_count, zone());
|
| for (int i = 0; i < arguments_count; i++) {
|
| - arguments_values->Add(arguments_env->Lookup(i));
|
| + arguments_values->Add(arguments_env->Lookup(i), zone());
|
| }
|
| }
|
|
|
| @@ -6934,8 +6945,8 @@ void HGraphBuilder::VisitCall(Call* expr) {
|
| HValue* function = Top();
|
| HValue* context = environment()->LookupContext();
|
| HGlobalObject* global = new(zone()) HGlobalObject(context);
|
| - HGlobalReceiver* receiver = new(zone()) HGlobalReceiver(global);
|
| AddInstruction(global);
|
| + HGlobalReceiver* receiver = new(zone()) HGlobalReceiver(global);
|
| PushAndAdd(receiver);
|
| CHECK_ALIVE(VisitExpressions(expr->arguments()));
|
| AddInstruction(new(zone()) HCheckFunction(function, expr->target()));
|
| @@ -6965,8 +6976,8 @@ void HGraphBuilder::VisitCall(Call* expr) {
|
| HValue* function = Top();
|
| HValue* context = environment()->LookupContext();
|
| HGlobalObject* global_object = new(zone()) HGlobalObject(context);
|
| - HGlobalReceiver* receiver = new(zone()) HGlobalReceiver(global_object);
|
| AddInstruction(global_object);
|
| + HGlobalReceiver* receiver = new(zone()) HGlobalReceiver(global_object);
|
| AddInstruction(receiver);
|
| PushAndAdd(new(zone()) HPushArgument(receiver));
|
| CHECK_ALIVE(VisitArgumentList(expr->arguments()));
|
| @@ -7372,7 +7383,7 @@ void HGraphBuilder::VisitCountOperation(CountOperation* expr) {
|
| } else {
|
| // Argument of the count operation is a property.
|
| ASSERT(prop != NULL);
|
| - prop->RecordTypeFeedback(oracle());
|
| + prop->RecordTypeFeedback(oracle(), zone());
|
|
|
| if (prop->key()->IsPropertyName()) {
|
| // Named property.
|
| @@ -7426,7 +7437,7 @@ void HGraphBuilder::VisitCountOperation(CountOperation* expr) {
|
| after = BuildIncrement(returns_original_input, expr);
|
| input = Pop();
|
|
|
| - expr->RecordTypeFeedback(oracle());
|
| + expr->RecordTypeFeedback(oracle(), zone());
|
| HandleKeyedElementAccess(obj, key, after, expr, expr->AssignmentId(),
|
| RelocInfo::kNoPosition,
|
| true, // is_store
|
| @@ -7452,7 +7463,7 @@ HStringCharCodeAt* HGraphBuilder::BuildStringCharCodeAt(HValue* context,
|
| HValue* string,
|
| HValue* index) {
|
| AddInstruction(new(zone()) HCheckNonSmi(string));
|
| - AddInstruction(HCheckInstanceType::NewIsString(string));
|
| + AddInstruction(HCheckInstanceType::NewIsString(string, zone()));
|
| HStringLength* length = new(zone()) HStringLength(string);
|
| AddInstruction(length);
|
| HInstruction* checked_index =
|
| @@ -7476,9 +7487,9 @@ HInstruction* HGraphBuilder::BuildBinaryOperation(BinaryOperation* expr,
|
| case Token::ADD:
|
| if (info.IsString()) {
|
| AddInstruction(new(zone()) HCheckNonSmi(left));
|
| - AddInstruction(HCheckInstanceType::NewIsString(left));
|
| + AddInstruction(HCheckInstanceType::NewIsString(left, zone()));
|
| AddInstruction(new(zone()) HCheckNonSmi(right));
|
| - AddInstruction(HCheckInstanceType::NewIsString(right));
|
| + AddInstruction(HCheckInstanceType::NewIsString(right, zone()));
|
| instr = new(zone()) HStringAdd(context, left, right);
|
| } else {
|
| instr = HAdd::NewHAdd(zone(), context, left, right);
|
| @@ -7880,18 +7891,18 @@ void HGraphBuilder::VisitCompareOperation(CompareOperation* expr) {
|
| Handle<Map> map = oracle()->GetCompareMap(expr);
|
| if (!map.is_null()) {
|
| AddInstruction(new(zone()) HCheckNonSmi(left));
|
| - AddInstruction(HCheckMaps::NewWithTransitions(left, map));
|
| + AddInstruction(HCheckMaps::NewWithTransitions(left, map, zone()));
|
| AddInstruction(new(zone()) HCheckNonSmi(right));
|
| - AddInstruction(HCheckMaps::NewWithTransitions(right, map));
|
| + AddInstruction(HCheckMaps::NewWithTransitions(right, map, zone()));
|
| HCompareObjectEqAndBranch* result =
|
| new(zone()) HCompareObjectEqAndBranch(left, right);
|
| result->set_position(expr->position());
|
| return ast_context()->ReturnControl(result, expr->id());
|
| } else {
|
| AddInstruction(new(zone()) HCheckNonSmi(left));
|
| - AddInstruction(HCheckInstanceType::NewIsSpecObject(left));
|
| + AddInstruction(HCheckInstanceType::NewIsSpecObject(left, zone()));
|
| AddInstruction(new(zone()) HCheckNonSmi(right));
|
| - AddInstruction(HCheckInstanceType::NewIsSpecObject(right));
|
| + AddInstruction(HCheckInstanceType::NewIsSpecObject(right, zone()));
|
| HCompareObjectEqAndBranch* result =
|
| new(zone()) HCompareObjectEqAndBranch(left, right);
|
| result->set_position(expr->position());
|
| @@ -7904,9 +7915,9 @@ void HGraphBuilder::VisitCompareOperation(CompareOperation* expr) {
|
| } else if (type_info.IsString() && oracle()->IsSymbolCompare(expr) &&
|
| (op == Token::EQ || op == Token::EQ_STRICT)) {
|
| AddInstruction(new(zone()) HCheckNonSmi(left));
|
| - AddInstruction(HCheckInstanceType::NewIsSymbol(left));
|
| + AddInstruction(HCheckInstanceType::NewIsSymbol(left, zone()));
|
| AddInstruction(new(zone()) HCheckNonSmi(right));
|
| - AddInstruction(HCheckInstanceType::NewIsSymbol(right));
|
| + AddInstruction(HCheckInstanceType::NewIsSymbol(right, zone()));
|
| HCompareObjectEqAndBranch* result =
|
| new(zone()) HCompareObjectEqAndBranch(left, right);
|
| result->set_position(expr->position());
|
| @@ -7978,10 +7989,10 @@ void HGraphBuilder::VisitVariableDeclaration(VariableDeclaration* declaration) {
|
| bool hole_init = mode == CONST || mode == CONST_HARMONY || mode == LET;
|
| switch (variable->location()) {
|
| case Variable::UNALLOCATED:
|
| - globals_.Add(variable->name());
|
| + globals_.Add(variable->name(), zone());
|
| globals_.Add(variable->binding_needs_init()
|
| ? isolate()->factory()->the_hole_value()
|
| - : isolate()->factory()->undefined_value());
|
| + : isolate()->factory()->undefined_value(), zone());
|
| return;
|
| case Variable::PARAMETER:
|
| case Variable::LOCAL:
|
| @@ -7994,7 +8005,7 @@ void HGraphBuilder::VisitVariableDeclaration(VariableDeclaration* declaration) {
|
| if (hole_init) {
|
| HValue* value = graph()->GetConstantHole();
|
| HValue* context = environment()->LookupContext();
|
| - HStoreContextSlot* store = new HStoreContextSlot(
|
| + HStoreContextSlot* store = new(zone()) HStoreContextSlot(
|
| context, variable->index(), HStoreContextSlot::kNoCheck, value);
|
| AddInstruction(store);
|
| if (store->HasObservableSideEffects()) AddSimulate(proxy->id());
|
| @@ -8011,12 +8022,12 @@ void HGraphBuilder::VisitFunctionDeclaration(FunctionDeclaration* declaration) {
|
| Variable* variable = proxy->var();
|
| switch (variable->location()) {
|
| case Variable::UNALLOCATED: {
|
| - globals_.Add(variable->name());
|
| + globals_.Add(variable->name(), zone());
|
| Handle<SharedFunctionInfo> function =
|
| Compiler::BuildFunctionInfo(declaration->fun(), info()->script());
|
| // Check for stack-overflow exception.
|
| if (function.is_null()) return SetStackOverflow();
|
| - globals_.Add(function);
|
| + globals_.Add(function, zone());
|
| return;
|
| }
|
| case Variable::PARAMETER:
|
| @@ -8030,7 +8041,7 @@ void HGraphBuilder::VisitFunctionDeclaration(FunctionDeclaration* declaration) {
|
| CHECK_ALIVE(VisitForValue(declaration->fun()));
|
| HValue* value = Pop();
|
| HValue* context = environment()->LookupContext();
|
| - HStoreContextSlot* store = new HStoreContextSlot(
|
| + HStoreContextSlot* store = new(zone()) HStoreContextSlot(
|
| context, variable->index(), HStoreContextSlot::kNoCheck, value);
|
| AddInstruction(store);
|
| if (store->HasObservableSideEffects()) AddSimulate(proxy->id());
|
| @@ -8276,11 +8287,11 @@ void HGraphBuilder::GenerateSetValueOf(CallRuntime* call) {
|
| // Create in-object property store to kValueOffset.
|
| set_current_block(if_js_value);
|
| Handle<String> name = isolate()->factory()->undefined_symbol();
|
| - AddInstruction(new HStoreNamedField(object,
|
| - name,
|
| - value,
|
| - true, // in-object store.
|
| - JSValue::kValueOffset));
|
| + AddInstruction(new(zone()) HStoreNamedField(object,
|
| + name,
|
| + value,
|
| + true, // in-object store.
|
| + JSValue::kValueOffset));
|
| if_js_value->Goto(join);
|
| join->SetJoinId(call->id());
|
| set_current_block(join);
|
| @@ -8568,10 +8579,11 @@ void HGraphBuilder::GenerateFastAsciiArrayJoin(CallRuntime* call) {
|
|
|
| HEnvironment::HEnvironment(HEnvironment* outer,
|
| Scope* scope,
|
| - Handle<JSFunction> closure)
|
| + Handle<JSFunction> closure,
|
| + Zone* zone)
|
| : closure_(closure),
|
| - values_(0),
|
| - assigned_variables_(4),
|
| + values_(0, zone),
|
| + assigned_variables_(4, zone),
|
| frame_type_(JS_FUNCTION),
|
| parameter_count_(0),
|
| specials_count_(1),
|
| @@ -8579,14 +8591,15 @@ HEnvironment::HEnvironment(HEnvironment* outer,
|
| outer_(outer),
|
| pop_count_(0),
|
| push_count_(0),
|
| - ast_id_(AstNode::kNoNumber) {
|
| + ast_id_(AstNode::kNoNumber),
|
| + zone_(zone) {
|
| Initialize(scope->num_parameters() + 1, scope->num_stack_slots(), 0);
|
| }
|
|
|
|
|
| -HEnvironment::HEnvironment(const HEnvironment* other)
|
| - : values_(0),
|
| - assigned_variables_(0),
|
| +HEnvironment::HEnvironment(const HEnvironment* other, Zone* zone)
|
| + : values_(0, zone),
|
| + assigned_variables_(0, zone),
|
| frame_type_(JS_FUNCTION),
|
| parameter_count_(0),
|
| specials_count_(1),
|
| @@ -8594,7 +8607,8 @@ HEnvironment::HEnvironment(const HEnvironment* other)
|
| outer_(NULL),
|
| pop_count_(0),
|
| push_count_(0),
|
| - ast_id_(other->ast_id()) {
|
| + ast_id_(other->ast_id()),
|
| + zone_(zone) {
|
| Initialize(other);
|
| }
|
|
|
| @@ -8602,17 +8616,19 @@ HEnvironment::HEnvironment(const HEnvironment* other)
|
| HEnvironment::HEnvironment(HEnvironment* outer,
|
| Handle<JSFunction> closure,
|
| FrameType frame_type,
|
| - int arguments)
|
| + int arguments,
|
| + Zone* zone)
|
| : closure_(closure),
|
| - values_(arguments),
|
| - assigned_variables_(0),
|
| + values_(arguments, zone),
|
| + assigned_variables_(0, zone),
|
| frame_type_(frame_type),
|
| parameter_count_(arguments),
|
| local_count_(0),
|
| outer_(outer),
|
| pop_count_(0),
|
| push_count_(0),
|
| - ast_id_(AstNode::kNoNumber) {
|
| + ast_id_(AstNode::kNoNumber),
|
| + zone_(zone) {
|
| }
|
|
|
|
|
| @@ -8624,15 +8640,15 @@ void HEnvironment::Initialize(int parameter_count,
|
|
|
| // Avoid reallocating the temporaries' backing store on the first Push.
|
| int total = parameter_count + specials_count_ + local_count + stack_height;
|
| - values_.Initialize(total + 4);
|
| - for (int i = 0; i < total; ++i) values_.Add(NULL);
|
| + values_.Initialize(total + 4, zone());
|
| + for (int i = 0; i < total; ++i) values_.Add(NULL, zone());
|
| }
|
|
|
|
|
| void HEnvironment::Initialize(const HEnvironment* other) {
|
| closure_ = other->closure();
|
| - values_.AddAll(other->values_);
|
| - assigned_variables_.AddAll(other->assigned_variables_);
|
| + values_.AddAll(other->values_, zone());
|
| + assigned_variables_.AddAll(other->assigned_variables_, zone());
|
| frame_type_ = other->frame_type_;
|
| parameter_count_ = other->parameter_count_;
|
| local_count_ = other->local_count_;
|
| @@ -8660,7 +8676,7 @@ void HEnvironment::AddIncomingEdge(HBasicBlock* block, HEnvironment* other) {
|
| } else if (values_[i] != other->values_[i]) {
|
| // There is a fresh value on the incoming edge, a phi is needed.
|
| ASSERT(values_[i] != NULL && other->values_[i] != NULL);
|
| - HPhi* phi = new(block->zone()) HPhi(i);
|
| + HPhi* phi = new(zone()) HPhi(i, zone());
|
| HValue* old_value = values_[i];
|
| for (int j = 0; j < block->predecessors()->length(); j++) {
|
| phi->AddInput(old_value);
|
| @@ -8676,7 +8692,7 @@ void HEnvironment::AddIncomingEdge(HBasicBlock* block, HEnvironment* other) {
|
| void HEnvironment::Bind(int index, HValue* value) {
|
| ASSERT(value != NULL);
|
| if (!assigned_variables_.Contains(index)) {
|
| - assigned_variables_.Add(index);
|
| + assigned_variables_.Add(index, zone());
|
| }
|
| values_[index] = value;
|
| }
|
| @@ -8716,7 +8732,7 @@ void HEnvironment::Drop(int count) {
|
|
|
|
|
| HEnvironment* HEnvironment::Copy() const {
|
| - return new(closure()->GetIsolate()->zone()) HEnvironment(this);
|
| + return new(zone()) HEnvironment(this, zone());
|
| }
|
|
|
|
|
| @@ -8730,7 +8746,7 @@ HEnvironment* HEnvironment::CopyWithoutHistory() const {
|
| HEnvironment* HEnvironment::CopyAsLoopHeader(HBasicBlock* loop_header) const {
|
| HEnvironment* new_env = Copy();
|
| for (int i = 0; i < values_.length(); ++i) {
|
| - HPhi* phi = new(loop_header->zone()) HPhi(i);
|
| + HPhi* phi = new(zone()) HPhi(i, zone());
|
| phi->AddInput(values_[i]);
|
| new_env->values_[i] = phi;
|
| loop_header->AddPhi(phi);
|
| @@ -8744,8 +8760,9 @@ HEnvironment* HEnvironment::CreateStubEnvironment(HEnvironment* outer,
|
| Handle<JSFunction> target,
|
| FrameType frame_type,
|
| int arguments) const {
|
| - HEnvironment* new_env = new(closure()->GetIsolate()->zone())
|
| - HEnvironment(outer, target, frame_type, arguments + 1);
|
| + HEnvironment* new_env =
|
| + new(zone()) HEnvironment(outer, target, frame_type,
|
| + arguments + 1, zone());
|
| for (int i = 0; i <= arguments; ++i) { // Include receiver.
|
| new_env->Push(ExpressionStackAt(arguments - i));
|
| }
|
| @@ -8785,7 +8802,7 @@ HEnvironment* HEnvironment::CopyForInlining(
|
| }
|
|
|
| HEnvironment* inner =
|
| - new(zone) HEnvironment(outer, function->scope(), target);
|
| + new(zone) HEnvironment(outer, function->scope(), target, zone);
|
| // Get the argument values from the original environment.
|
| for (int i = 0; i <= arity; ++i) { // Include receiver.
|
| HValue* push = (i <= arguments) ?
|
| @@ -8975,27 +8992,28 @@ void HTracer::TraceLiveRanges(const char* name, LAllocator* allocator) {
|
|
|
| const Vector<LiveRange*>* fixed_d = allocator->fixed_double_live_ranges();
|
| for (int i = 0; i < fixed_d->length(); ++i) {
|
| - TraceLiveRange(fixed_d->at(i), "fixed");
|
| + TraceLiveRange(fixed_d->at(i), "fixed", allocator->zone());
|
| }
|
|
|
| const Vector<LiveRange*>* fixed = allocator->fixed_live_ranges();
|
| for (int i = 0; i < fixed->length(); ++i) {
|
| - TraceLiveRange(fixed->at(i), "fixed");
|
| + TraceLiveRange(fixed->at(i), "fixed", allocator->zone());
|
| }
|
|
|
| const ZoneList<LiveRange*>* live_ranges = allocator->live_ranges();
|
| for (int i = 0; i < live_ranges->length(); ++i) {
|
| - TraceLiveRange(live_ranges->at(i), "object");
|
| + TraceLiveRange(live_ranges->at(i), "object", allocator->zone());
|
| }
|
| }
|
|
|
|
|
| -void HTracer::TraceLiveRange(LiveRange* range, const char* type) {
|
| +void HTracer::TraceLiveRange(LiveRange* range, const char* type,
|
| + Zone* zone) {
|
| if (range != NULL && !range->IsEmpty()) {
|
| PrintIndent();
|
| trace_.Add("%d %s", range->id(), type);
|
| if (range->HasRegisterAssigned()) {
|
| - LOperand* op = range->CreateAssignedOperand(ZONE);
|
| + LOperand* op = range->CreateAssignedOperand(zone);
|
| int assigned_reg = op->index();
|
| if (op->IsDoubleRegister()) {
|
| trace_.Add(" \"%s\"",
|
|
|