| 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 "platform/globals.h" |
| 9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
| 10 #include "vm/disassembler.h" | 10 #include "vm/disassembler.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 #undef STUB_CODE_DELETER | 44 #undef STUB_CODE_DELETER |
| 45 } | 45 } |
| 46 | 46 |
| 47 | 47 |
| 48 #define STUB_CODE_GENERATE(name) \ | 48 #define STUB_CODE_GENERATE(name) \ |
| 49 code ^= Generate("_stub_"#name, StubCode::Generate##name##Stub); \ | 49 code ^= Generate("_stub_"#name, StubCode::Generate##name##Stub); \ |
| 50 name##_entry_ = new StubEntry("_stub_"#name, code); | 50 name##_entry_ = new StubEntry("_stub_"#name, code); |
| 51 | 51 |
| 52 | 52 |
| 53 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) | |
| 56 // Generate all the stubs. | 54 // Generate all the stubs. |
| 57 Code& code = Code::Handle(); | 55 Code& code = Code::Handle(); |
| 58 VM_STUB_CODE_LIST(STUB_CODE_GENERATE); | 56 VM_STUB_CODE_LIST(STUB_CODE_GENERATE); |
| 59 #endif | |
| 60 } | 57 } |
| 61 | 58 |
| 62 | 59 |
| 63 void StubCode::GenerateFor(Isolate* init) { | 60 void StubCode::GenerateFor(Isolate* init) { |
| 64 // Generate all the stubs. | 61 // Generate all the stubs. |
| 65 Code& code = Code::Handle(); | 62 Code& code = Code::Handle(); |
| 66 STUB_CODE_LIST(STUB_CODE_GENERATE); | 63 STUB_CODE_LIST(STUB_CODE_GENERATE); |
| 67 } | 64 } |
| 68 | 65 |
| 69 #undef STUB_CODE_GENERATE | 66 #undef STUB_CODE_GENERATE |
| 70 | 67 |
| 71 | 68 |
| 72 void StubCode::Init(Isolate* isolate) { | 69 void StubCode::Init(Isolate* isolate) { |
| 73 // TODO(zra): ifndef to be removed when ARM64 port is ready. | |
| 74 #if !defined(TARGET_ARCH_ARM64) | |
| 75 StubCode* stubs = new StubCode(); | 70 StubCode* stubs = new StubCode(); |
| 76 isolate->set_stub_code(stubs); | 71 isolate->set_stub_code(stubs); |
| 77 stubs->GenerateFor(isolate); | 72 stubs->GenerateFor(isolate); |
| 78 #endif | |
| 79 } | 73 } |
| 80 | 74 |
| 81 | 75 |
| 82 void StubCode::VisitObjectPointers(ObjectPointerVisitor* visitor) { | 76 void StubCode::VisitObjectPointers(ObjectPointerVisitor* visitor) { |
| 83 // The current isolate is needed as part of the macro. | 77 // The current isolate is needed as part of the macro. |
| 84 Isolate* isolate = Isolate::Current(); | 78 Isolate* isolate = Isolate::Current(); |
| 85 StubCode* stubs = isolate->stub_code(); | 79 StubCode* stubs = isolate->stub_code(); |
| 86 if (stubs == NULL) return; | 80 if (stubs == NULL) return; |
| 87 StubEntry* entry; | 81 StubEntry* entry; |
| 88 #define STUB_CODE_VISIT_OBJECT_POINTER(name) \ | 82 #define STUB_CODE_VISIT_OBJECT_POINTER(name) \ |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 VM_STUB_CODE_LIST(STUB_CODE_TESTER); | 143 VM_STUB_CODE_LIST(STUB_CODE_TESTER); |
| 150 Isolate* isolate = Isolate::Current(); | 144 Isolate* isolate = Isolate::Current(); |
| 151 if ((isolate != NULL) && (isolate->stub_code() != NULL)) { | 145 if ((isolate != NULL) && (isolate->stub_code() != NULL)) { |
| 152 STUB_CODE_LIST(STUB_CODE_TESTER); | 146 STUB_CODE_LIST(STUB_CODE_TESTER); |
| 153 } | 147 } |
| 154 #undef STUB_CODE_TESTER | 148 #undef STUB_CODE_TESTER |
| 155 return NULL; | 149 return NULL; |
| 156 } | 150 } |
| 157 | 151 |
| 158 } // namespace dart | 152 } // namespace dart |
| OLD | NEW |