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

Unified Diff: runtime/vm/stub_code.cc

Issue 2976723003: Eliminate dependencies on assemblers and code stubs in precompiled runtime. (Closed)
Patch Set: Eliminate precompiled runtime flag Created 3 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/stub_code.h ('k') | runtime/vm/stub_code_arm.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/stub_code.cc
diff --git a/runtime/vm/stub_code.cc b/runtime/vm/stub_code.cc
index cf77f5fa4e413b31b25f694d23c1691a8095529b..3788c987fe46a96354bdad3050131ce943902a3c 100644
--- a/runtime/vm/stub_code.cc
+++ b/runtime/vm/stub_code.cc
@@ -42,26 +42,48 @@ void StubEntry::VisitObjectPointers(ObjectPointerVisitor* visitor) {
}
+#if defined(DART_PRECOMPILED_RUNTIME)
+void StubCode::InitOnce() {
+ // Stubs will be loaded from the snapshot.
+ UNREACHABLE();
+}
+#else
+
#define STUB_CODE_GENERATE(name) \
code ^= Generate("_stub_" #name, StubCode::Generate##name##Stub); \
entries_[k##name##Index] = new StubEntry(code);
-
void StubCode::InitOnce() {
-#if defined(DART_PRECOMPILED_RUNTIME)
- // Stubs will be loaded from the snapshot.
- UNREACHABLE();
-#else
// Generate all the stubs.
Code& code = Code::Handle();
VM_STUB_CODE_LIST(STUB_CODE_GENERATE);
-#endif // DART_PRECOMPILED_RUNTIME
}
-
#undef STUB_CODE_GENERATE
+RawCode* StubCode::Generate(const char* name,
+ void (*GenerateStub)(Assembler* assembler)) {
+ Assembler assembler;
+ GenerateStub(&assembler);
+ const Code& code =
+ Code::Handle(Code::FinalizeCode(name, &assembler, false /* optimized */));
+#ifndef PRODUCT
+ if (FLAG_support_disassembler && FLAG_disassemble_stubs) {
+ LogBlock lb;
+ THR_Print("Code for stub '%s': {\n", name);
+ DisassembleToStdout formatter;
+ code.Disassemble(&formatter);
+ THR_Print("}\n");
+ const ObjectPool& object_pool = ObjectPool::Handle(code.object_pool());
+ object_pool.DebugPrint();
+ }
+#endif // !PRODUCT
+ return code.raw();
+}
+#endif // defined(DART_PRECOMPILED_RUNTIME)
+
+
void StubCode::Init(Isolate* isolate) {}
@@ -118,6 +140,7 @@ RawCode* StubCode::GetAllocationStubForClass(const Class& cls) {
return AllocateArray_entry()->code();
}
Code& stub = Code::Handle(zone, cls.allocation_stub());
+#if !defined(DART_PRECOMPILED_RUNTIME)
if (stub.IsNull()) {
Assembler assembler;
const char* name = cls.ToCString();
@@ -169,6 +192,7 @@ RawCode* StubCode::GetAllocationStubForClass(const Class& cls) {
}
#endif // !PRODUCT
}
+#endif // !defined(DART_PRECOMPILED_RUNTIME)
return stub.raw();
#endif // !DBC
UNIMPLEMENTED();
@@ -197,27 +221,6 @@ const StubEntry* StubCode::UnoptimizedStaticCallEntry(
}
-RawCode* StubCode::Generate(const char* name,
- void (*GenerateStub)(Assembler* assembler)) {
- Assembler assembler;
- GenerateStub(&assembler);
- const Code& code =
- Code::Handle(Code::FinalizeCode(name, &assembler, false /* optimized */));
-#ifndef PRODUCT
- if (FLAG_support_disassembler && FLAG_disassemble_stubs) {
- LogBlock lb;
- THR_Print("Code for stub '%s': {\n", name);
- DisassembleToStdout formatter;
- code.Disassemble(&formatter);
- THR_Print("}\n");
- const ObjectPool& object_pool = ObjectPool::Handle(code.object_pool());
- object_pool.DebugPrint();
- }
-#endif // !PRODUCT
- return code.raw();
-}
-
-
const char* StubCode::NameOfStub(uword entry_point) {
#define VM_STUB_CODE_TESTER(name) \
if ((name##_entry() != NULL) && \
« no previous file with comments | « runtime/vm/stub_code.h ('k') | runtime/vm/stub_code_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698