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

Side by Side Diff: runtime/vm/stub_code.cc

Issue 1454553004: Create code and instruction object, and install them in the background compilation thread while br… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address comments Created 5 years, 1 month 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
« no previous file with comments | « runtime/vm/profiler_test.cc ('k') | runtime/vm/thread_registry.h » ('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 "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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 const Error& error = Error::Handle(zone, cls.EnsureIsFinalized(thread)); 109 const Error& error = Error::Handle(zone, cls.EnsureIsFinalized(thread));
110 ASSERT(error.IsNull()); 110 ASSERT(error.IsNull());
111 if (cls.id() == kArrayCid) { 111 if (cls.id() == kArrayCid) {
112 return AllocateArray_entry()->code(); 112 return AllocateArray_entry()->code();
113 } 113 }
114 Code& stub = Code::Handle(zone, cls.allocation_stub()); 114 Code& stub = Code::Handle(zone, cls.allocation_stub());
115 if (stub.IsNull()) { 115 if (stub.IsNull()) {
116 Assembler assembler; 116 Assembler assembler;
117 const char* name = cls.ToCString(); 117 const char* name = cls.ToCString();
118 StubCode::GenerateAllocationStubForClass(&assembler, cls); 118 StubCode::GenerateAllocationStubForClass(&assembler, cls);
119 stub ^= Code::FinalizeCode(name, &assembler); 119 stub ^= Code::FinalizeCode(name, &assembler, false /* optimized */);
120 stub.set_owner(cls); 120 stub.set_owner(cls);
121 cls.set_allocation_stub(stub); 121 cls.set_allocation_stub(stub);
122 if (FLAG_disassemble_stubs) { 122 if (FLAG_disassemble_stubs) {
123 LogBlock lb; 123 LogBlock lb;
124 THR_Print("Code for allocation stub '%s': {\n", name); 124 THR_Print("Code for allocation stub '%s': {\n", name);
125 DisassembleToStdout formatter; 125 DisassembleToStdout formatter;
126 stub.Disassemble(&formatter); 126 stub.Disassemble(&formatter);
127 THR_Print("}\n"); 127 THR_Print("}\n");
128 const ObjectPool& object_pool = ObjectPool::Handle(stub.object_pool()); 128 const ObjectPool& object_pool = ObjectPool::Handle(stub.object_pool());
129 object_pool.DebugPrint(); 129 object_pool.DebugPrint();
(...skipping 16 matching lines...) Expand all
146 UNIMPLEMENTED(); 146 UNIMPLEMENTED();
147 return NULL; 147 return NULL;
148 } 148 }
149 } 149 }
150 150
151 151
152 RawCode* StubCode::Generate(const char* name, 152 RawCode* StubCode::Generate(const char* name,
153 void (*GenerateStub)(Assembler* assembler)) { 153 void (*GenerateStub)(Assembler* assembler)) {
154 Assembler assembler; 154 Assembler assembler;
155 GenerateStub(&assembler); 155 GenerateStub(&assembler);
156 const Code& code = Code::Handle(Code::FinalizeCode(name, &assembler)); 156 const Code& code = Code::Handle(
157 Code::FinalizeCode(name, &assembler, false /* optimized */));
157 if (FLAG_disassemble_stubs) { 158 if (FLAG_disassemble_stubs) {
158 LogBlock lb; 159 LogBlock lb;
159 THR_Print("Code for stub '%s': {\n", name); 160 THR_Print("Code for stub '%s': {\n", name);
160 DisassembleToStdout formatter; 161 DisassembleToStdout formatter;
161 code.Disassemble(&formatter); 162 code.Disassemble(&formatter);
162 THR_Print("}\n"); 163 THR_Print("}\n");
163 const ObjectPool& object_pool = ObjectPool::Handle(code.object_pool()); 164 const ObjectPool& object_pool = ObjectPool::Handle(code.object_pool());
164 object_pool.DebugPrint(); 165 object_pool.DebugPrint();
165 } 166 }
166 return code.raw(); 167 return code.raw();
167 } 168 }
168 169
169 170
170 const char* StubCode::NameOfStub(uword entry_point) { 171 const char* StubCode::NameOfStub(uword entry_point) {
171 #define VM_STUB_CODE_TESTER(name) \ 172 #define VM_STUB_CODE_TESTER(name) \
172 if ((name##_entry() != NULL) && \ 173 if ((name##_entry() != NULL) && \
173 (entry_point == name##_entry()->EntryPoint())) { \ 174 (entry_point == name##_entry()->EntryPoint())) { \
174 return ""#name; \ 175 return ""#name; \
175 } 176 }
176 VM_STUB_CODE_LIST(VM_STUB_CODE_TESTER); 177 VM_STUB_CODE_LIST(VM_STUB_CODE_TESTER);
177 #undef VM_STUB_CODE_TESTER 178 #undef VM_STUB_CODE_TESTER
178 return NULL; 179 return NULL;
179 } 180 }
180 181
181 } // namespace dart 182 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/profiler_test.cc ('k') | runtime/vm/thread_registry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698