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

Unified Diff: runtime/vm/raw_object.h

Issue 382993003: More PcDescriptor cleanups. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 5 months 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 | « runtime/vm/parser.cc ('k') | runtime/vm/raw_object.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/raw_object.h
===================================================================
--- runtime/vm/raw_object.h (revision 38237)
+++ runtime/vm/raw_object.h (working copy)
@@ -916,23 +916,61 @@
kAnyKind = 0xFF
};
+ // Compressed version assumes try_index is always -1 and does not store it.
struct PcDescriptorRec {
- uword pc;
- int32_t deopt_id;
- int32_t token_pos; // Or deopt reason.
- int16_t try_index; // Or deopt index.
- uint8_t kind_;
+ uword pc() const { return pc_; }
+ void set_pc(uword value) { pc_ = value; }
- Kind kind() const { return static_cast<Kind>(kind_); }
+ Kind kind() const {
+ return static_cast<Kind>(deopt_id_and_kind_ & kAnyKind);
+ }
+ void set_kind(Kind kind) {
+ deopt_id_and_kind_ = (deopt_id_and_kind_ & 0xFFFFFF00) | kind;
+ }
+
+ int16_t try_index() const { return is_compressed() ? -1 : try_index_; }
+ void set_try_index(int16_t value) {
+ if (is_compressed()) {
+ ASSERT(value == -1);
+ return;
+ }
+ try_index_ = value;
+ }
+
+ intptr_t token_pos() const { return token_pos_ >> 1; }
+ void set_token_pos(int32_t value, bool compressed) {
+ int32_t bit = compressed ? 0x1 : 0x0;
+ token_pos_ = (value << 1) | bit;
+ }
+
+ intptr_t deopt_id() const { return deopt_id_and_kind_ >> 8; }
+ void set_deopt_id(int32_t value) {
+ ASSERT(Utils::IsInt(24, value));
+ deopt_id_and_kind_ = (deopt_id_and_kind_ & 0xFF) | (value << 8);
+ }
+
+ private:
+ bool is_compressed() const {
+ return (token_pos_ & 0x1) == 1;
+ }
+
+ uword pc_;
+ int32_t deopt_id_and_kind_; // Bits 31..8 -> deopt_id, bits 7..0 kind.
+ int32_t token_pos_; // Bits 31..1 -> token_pos, bit 1 -> compressed flag;
+ int16_t try_index_;
};
+ static const intptr_t kFullRecSize = sizeof(PcDescriptorRec);
+ static const intptr_t kCompressedRecSize = kFullRecSize - sizeof(int16_t);
+
private:
RAW_HEAP_OBJECT_IMPLEMENTATION(PcDescriptors);
+ intptr_t record_size_in_bytes_;
intptr_t length_; // Number of descriptors.
// Variable length data follows here.
- PcDescriptorRec* data() { OPEN_ARRAY_START(PcDescriptorRec, intptr_t); }
+ uint8_t* data() { OPEN_ARRAY_START(uint8_t, intptr_t); }
friend class Object;
};
« no previous file with comments | « runtime/vm/parser.cc ('k') | runtime/vm/raw_object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698