-// 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:
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);
}
HBasicBlock* dont_visit)
: visited_count_(0),
stack_(16),
- reachable_(block_count),
+ reachable_(block_count, ZONE),
dont_visit_(dont_visit) {
PushBlock(entry_block);
Analyze();
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];
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());
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();
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);
}
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:
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:
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;
}
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:
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));
}
{
- BitVector v(64);
+ BitVector v(64, zone);
v.Add(27);
v.Add(30);
v.Add(31);
}
{
- 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));
}
{
- 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);
}
{
- 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));
}
{
- 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));