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
parent c9aa19af
// 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<uint32_t>(data_length_)) {
data_(zone->NewArray<uint32_t>(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<uint32_t>(data_length_)) {
data_(zone->NewArray<uint32_t>(data_length_)) {
CopyFrom(other);
}
......
......@@ -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<HBasicBlock*> reverse_result(8);
HBasicBlock* start = blocks_[0];
......@@ -955,7 +955,7 @@ void HGraph::CollectPhis() {
void HGraph::InferTypes(ZoneList<HValue*>* 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<BitVector*> 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;
......
// 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()) {
......
// 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;
}
......
......@@ -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<JSFunction> closure() const { return closure_; }
int arguments_stack_height() const { return arguments_stack_height_; }
......
// 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));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment