Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Unified Diff: src/compiler/bytecode-liveness-map.h

Issue 2552723004: [ignition/turbofan] Wrap bytecode liveness bitvectors (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/bytecode-graph-builder.cc ('k') | src/compiler/bytecode-liveness-map.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/bytecode-liveness-map.h
diff --git a/src/compiler/bytecode-liveness-map.h b/src/compiler/bytecode-liveness-map.h
index e5c7a38996539d388d062f73caf890d085159cb2..03251f136777f6d97b49eec87ed82f6f2c841ba7 100644
--- a/src/compiler/bytecode-liveness-map.h
+++ b/src/compiler/bytecode-liveness-map.h
@@ -16,35 +16,99 @@ class Zone;
namespace compiler {
-struct Liveness {
- BitVector* in;
- BitVector* out;
+class BytecodeLivenessState : public ZoneObject {
+ public:
+ BytecodeLivenessState(int register_count, Zone* zone)
+ : bit_vector_(register_count + 1, zone) {}
+
+ const BitVector& bit_vector() const { return bit_vector_; }
+
+ BitVector& bit_vector() { return bit_vector_; }
+
+ bool RegisterIsLive(int index) const {
+ DCHECK_GE(index, 0);
+ DCHECK_LT(index, bit_vector_.length() - 1);
+ return bit_vector_.Contains(index);
+ }
+
+ bool AccumulatorIsLive() const {
+ return bit_vector_.Contains(bit_vector_.length() - 1);
+ }
+
+ bool Equals(const BytecodeLivenessState& other) const {
+ return bit_vector_.Equals(other.bit_vector_);
+ }
+
+ void MarkRegisterLive(int index) {
+ DCHECK_GE(index, 0);
+ DCHECK_LT(index, bit_vector_.length() - 1);
+ bit_vector_.Add(index);
+ }
+
+ void MarkRegisterDead(int index) {
+ DCHECK_GE(index, 0);
+ DCHECK_LT(index, bit_vector_.length() - 1);
+ bit_vector_.Remove(index);
+ }
+
+ void MarkAccumulatorLive() { bit_vector_.Add(bit_vector_.length() - 1); }
+
+ void MarkAccumulatorDead() { bit_vector_.Remove(bit_vector_.length() - 1); }
+
+ void MarkAllLive() { bit_vector_.AddAll(); }
- Liveness(int size, Zone* zone);
+ void Union(const BytecodeLivenessState& other) {
+ bit_vector_.Union(other.bit_vector_);
+ }
+
+ bool UnionIsChanged(const BytecodeLivenessState& other) {
+ return bit_vector_.UnionIsChanged(other.bit_vector_);
+ }
+
+ void CopyFrom(const BytecodeLivenessState& other) {
+ bit_vector_.CopyFrom(other.bit_vector_);
+ }
+
+ private:
+ BitVector bit_vector_;
+
+ DISALLOW_COPY_AND_ASSIGN(BytecodeLivenessState);
+};
+
+struct BytecodeLiveness {
+ BytecodeLivenessState* in;
+ BytecodeLivenessState* out;
+
+ BytecodeLiveness(int register_count, Zone* zone);
};
class V8_EXPORT_PRIVATE BytecodeLivenessMap {
public:
BytecodeLivenessMap(int size, Zone* zone);
- Liveness& InitializeLiveness(int offset, int size, Zone* zone);
+ BytecodeLiveness& InitializeLiveness(int offset, int register_count,
+ Zone* zone);
- Liveness& GetLiveness(int offset);
- const Liveness& GetLiveness(int offset) const;
+ BytecodeLiveness& GetLiveness(int offset);
+ const BytecodeLiveness& GetLiveness(int offset) const;
- BitVector* GetInLiveness(int offset) { return GetLiveness(offset).in; }
- const BitVector* GetInLiveness(int offset) const {
+ BytecodeLivenessState* GetInLiveness(int offset) {
+ return GetLiveness(offset).in;
+ }
+ const BytecodeLivenessState* GetInLiveness(int offset) const {
return GetLiveness(offset).in;
}
- BitVector* GetOutLiveness(int offset) { return GetLiveness(offset).out; }
- const BitVector* GetOutLiveness(int offset) const {
+ BytecodeLivenessState* GetOutLiveness(int offset) {
+ return GetLiveness(offset).out;
+ }
+ const BytecodeLivenessState* GetOutLiveness(int offset) const {
return GetLiveness(offset).out;
}
private:
- base::TemplateHashMapImpl<int, Liveness, base::KeyEqualityMatcher<int>,
- ZoneAllocationPolicy>
+ base::TemplateHashMapImpl<int, BytecodeLiveness,
+ base::KeyEqualityMatcher<int>, ZoneAllocationPolicy>
liveness_map_;
};
« no previous file with comments | « src/compiler/bytecode-graph-builder.cc ('k') | src/compiler/bytecode-liveness-map.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698