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

Unified Diff: runtime/vm/code_descriptors.h

Issue 2734323003: Re-landing of "replace TrySync with Metadata". (Closed)
Patch Set: Address review comments Created 3 years, 9 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/clustered_snapshot.cc ('k') | runtime/vm/code_descriptors.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/code_descriptors.h
diff --git a/runtime/vm/code_descriptors.h b/runtime/vm/code_descriptors.h
index 5a1528e174c0317a8659752016f9827bb46d4181..2dbe90332384c0e595cc99df4a36b05cdc11fed9 100644
--- a/runtime/vm/code_descriptors.h
+++ b/runtime/vm/code_descriptors.h
@@ -7,6 +7,7 @@
#include "vm/ast.h"
#include "vm/code_generator.h"
+#include "vm/datastream.h"
#include "vm/globals.h"
#include "vm/growable_array.h"
#include "vm/object.h"
@@ -148,6 +149,59 @@ class ExceptionHandlerList : public ZoneAllocated {
};
+// An encoded move from stack/constant to stack performed
+struct CatchEntryStatePair {
+ enum { kCatchEntryStateIsMove = 1, kCatchEntryStateDestShift = 1 };
+
+ intptr_t src, dest;
+
+ static CatchEntryStatePair FromConstant(intptr_t pool_id,
+ intptr_t dest_slot) {
+ CatchEntryStatePair pair;
+ pair.src = pool_id;
+ pair.dest = (dest_slot << kCatchEntryStateDestShift);
+ return pair;
+ }
+
+ static CatchEntryStatePair FromMove(intptr_t src_slot, intptr_t dest_slot) {
+ CatchEntryStatePair pair;
+ pair.src = src_slot;
+ pair.dest =
+ (dest_slot << kCatchEntryStateDestShift) | kCatchEntryStateIsMove;
+ return pair;
+ }
+
+ bool operator==(const CatchEntryStatePair& rhs) {
+ return src == rhs.src && dest == rhs.dest;
+ }
+};
+
+
+// Used to construct CatchEntryState metadata for AoT mode of compilation.
+class CatchEntryStateMapBuilder : public ZoneAllocated {
+ public:
+ CatchEntryStateMapBuilder();
+
+ void NewMapping(intptr_t pc_offset);
+ void AppendMove(intptr_t src_slot, intptr_t dest_slot);
+ void AppendConstant(intptr_t pool_id, intptr_t dest_slot);
+ void EndMapping();
+ RawTypedData* FinalizeCatchEntryStateMap();
+
+ private:
+ class TrieNode;
+
+ Zone* zone_;
+ TrieNode* root_;
+ intptr_t current_pc_offset_;
+ GrowableArray<CatchEntryStatePair> moves_;
+ uint8_t* buffer_;
+ WriteStream stream_;
+
+ DISALLOW_COPY_AND_ASSIGN(CatchEntryStateMapBuilder);
+};
+
+
// A CodeSourceMap maps from pc offsets to a stack of inlined functions and
// their positions. This is encoded as a little bytecode that pushes and pops
// functions and changes the top function's position as the PC advances.
« no previous file with comments | « runtime/vm/clustered_snapshot.cc ('k') | runtime/vm/code_descriptors.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698