From 7de6be06cf110d4626b4de8dd32ae5b2dde8958e Mon Sep 17 00:00:00 2001 From: "fschneider@chromium.org" Date: Wed, 22 Feb 2012 11:40:28 +0000 Subject: [PATCH] Eliminate use of ZONE macro in BitVector class and pass a zone explicitly. Review URL: https://chromiumcodereview.appspot.com/9416092 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10791 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/data-flow.h | 10 +++++----- src/hydrogen.cc | 14 ++++++++------ src/lithium-allocator.cc | 4 ++-- src/lithium-allocator.h | 4 ++-- src/lithium.h | 5 ++--- test/cctest/test-dataflow.cc | 31 ++++++++++++++++--------------- 6 files changed, 35 insertions(+), 33 deletions(-) diff --git a/src/data-flow.h b/src/data-flow.h index d69d6c7a52..71f56e718b 100644 --- a/src/data-flow.h +++ b/src/data-flow.h @@ -1,4 +1,4 @@ -// Copyright 2011 the V8 project authors. All rights reserved. +// Copyright 2012 the V8 project authors. All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: @@ -85,18 +85,18 @@ class BitVector: public ZoneObject { friend class BitVector; }; - explicit BitVector(int length) + BitVector(int length, Zone* zone) : length_(length), data_length_(SizeFor(length)), - data_(ZONE->NewArray(data_length_)) { + data_(zone->NewArray(data_length_)) { ASSERT(length > 0); Clear(); } - BitVector(const BitVector& other) + BitVector(const BitVector& other, Zone* zone) : length_(other.length()), data_length_(SizeFor(length_)), - data_(ZONE->NewArray(data_length_)) { + data_(zone->NewArray(data_length_)) { CopyFrom(other); } diff --git a/src/hydrogen.cc b/src/hydrogen.cc index fac3c60742..8c18acc4d3 100644 --- a/src/hydrogen.cc +++ b/src/hydrogen.cc @@ -446,7 +446,7 @@ class ReachabilityAnalyzer BASE_EMBEDDED { HBasicBlock* dont_visit) : visited_count_(0), stack_(16), - reachable_(block_count), + reachable_(block_count, ZONE), dont_visit_(dont_visit) { PushBlock(entry_block); Analyze(); @@ -744,7 +744,7 @@ void HGraph::Canonicalize() { void HGraph::OrderBlocks() { HPhase phase("Block ordering"); - BitVector visited(blocks_.length()); + BitVector visited(blocks_.length(), zone()); ZoneList reverse_result(8); HBasicBlock* start = blocks_[0]; @@ -955,7 +955,7 @@ void HGraph::CollectPhis() { void HGraph::InferTypes(ZoneList* worklist) { - BitVector in_worklist(GetMaximumValueID()); + BitVector in_worklist(GetMaximumValueID(), zone()); for (int i = 0; i < worklist->length(); ++i) { ASSERT(!in_worklist.Contains(worklist->at(i)->id())); in_worklist.Add(worklist->at(i)->id()); @@ -1719,7 +1719,9 @@ void HGlobalValueNumberer::AnalyzeBlock(HBasicBlock* block, HValueMap* map) { class HInferRepresentation BASE_EMBEDDED { public: explicit HInferRepresentation(HGraph* graph) - : graph_(graph), worklist_(8), in_worklist_(graph->GetMaximumValueID()) {} + : graph_(graph), + worklist_(8), + in_worklist_(graph->GetMaximumValueID(), graph->zone()) { } void Analyze(); @@ -1836,7 +1838,7 @@ void HInferRepresentation::Analyze() { ZoneList connected_phis(phi_count); for (int i = 0; i < phi_count; ++i) { phi_list->at(i)->InitRealUses(i); - BitVector* connected_set = new(zone()) BitVector(phi_count); + BitVector* connected_set = new(zone()) BitVector(phi_count, graph_->zone()); connected_set->Add(i); connected_phis.Add(connected_set); } @@ -2126,7 +2128,7 @@ void HGraph::MarkDeoptimizeOnUndefined() { void HGraph::ComputeMinusZeroChecks() { - BitVector visited(GetMaximumValueID()); + BitVector visited(GetMaximumValueID(), zone()); for (int i = 0; i < blocks_.length(); ++i) { for (HInstruction* current = blocks_[i]->first(); current != NULL; diff --git a/src/lithium-allocator.cc b/src/lithium-allocator.cc index df48ace7d2..20003f05cb 100644 --- a/src/lithium-allocator.cc +++ b/src/lithium-allocator.cc @@ -1,4 +1,4 @@ -// Copyright 2011 the V8 project authors. All rights reserved. +// Copyright 2012 the V8 project authors. All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: @@ -584,7 +584,7 @@ void LAllocator::InitializeLivenessAnalysis() { BitVector* LAllocator::ComputeLiveOut(HBasicBlock* block) { // Compute live out for the given block, except not including backward // successor edges. - BitVector* live_out = new(zone_) BitVector(next_virtual_register_); + BitVector* live_out = new(zone_) BitVector(next_virtual_register_, zone_); // Process all successor blocks. for (HSuccessorIterator it(block->end()); !it.Done(); it.Advance()) { diff --git a/src/lithium-allocator.h b/src/lithium-allocator.h index aa6db7d99b..f5ab055ab3 100644 --- a/src/lithium-allocator.h +++ b/src/lithium-allocator.h @@ -1,4 +1,4 @@ -// Copyright 2011 the V8 project authors. All rights reserved. +// Copyright 2012 the V8 project authors. All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: @@ -424,7 +424,7 @@ class GrowableBitVector BASE_EMBEDDED { if (InBitsRange(value)) return; int new_length = bits_ == NULL ? kInitialLength : bits_->length(); while (new_length <= value) new_length *= 2; - BitVector* new_bits = new(zone) BitVector(new_length); + BitVector* new_bits = new(zone) BitVector(new_length, zone); if (bits_ != NULL) new_bits->CopyFrom(*bits_); bits_ = new_bits; } diff --git a/src/lithium.h b/src/lithium.h index 4987b5a4cd..474e555fec 100644 --- a/src/lithium.h +++ b/src/lithium.h @@ -453,11 +453,10 @@ class LEnvironment: public ZoneObject { parameter_count_(parameter_count), pc_offset_(-1), values_(value_count), - is_tagged_(value_count), + is_tagged_(value_count, closure->GetHeap()->isolate()->zone()), spilled_registers_(NULL), spilled_double_registers_(NULL), - outer_(outer) { - } + outer_(outer) { } Handle closure() const { return closure_; } int arguments_stack_height() const { return arguments_stack_height_; } diff --git a/test/cctest/test-dataflow.cc b/test/cctest/test-dataflow.cc index ad48f55033..a63008d210 100644 --- a/test/cctest/test-dataflow.cc +++ b/test/cctest/test-dataflow.cc @@ -1,4 +1,4 @@ -// Copyright 2010 the V8 project authors. All rights reserved. +// Copyright 2012 the V8 project authors. All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: @@ -36,16 +36,17 @@ using namespace v8::internal; TEST(BitVector) { v8::internal::V8::Initialize(NULL); - ZoneScope zone(Isolate::Current(), DELETE_ON_EXIT); + ZoneScope zone_scope(Isolate::Current(), DELETE_ON_EXIT); + Zone* zone = ZONE; { - BitVector v(15); + BitVector v(15, zone); v.Add(1); CHECK(v.Contains(1)); v.Remove(0); CHECK(!v.Contains(0)); v.Add(0); v.Add(1); - BitVector w(15); + BitVector w(15, zone); w.Add(1); v.Intersect(w); CHECK(!v.Contains(0)); @@ -53,7 +54,7 @@ TEST(BitVector) { } { - BitVector v(64); + BitVector v(64, zone); v.Add(27); v.Add(30); v.Add(31); @@ -71,9 +72,9 @@ TEST(BitVector) { } { - BitVector v(15); + BitVector v(15, zone); v.Add(0); - BitVector w(15); + BitVector w(15, zone); w.Add(1); v.Union(w); CHECK(v.Contains(0)); @@ -81,13 +82,13 @@ TEST(BitVector) { } { - BitVector v(15); + BitVector v(15, zone); v.Add(0); - BitVector w(15); + BitVector w(15, zone); w = v; CHECK(w.Contains(0)); w.Add(1); - BitVector u(w); + BitVector u(w, zone); CHECK(u.Contains(0)); CHECK(u.Contains(1)); v.Union(w); @@ -96,9 +97,9 @@ TEST(BitVector) { } { - BitVector v(35); + BitVector v(35, zone); v.Add(0); - BitVector w(35); + BitVector w(35, zone); w.Add(33); v.Union(w); CHECK(v.Contains(0)); @@ -106,15 +107,15 @@ TEST(BitVector) { } { - BitVector v(35); + BitVector v(35, zone); v.Add(32); v.Add(33); - BitVector w(35); + BitVector w(35, zone); w.Add(33); v.Intersect(w); CHECK(!v.Contains(32)); CHECK(v.Contains(33)); - BitVector r(35); + BitVector r(35, zone); r.CopyFrom(v); CHECK(!r.Contains(32)); CHECK(r.Contains(33));