| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/stub_code.h" | 5 #include "vm/stub_code.h" |
| 6 | 6 |
| 7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
| 8 #include "platform/globals.h" |
| 8 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
| 9 #include "vm/disassembler.h" | 10 #include "vm/disassembler.h" |
| 10 #include "vm/flags.h" | 11 #include "vm/flags.h" |
| 11 #include "vm/virtual_memory.h" | 12 #include "vm/virtual_memory.h" |
| 12 #include "vm/visitor.h" | 13 #include "vm/visitor.h" |
| 13 | 14 |
| 14 namespace dart { | 15 namespace dart { |
| 15 | 16 |
| 16 DEFINE_FLAG(bool, disassemble_stubs, false, "Disassemble generated stubs."); | 17 DEFINE_FLAG(bool, disassemble_stubs, false, "Disassemble generated stubs."); |
| 17 | 18 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 43 #undef STUB_CODE_DELETER | 44 #undef STUB_CODE_DELETER |
| 44 } | 45 } |
| 45 | 46 |
| 46 | 47 |
| 47 #define STUB_CODE_GENERATE(name) \ | 48 #define STUB_CODE_GENERATE(name) \ |
| 48 code ^= Generate("_stub_"#name, StubCode::Generate##name##Stub); \ | 49 code ^= Generate("_stub_"#name, StubCode::Generate##name##Stub); \ |
| 49 name##_entry_ = new StubEntry("_stub_"#name, code); | 50 name##_entry_ = new StubEntry("_stub_"#name, code); |
| 50 | 51 |
| 51 | 52 |
| 52 void StubCode::InitOnce() { | 53 void StubCode::InitOnce() { |
| 54 // TODO(zra): ifndef to be removed when ARM64 port is ready. |
| 55 #if !defined(TARGET_ARCH_ARM64) |
| 53 // Generate all the stubs. | 56 // Generate all the stubs. |
| 54 Code& code = Code::Handle(); | 57 Code& code = Code::Handle(); |
| 55 VM_STUB_CODE_LIST(STUB_CODE_GENERATE); | 58 VM_STUB_CODE_LIST(STUB_CODE_GENERATE); |
| 59 #endif |
| 56 } | 60 } |
| 57 | 61 |
| 58 | 62 |
| 59 void StubCode::GenerateFor(Isolate* init) { | 63 void StubCode::GenerateFor(Isolate* init) { |
| 60 // Generate all the stubs. | 64 // Generate all the stubs. |
| 61 Code& code = Code::Handle(); | 65 Code& code = Code::Handle(); |
| 62 STUB_CODE_LIST(STUB_CODE_GENERATE); | 66 STUB_CODE_LIST(STUB_CODE_GENERATE); |
| 63 } | 67 } |
| 64 | 68 |
| 65 #undef STUB_CODE_GENERATE | 69 #undef STUB_CODE_GENERATE |
| 66 | 70 |
| 67 | 71 |
| 68 void StubCode::Init(Isolate* isolate) { | 72 void StubCode::Init(Isolate* isolate) { |
| 73 // TODO(zra): ifndef to be removed when ARM64 port is ready. |
| 74 #if !defined(TARGET_ARCH_ARM64) |
| 69 StubCode* stubs = new StubCode(); | 75 StubCode* stubs = new StubCode(); |
| 70 isolate->set_stub_code(stubs); | 76 isolate->set_stub_code(stubs); |
| 71 stubs->GenerateFor(isolate); | 77 stubs->GenerateFor(isolate); |
| 78 #endif |
| 72 } | 79 } |
| 73 | 80 |
| 74 | 81 |
| 75 void StubCode::VisitObjectPointers(ObjectPointerVisitor* visitor) { | 82 void StubCode::VisitObjectPointers(ObjectPointerVisitor* visitor) { |
| 76 // The current isolate is needed as part of the macro. | 83 // The current isolate is needed as part of the macro. |
| 77 Isolate* isolate = Isolate::Current(); | 84 Isolate* isolate = Isolate::Current(); |
| 78 StubCode* stubs = isolate->stub_code(); | 85 StubCode* stubs = isolate->stub_code(); |
| 79 if (stubs == NULL) return; | 86 if (stubs == NULL) return; |
| 80 StubEntry* entry; | 87 StubEntry* entry; |
| 81 #define STUB_CODE_VISIT_OBJECT_POINTER(name) \ | 88 #define STUB_CODE_VISIT_OBJECT_POINTER(name) \ |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 VM_STUB_CODE_LIST(STUB_CODE_TESTER); | 149 VM_STUB_CODE_LIST(STUB_CODE_TESTER); |
| 143 Isolate* isolate = Isolate::Current(); | 150 Isolate* isolate = Isolate::Current(); |
| 144 if ((isolate != NULL) && (isolate->stub_code() != NULL)) { | 151 if ((isolate != NULL) && (isolate->stub_code() != NULL)) { |
| 145 STUB_CODE_LIST(STUB_CODE_TESTER); | 152 STUB_CODE_LIST(STUB_CODE_TESTER); |
| 146 } | 153 } |
| 147 #undef STUB_CODE_TESTER | 154 #undef STUB_CODE_TESTER |
| 148 return NULL; | 155 return NULL; |
| 149 } | 156 } |
| 150 | 157 |
| 151 } // namespace dart | 158 } // namespace dart |
| OLD | NEW |