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) && \ |