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

Side by Side Diff: vm/stub_code.cc

Issue 12052033: Added macros OBJECT_IMPLEMENTATION and FINAL_OBJECT_IMPLEMENTATION (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 7 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « vm/snapshot.cc ('k') | vm/stub_code_ia32_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/disassembler.h" 9 #include "vm/disassembler.h"
10 #include "vm/flags.h" 10 #include "vm/flags.h"
(...skipping 27 matching lines...) Expand all
38 38
39 StubCode::~StubCode() { 39 StubCode::~StubCode() {
40 #define STUB_CODE_DELETER(name) \ 40 #define STUB_CODE_DELETER(name) \
41 delete name##_entry_; 41 delete name##_entry_;
42 STUB_CODE_LIST(STUB_CODE_DELETER); 42 STUB_CODE_LIST(STUB_CODE_DELETER);
43 #undef STUB_CODE_DELETER 43 #undef STUB_CODE_DELETER
44 } 44 }
45 45
46 46
47 #define STUB_CODE_GENERATE(name) \ 47 #define STUB_CODE_GENERATE(name) \
48 code |= Generate("_stub_"#name, StubCode::Generate##name##Stub); \ 48 code ^= Generate("_stub_"#name, StubCode::Generate##name##Stub); \
49 name##_entry_ = new StubEntry("_stub_"#name, code); 49 name##_entry_ = new StubEntry("_stub_"#name, code);
50 50
51 51
52 void StubCode::InitOnce() { 52 void StubCode::InitOnce() {
53 // TODO(regis): Re-enable this after we are able to generate arm code. 53 // TODO(regis): Re-enable this after we are able to generate arm code.
54 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) 54 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64)
55 // Generate all the stubs. 55 // Generate all the stubs.
56 Code& code = Code::Handle(); 56 Code& code = Code::Handle();
57 VM_STUB_CODE_LIST(STUB_CODE_GENERATE); 57 VM_STUB_CODE_LIST(STUB_CODE_GENERATE);
58 #endif 58 #endif
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 (pc < (InvokeDartCodeEntryPoint() + InvokeDartCodeSize()))); 100 (pc < (InvokeDartCodeEntryPoint() + InvokeDartCodeSize())));
101 } 101 }
102 102
103 103
104 RawCode* StubCode::GetAllocationStubForClass(const Class& cls) { 104 RawCode* StubCode::GetAllocationStubForClass(const Class& cls) {
105 Code& stub = Code::Handle(cls.allocation_stub()); 105 Code& stub = Code::Handle(cls.allocation_stub());
106 if (stub.IsNull()) { 106 if (stub.IsNull()) {
107 Assembler assembler; 107 Assembler assembler;
108 const char* name = cls.ToCString(); 108 const char* name = cls.ToCString();
109 StubCode::GenerateAllocationStubForClass(&assembler, cls); 109 StubCode::GenerateAllocationStubForClass(&assembler, cls);
110 stub |= Code::FinalizeCode(name, &assembler); 110 stub ^= Code::FinalizeCode(name, &assembler);
111 cls.set_allocation_stub(stub); 111 cls.set_allocation_stub(stub);
112 if (FLAG_disassemble_stubs) { 112 if (FLAG_disassemble_stubs) {
113 OS::Print("Code for allocation stub '%s': {\n", name); 113 OS::Print("Code for allocation stub '%s': {\n", name);
114 Disassembler::Disassemble(stub.EntryPoint(), 114 Disassembler::Disassemble(stub.EntryPoint(),
115 stub.EntryPoint() + assembler.CodeSize()); 115 stub.EntryPoint() + assembler.CodeSize());
116 OS::Print("}\n"); 116 OS::Print("}\n");
117 } 117 }
118 } 118 }
119 return stub.raw(); 119 return stub.raw();
120 } 120 }
121 121
122 122
123 RawCode* StubCode::GetAllocationStubForClosure(const Function& func) { 123 RawCode* StubCode::GetAllocationStubForClosure(const Function& func) {
124 Code& stub = Code::Handle(func.closure_allocation_stub()); 124 Code& stub = Code::Handle(func.closure_allocation_stub());
125 if (stub.IsNull()) { 125 if (stub.IsNull()) {
126 Assembler assembler; 126 Assembler assembler;
127 const char* name = func.ToCString(); 127 const char* name = func.ToCString();
128 StubCode::GenerateAllocationStubForClosure(&assembler, func); 128 StubCode::GenerateAllocationStubForClosure(&assembler, func);
129 stub |= Code::FinalizeCode(name, &assembler); 129 stub ^= Code::FinalizeCode(name, &assembler);
130 func.set_closure_allocation_stub(stub); 130 func.set_closure_allocation_stub(stub);
131 if (FLAG_disassemble_stubs) { 131 if (FLAG_disassemble_stubs) {
132 OS::Print("Code for closure allocation stub '%s': {\n", name); 132 OS::Print("Code for closure allocation stub '%s': {\n", name);
133 Disassembler::Disassemble(stub.EntryPoint(), 133 Disassembler::Disassemble(stub.EntryPoint(),
134 stub.EntryPoint() + assembler.CodeSize()); 134 stub.EntryPoint() + assembler.CodeSize());
135 OS::Print("}\n"); 135 OS::Print("}\n");
136 } 136 }
137 } 137 }
138 return stub.raw(); 138 return stub.raw();
139 } 139 }
(...skipping 23 matching lines...) Expand all
163 VM_STUB_CODE_LIST(STUB_CODE_TESTER); 163 VM_STUB_CODE_LIST(STUB_CODE_TESTER);
164 Isolate* isolate = Isolate::Current(); 164 Isolate* isolate = Isolate::Current();
165 if ((isolate != NULL) && (isolate->stub_code() != NULL)) { 165 if ((isolate != NULL) && (isolate->stub_code() != NULL)) {
166 STUB_CODE_LIST(STUB_CODE_TESTER); 166 STUB_CODE_LIST(STUB_CODE_TESTER);
167 } 167 }
168 #undef STUB_CODE_TESTER 168 #undef STUB_CODE_TESTER
169 return NULL; 169 return NULL;
170 } 170 }
171 171
172 } // namespace dart 172 } // namespace dart
OLDNEW
« no previous file with comments | « vm/snapshot.cc ('k') | vm/stub_code_ia32_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698