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

Unified Diff: runtime/vm/instructions_dbc.cc

Issue 1961953003: DBC: Adds DecodeLoadObjectFromPoolOrThread, enables tests (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Decode more instructions Created 4 years, 7 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/constants_dbc.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/instructions_dbc.cc
diff --git a/runtime/vm/instructions_dbc.cc b/runtime/vm/instructions_dbc.cc
index 38b69f41a04a97cc160b39e6704d3d6f0ccaf9c0..ec7945f44c9271ae350b41e970cb9fd911233bad 100644
--- a/runtime/vm/instructions_dbc.cc
+++ b/runtime/vm/instructions_dbc.cc
@@ -109,10 +109,40 @@ uword InstructionPattern::DecodeLoadWordFromPool(uword end,
}
+static bool HasLoadFromPool(Instr instr) {
+ switch (Bytecode::DecodeOpcode(instr)) {
+ case Bytecode::kLoadConstant:
+ case Bytecode::kPushConstant:
+ case Bytecode::kStaticCall:
+ case Bytecode::kInstanceCall:
+ case Bytecode::kInstanceCall2:
+ case Bytecode::kInstanceCall3:
+ case Bytecode::kStoreStaticTOS:
+ case Bytecode::kPushStatic:
+ case Bytecode::kAllocate:
+ case Bytecode::kInstantiateType:
+ case Bytecode::kInstantiateTypeArgumentsTOS:
+ case Bytecode::kAssertAssignable:
+ return true;
+ default:
+ return false;
+ }
+}
+
+
bool DecodeLoadObjectFromPoolOrThread(uword pc,
const Code& code,
Object* obj) {
- UNIMPLEMENTED();
+ ASSERT(code.ContainsInstructionAt(pc));
+ Instr instr = Bytecode::At(pc);
+ if (HasLoadFromPool(instr)) {
+ uint16_t index = Bytecode::DecodeD(instr);
+ const ObjectPool& pool = ObjectPool::Handle(code.object_pool());
+ if (pool.InfoAt(index) == ObjectPool::kTaggedObject) {
+ *obj = pool.ObjectAt(index);
+ return true;
+ }
+ }
return false;
}
« no previous file with comments | « runtime/vm/constants_dbc.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698