"src/bignum-dtoa.h",
"src/bignum.cc",
"src/bignum.h",
+ "src/bit-vector.cc",
+ "src/bit-vector.h",
"src/bootstrapper.cc",
"src/bootstrapper.h",
"src/builtins.cc",
"src/cpu-profiler-inl.h",
"src/cpu-profiler.cc",
"src/cpu-profiler.h",
- "src/data-flow.cc",
- "src/data-flow.h",
"src/date.cc",
"src/date.h",
"src/dateparser-inl.h",
--- /dev/null
+// Copyright 2010 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "src/bit-vector.h"
+
+#include "src/base/bits.h"
+#include "src/scopes.h"
+
+namespace v8 {
+namespace internal {
+
+#ifdef DEBUG
+void BitVector::Print() {
+ bool first = true;
+ PrintF("{");
+ for (int i = 0; i < length(); i++) {
+ if (Contains(i)) {
+ if (!first) PrintF(",");
+ first = false;
+ PrintF("%d", i);
+ }
+ }
+ PrintF("}");
+}
+#endif
+
+
+void BitVector::Iterator::Advance() {
+ current_++;
+ uintptr_t val = current_value_;
+ while (val == 0) {
+ current_index_++;
+ if (Done()) return;
+ val = target_->data_[current_index_];
+ current_ = current_index_ << kDataBitShift;
+ }
+ val = SkipZeroBytes(val);
+ val = SkipZeroBits(val);
+ current_value_ = val >> 1;
+}
+
+
+int BitVector::Count() const {
+ int count = 0;
+ for (int i = 0; i < data_length_; i++) {
+ uintptr_t data = data_[i];
+ if (sizeof(data) == 8) {
+ count += base::bits::CountPopulation64(data);
+ } else {
+ count += base::bits::CountPopulation32(static_cast<uint32_t>(data));
+ }
+ }
+ return count;
+}
+
+} // namespace internal
+} // namespace v8
--- /dev/null
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef V8_DATAFLOW_H_
+#define V8_DATAFLOW_H_
+
+#include "src/v8.h"
+
+#include "src/allocation.h"
+#include "src/ast.h"
+#include "src/compiler.h"
+#include "src/zone-inl.h"
+
+namespace v8 {
+namespace internal {
+
+class BitVector : public ZoneObject {
+ public:
+ // Iterator for the elements of this BitVector.
+ class Iterator BASE_EMBEDDED {
+ public:
+ explicit Iterator(BitVector* target)
+ : target_(target),
+ current_index_(0),
+ current_value_(target->data_[0]),
+ current_(-1) {
+ DCHECK(target->data_length_ > 0);
+ Advance();
+ }
+ ~Iterator() {}
+
+ bool Done() const { return current_index_ >= target_->data_length_; }
+ void Advance();
+
+ int Current() const {
+ DCHECK(!Done());
+ return current_;
+ }
+
+ private:
+ uintptr_t SkipZeroBytes(uintptr_t val) {
+ while ((val & 0xFF) == 0) {
+ val >>= 8;
+ current_ += 8;
+ }
+ return val;
+ }
+ uintptr_t SkipZeroBits(uintptr_t val) {
+ while ((val & 0x1) == 0) {
+ val >>= 1;
+ current_++;
+ }
+ return val;
+ }
+
+ BitVector* target_;
+ int current_index_;
+ uintptr_t current_value_;
+ int current_;
+
+ friend class BitVector;
+ };
+
+ static const int kDataBits = kPointerSize * 8;
+ static const int kDataBitShift = kPointerSize == 8 ? 6 : 5;
+ static const uintptr_t kOne = 1; // This saves some static_casts.
+
+ BitVector(int length, Zone* zone)
+ : length_(length),
+ data_length_(SizeFor(length)),
+ data_(zone->NewArray<uintptr_t>(data_length_)) {
+ DCHECK(length > 0);
+ Clear();
+ }
+
+ BitVector(const BitVector& other, Zone* zone)
+ : length_(other.length()),
+ data_length_(SizeFor(length_)),
+ data_(zone->NewArray<uintptr_t>(data_length_)) {
+ CopyFrom(other);
+ }
+
+ static int SizeFor(int length) { return 1 + ((length - 1) / kDataBits); }
+
+ void CopyFrom(const BitVector& other) {
+ DCHECK(other.length() <= length());
+ for (int i = 0; i < other.data_length_; i++) {
+ data_[i] = other.data_[i];
+ }
+ for (int i = other.data_length_; i < data_length_; i++) {
+ data_[i] = 0;
+ }
+ }
+
+ bool Contains(int i) const {
+ DCHECK(i >= 0 && i < length());
+ uintptr_t block = data_[i / kDataBits];
+ return (block & (kOne << (i % kDataBits))) != 0;
+ }
+
+ void Add(int i) {
+ DCHECK(i >= 0 && i < length());
+ data_[i / kDataBits] |= (kOne << (i % kDataBits));
+ }
+
+ void Remove(int i) {
+ DCHECK(i >= 0 && i < length());
+ data_[i / kDataBits] &= ~(kOne << (i % kDataBits));
+ }
+
+ void Union(const BitVector& other) {
+ DCHECK(other.length() == length());
+ for (int i = 0; i < data_length_; i++) {
+ data_[i] |= other.data_[i];
+ }
+ }
+
+ bool UnionIsChanged(const BitVector& other) {
+ DCHECK(other.length() == length());
+ bool changed = false;
+ for (int i = 0; i < data_length_; i++) {
+ uintptr_t old_data = data_[i];
+ data_[i] |= other.data_[i];
+ if (data_[i] != old_data) changed = true;
+ }
+ return changed;
+ }
+
+ void Intersect(const BitVector& other) {
+ DCHECK(other.length() == length());
+ for (int i = 0; i < data_length_; i++) {
+ data_[i] &= other.data_[i];
+ }
+ }
+
+ bool IntersectIsChanged(const BitVector& other) {
+ DCHECK(other.length() == length());
+ bool changed = false;
+ for (int i = 0; i < data_length_; i++) {
+ uintptr_t old_data = data_[i];
+ data_[i] &= other.data_[i];
+ if (data_[i] != old_data) changed = true;
+ }
+ return changed;
+ }
+
+ void Subtract(const BitVector& other) {
+ DCHECK(other.length() == length());
+ for (int i = 0; i < data_length_; i++) {
+ data_[i] &= ~other.data_[i];
+ }
+ }
+
+ void Clear() {
+ for (int i = 0; i < data_length_; i++) {
+ data_[i] = 0;
+ }
+ }
+
+ bool IsEmpty() const {
+ for (int i = 0; i < data_length_; i++) {
+ if (data_[i] != 0) return false;
+ }
+ return true;
+ }
+
+ bool Equals(const BitVector& other) {
+ for (int i = 0; i < data_length_; i++) {
+ if (data_[i] != other.data_[i]) return false;
+ }
+ return true;
+ }
+
+ int Count() const;
+
+ int length() const { return length_; }
+
+#ifdef DEBUG
+ void Print();
+#endif
+
+ private:
+ const int length_;
+ const int data_length_;
+ uintptr_t* const data_;
+
+ DISALLOW_COPY_AND_ASSIGN(BitVector);
+};
+
+
+class GrowableBitVector BASE_EMBEDDED {
+ public:
+ class Iterator BASE_EMBEDDED {
+ public:
+ Iterator(const GrowableBitVector* target, Zone* zone)
+ : it_(target->bits_ == NULL ? new (zone) BitVector(1, zone)
+ : target->bits_) {}
+ bool Done() const { return it_.Done(); }
+ void Advance() { it_.Advance(); }
+ int Current() const { return it_.Current(); }
+
+ private:
+ BitVector::Iterator it_;
+ };
+
+ GrowableBitVector() : bits_(NULL) {}
+ GrowableBitVector(int length, Zone* zone)
+ : bits_(new (zone) BitVector(length, zone)) {}
+
+ bool Contains(int value) const {
+ if (!InBitsRange(value)) return false;
+ return bits_->Contains(value);
+ }
+
+ void Add(int value, Zone* zone) {
+ EnsureCapacity(value, zone);
+ bits_->Add(value);
+ }
+
+ void Union(const GrowableBitVector& other, Zone* zone) {
+ for (Iterator it(&other, zone); !it.Done(); it.Advance()) {
+ Add(it.Current(), zone);
+ }
+ }
+
+ void Clear() {
+ if (bits_ != NULL) bits_->Clear();
+ }
+
+ private:
+ static const int kInitialLength = 1024;
+
+ bool InBitsRange(int value) const {
+ return bits_ != NULL && bits_->length() > value;
+ }
+
+ void EnsureCapacity(int value, Zone* zone) {
+ 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, zone);
+ if (bits_ != NULL) new_bits->CopyFrom(*bits_);
+ bits_ = new_bits;
+ }
+
+ BitVector* bits_;
+};
+
+} // namespace internal
+} // namespace v8
+
+#endif // V8_DATAFLOW_H_
#define V8_COMPILER_AST_LOOP_ASSIGNMENT_ANALYZER_H_
#include "src/ast.h"
-#include "src/data-flow.h"
+#include "src/bit-vector.h"
#include "src/v8.h"
#include "src/zone-containers.h"
#include "src/v8.h"
-#include "src/data-flow.h"
+#include "src/bit-vector.h"
namespace v8 {
namespace internal {
#include "src/compiler/scheduler.h"
+#include "src/bit-vector.h"
#include "src/compiler/graph.h"
#include "src/compiler/graph-inl.h"
#include "src/compiler/node.h"
#include "src/compiler/node-properties.h"
#include "src/compiler/node-properties-inl.h"
-#include "src/data-flow.h"
namespace v8 {
namespace internal {
#include <sstream>
#include <string>
+#include "src/bit-vector.h"
#include "src/compiler/generic-algorithm.h"
#include "src/compiler/generic-node-inl.h"
#include "src/compiler/generic-node.h"
#include "src/compiler/operator.h"
#include "src/compiler/schedule.h"
#include "src/compiler/simplified-operator.h"
-#include "src/data-flow.h"
#include "src/ostreams.h"
namespace v8 {
+++ /dev/null
-// Copyright 2010 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "src/data-flow.h"
-
-#include "src/base/bits.h"
-#include "src/scopes.h"
-
-namespace v8 {
-namespace internal {
-
-#ifdef DEBUG
-void BitVector::Print() {
- bool first = true;
- PrintF("{");
- for (int i = 0; i < length(); i++) {
- if (Contains(i)) {
- if (!first) PrintF(",");
- first = false;
- PrintF("%d", i);
- }
- }
- PrintF("}");
-}
-#endif
-
-
-void BitVector::Iterator::Advance() {
- current_++;
- uint32_t val = current_value_;
- while (val == 0) {
- current_index_++;
- if (Done()) return;
- val = target_->data_[current_index_];
- current_ = current_index_ << 5;
- }
- val = SkipZeroBytes(val);
- val = SkipZeroBits(val);
- current_value_ = val >> 1;
-}
-
-
-int BitVector::Count() const {
- int count = 0;
- for (int i = 0; i < data_length_; i++) {
- int data = data_[i];
- if (data != 0) count += base::bits::CountPopulation32(data);
- }
- return count;
-}
-
-} // namespace internal
-} // namespace v8
+++ /dev/null
-// Copyright 2012 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef V8_DATAFLOW_H_
-#define V8_DATAFLOW_H_
-
-#include "src/v8.h"
-
-#include "src/allocation.h"
-#include "src/ast.h"
-#include "src/compiler.h"
-#include "src/zone-inl.h"
-
-namespace v8 {
-namespace internal {
-
-class BitVector: public ZoneObject {
- public:
- // Iterator for the elements of this BitVector.
- class Iterator BASE_EMBEDDED {
- public:
- explicit Iterator(BitVector* target)
- : target_(target),
- current_index_(0),
- current_value_(target->data_[0]),
- current_(-1) {
- DCHECK(target->data_length_ > 0);
- Advance();
- }
- ~Iterator() { }
-
- bool Done() const { return current_index_ >= target_->data_length_; }
- void Advance();
-
- int Current() const {
- DCHECK(!Done());
- return current_;
- }
-
- private:
- uint32_t SkipZeroBytes(uint32_t val) {
- while ((val & 0xFF) == 0) {
- val >>= 8;
- current_ += 8;
- }
- return val;
- }
- uint32_t SkipZeroBits(uint32_t val) {
- while ((val & 0x1) == 0) {
- val >>= 1;
- current_++;
- }
- return val;
- }
-
- BitVector* target_;
- int current_index_;
- uint32_t current_value_;
- int current_;
-
- friend class BitVector;
- };
-
- BitVector(int length, Zone* zone)
- : length_(length),
- data_length_(SizeFor(length)),
- data_(zone->NewArray<uint32_t>(data_length_)) {
- DCHECK(length > 0);
- Clear();
- }
-
- BitVector(const BitVector& other, Zone* zone)
- : length_(other.length()),
- data_length_(SizeFor(length_)),
- data_(zone->NewArray<uint32_t>(data_length_)) {
- CopyFrom(other);
- }
-
- static int SizeFor(int length) {
- return 1 + ((length - 1) / 32);
- }
-
- BitVector& operator=(const BitVector& rhs) {
- if (this != &rhs) CopyFrom(rhs);
- return *this;
- }
-
- void CopyFrom(const BitVector& other) {
- DCHECK(other.length() <= length());
- for (int i = 0; i < other.data_length_; i++) {
- data_[i] = other.data_[i];
- }
- for (int i = other.data_length_; i < data_length_; i++) {
- data_[i] = 0;
- }
- }
-
- bool Contains(int i) const {
- DCHECK(i >= 0 && i < length());
- uint32_t block = data_[i / 32];
- return (block & (1U << (i % 32))) != 0;
- }
-
- void Add(int i) {
- DCHECK(i >= 0 && i < length());
- data_[i / 32] |= (1U << (i % 32));
- }
-
- void Remove(int i) {
- DCHECK(i >= 0 && i < length());
- data_[i / 32] &= ~(1U << (i % 32));
- }
-
- void Union(const BitVector& other) {
- DCHECK(other.length() == length());
- for (int i = 0; i < data_length_; i++) {
- data_[i] |= other.data_[i];
- }
- }
-
- bool UnionIsChanged(const BitVector& other) {
- DCHECK(other.length() == length());
- bool changed = false;
- for (int i = 0; i < data_length_; i++) {
- uint32_t old_data = data_[i];
- data_[i] |= other.data_[i];
- if (data_[i] != old_data) changed = true;
- }
- return changed;
- }
-
- void Intersect(const BitVector& other) {
- DCHECK(other.length() == length());
- for (int i = 0; i < data_length_; i++) {
- data_[i] &= other.data_[i];
- }
- }
-
- bool IntersectIsChanged(const BitVector& other) {
- DCHECK(other.length() == length());
- bool changed = false;
- for (int i = 0; i < data_length_; i++) {
- uint32_t old_data = data_[i];
- data_[i] &= other.data_[i];
- if (data_[i] != old_data) changed = true;
- }
- return changed;
- }
-
- void Subtract(const BitVector& other) {
- DCHECK(other.length() == length());
- for (int i = 0; i < data_length_; i++) {
- data_[i] &= ~other.data_[i];
- }
- }
-
- void Clear() {
- for (int i = 0; i < data_length_; i++) {
- data_[i] = 0;
- }
- }
-
- bool IsEmpty() const {
- for (int i = 0; i < data_length_; i++) {
- if (data_[i] != 0) return false;
- }
- return true;
- }
-
- bool Equals(const BitVector& other) {
- for (int i = 0; i < data_length_; i++) {
- if (data_[i] != other.data_[i]) return false;
- }
- return true;
- }
-
- int Count() const;
-
- int length() const { return length_; }
-
-#ifdef DEBUG
- void Print();
-#endif
-
- private:
- int length_;
- int data_length_;
- uint32_t* data_;
-};
-
-
-class GrowableBitVector BASE_EMBEDDED {
- public:
- class Iterator BASE_EMBEDDED {
- public:
- Iterator(const GrowableBitVector* target, Zone* zone)
- : it_(target->bits_ == NULL
- ? new(zone) BitVector(1, zone)
- : target->bits_) { }
- bool Done() const { return it_.Done(); }
- void Advance() { it_.Advance(); }
- int Current() const { return it_.Current(); }
- private:
- BitVector::Iterator it_;
- };
-
- GrowableBitVector() : bits_(NULL) { }
- GrowableBitVector(int length, Zone* zone)
- : bits_(new(zone) BitVector(length, zone)) { }
-
- bool Contains(int value) const {
- if (!InBitsRange(value)) return false;
- return bits_->Contains(value);
- }
-
- void Add(int value, Zone* zone) {
- EnsureCapacity(value, zone);
- bits_->Add(value);
- }
-
- void Union(const GrowableBitVector& other, Zone* zone) {
- for (Iterator it(&other, zone); !it.Done(); it.Advance()) {
- Add(it.Current(), zone);
- }
- }
-
- void Clear() { if (bits_ != NULL) bits_->Clear(); }
-
- private:
- static const int kInitialLength = 1024;
-
- bool InBitsRange(int value) const {
- return bits_ != NULL && bits_->length() > value;
- }
-
- void EnsureCapacity(int value, Zone* zone) {
- 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, zone);
- if (bits_ != NULL) new_bits->CopyFrom(*bits_);
- bits_ = new_bits;
- }
-
- BitVector* bits_;
-};
-
-} // namespace internal
-} // namespace v8
-
-#endif // V8_DATAFLOW_H_
#include "src/allocation.h"
#include "src/assert-scope.h"
#include "src/ast.h"
+#include "src/bit-vector.h"
#include "src/code-stubs.h"
#include "src/codegen.h"
#include "src/compiler.h"
-#include "src/data-flow.h"
#include "src/globals.h"
#include "src/objects.h"
#include "src/allocation.h"
#include "src/base/bits.h"
+#include "src/bit-vector.h"
#include "src/code-stubs.h"
#include "src/conversions.h"
-#include "src/data-flow.h"
#include "src/deoptimizer.h"
#include "src/hydrogen-types.h"
#include "src/small-pointer-list.h"
'test-atomicops.cc',
'test-bignum.cc',
'test-bignum-dtoa.cc',
+ 'test-bit-vector.cc',
'test-checks.cc',
'test-circular-queue.cc',
'test-compiler.cc',
'test-constantpool.cc',
'test-conversions.cc',
'test-cpu-profiler.cc',
- 'test-dataflow.cc',
'test-date.cc',
'test-debug.cc',
'test-declarative-accessors.cc',
--- /dev/null
+// 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:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#include <stdlib.h>
+
+#include "src/v8.h"
+
+#include "src/bit-vector.h"
+#include "test/cctest/cctest.h"
+
+using namespace v8::internal;
+
+TEST(BitVector) {
+ Zone zone(CcTest::i_isolate());
+ {
+ 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, &zone);
+ w.Add(1);
+ v.Intersect(w);
+ CHECK(!v.Contains(0));
+ CHECK(v.Contains(1));
+ }
+
+ {
+ BitVector v(64, &zone);
+ v.Add(27);
+ v.Add(30);
+ v.Add(31);
+ v.Add(33);
+ BitVector::Iterator iter(&v);
+ CHECK_EQ(27, iter.Current());
+ iter.Advance();
+ CHECK_EQ(30, iter.Current());
+ iter.Advance();
+ CHECK_EQ(31, iter.Current());
+ iter.Advance();
+ CHECK_EQ(33, iter.Current());
+ iter.Advance();
+ CHECK(iter.Done());
+ }
+
+ {
+ BitVector v(15, &zone);
+ v.Add(0);
+ BitVector w(15, &zone);
+ w.Add(1);
+ v.Union(w);
+ CHECK(v.Contains(0));
+ CHECK(v.Contains(1));
+ }
+
+ {
+ BitVector v(15, &zone);
+ v.Add(0);
+ BitVector w(15, &zone);
+ w.CopyFrom(v);
+ CHECK(w.Contains(0));
+ w.Add(1);
+ BitVector u(w, &zone);
+ CHECK(u.Contains(0));
+ CHECK(u.Contains(1));
+ v.Union(w);
+ CHECK(v.Contains(0));
+ CHECK(v.Contains(1));
+ }
+
+ {
+ BitVector v(35, &zone);
+ v.Add(0);
+ BitVector w(35, &zone);
+ w.Add(33);
+ v.Union(w);
+ CHECK(v.Contains(0));
+ CHECK(v.Contains(33));
+ }
+
+ {
+ BitVector v(35, &zone);
+ v.Add(32);
+ v.Add(33);
+ BitVector w(35, &zone);
+ w.Add(33);
+ v.Intersect(w);
+ CHECK(!v.Contains(32));
+ CHECK(v.Contains(33));
+ BitVector r(35, &zone);
+ r.CopyFrom(v);
+ CHECK(!r.Contains(32));
+ CHECK(r.Contains(33));
+ }
+}
+++ /dev/null
-// 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:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#include <stdlib.h>
-
-#include "src/v8.h"
-
-#include "src/data-flow.h"
-#include "test/cctest/cctest.h"
-
-using namespace v8::internal;
-
-TEST(BitVector) {
- Zone zone(CcTest::i_isolate());
- {
- 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, &zone);
- w.Add(1);
- v.Intersect(w);
- CHECK(!v.Contains(0));
- CHECK(v.Contains(1));
- }
-
- {
- BitVector v(64, &zone);
- v.Add(27);
- v.Add(30);
- v.Add(31);
- v.Add(33);
- BitVector::Iterator iter(&v);
- CHECK_EQ(27, iter.Current());
- iter.Advance();
- CHECK_EQ(30, iter.Current());
- iter.Advance();
- CHECK_EQ(31, iter.Current());
- iter.Advance();
- CHECK_EQ(33, iter.Current());
- iter.Advance();
- CHECK(iter.Done());
- }
-
- {
- BitVector v(15, &zone);
- v.Add(0);
- BitVector w(15, &zone);
- w.Add(1);
- v.Union(w);
- CHECK(v.Contains(0));
- CHECK(v.Contains(1));
- }
-
- {
- BitVector v(15, &zone);
- v.Add(0);
- BitVector w(15, &zone);
- w = v;
- CHECK(w.Contains(0));
- w.Add(1);
- BitVector u(w, &zone);
- CHECK(u.Contains(0));
- CHECK(u.Contains(1));
- v.Union(w);
- CHECK(v.Contains(0));
- CHECK(v.Contains(1));
- }
-
- {
- BitVector v(35, &zone);
- v.Add(0);
- BitVector w(35, &zone);
- w.Add(33);
- v.Union(w);
- CHECK(v.Contains(0));
- CHECK(v.Contains(33));
- }
-
- {
- BitVector v(35, &zone);
- v.Add(32);
- v.Add(33);
- BitVector w(35, &zone);
- w.Add(33);
- v.Intersect(w);
- CHECK(!v.Contains(32));
- CHECK(v.Contains(33));
- BitVector r(35, &zone);
- r.CopyFrom(v);
- CHECK(!r.Contains(32));
- CHECK(r.Contains(33));
- }
-}
'../../src/bignum-dtoa.h',
'../../src/bignum.cc',
'../../src/bignum.h',
+ '../../src/bit-vector.cc',
+ '../../src/bit-vector.h',
'../../src/bootstrapper.cc',
'../../src/bootstrapper.h',
'../../src/builtins.cc',
'../../src/cpu-profiler-inl.h',
'../../src/cpu-profiler.cc',
'../../src/cpu-profiler.h',
- '../../src/data-flow.cc',
- '../../src/data-flow.h',
'../../src/date.cc',
'../../src/date.h',
'../../src/dateparser-inl.h',