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/assembler.h" | 5 #include "vm/assembler.h" |
6 | 6 |
7 #include "platform/utils.h" | 7 #include "platform/utils.h" |
8 #include "vm/cpu.h" | 8 #include "vm/cpu.h" |
9 #include "vm/heap.h" | 9 #include "vm/heap.h" |
10 #include "vm/memory_region.h" | 10 #include "vm/memory_region.h" |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
174 void AssemblerBuffer::EmitObject(const Object& object) { | 174 void AssemblerBuffer::EmitObject(const Object& object) { |
175 // Since we are going to store the handle as part of the fixup information | 175 // Since we are going to store the handle as part of the fixup information |
176 // the handle needs to be a zone handle. | 176 // the handle needs to be a zone handle. |
177 ASSERT(object.IsNotTemporaryScopedHandle()); | 177 ASSERT(object.IsNotTemporaryScopedHandle()); |
178 ASSERT(object.IsOld()); | 178 ASSERT(object.IsOld()); |
179 EmitFixup(new PatchCodeWithHandle(pointer_offsets_, object)); | 179 EmitFixup(new PatchCodeWithHandle(pointer_offsets_, object)); |
180 cursor_ += kWordSize; // Reserve space for pointer. | 180 cursor_ += kWordSize; // Reserve space for pointer. |
181 } | 181 } |
182 | 182 |
183 | 183 |
184 // Shared macros are implemented here. | |
zra
2015/09/08 21:09:24
These weren't used, and have a memory leak.
| |
185 void Assembler::Unimplemented(const char* message) { | |
186 const char* format = "Unimplemented: %s"; | |
187 const intptr_t len = OS::SNPrint(NULL, 0, format, message); | |
188 char* buffer = reinterpret_cast<char*>(malloc(len + 1)); | |
189 OS::SNPrint(buffer, len + 1, format, message); | |
190 Stop(buffer); | |
191 } | |
192 | |
193 | |
194 void Assembler::Untested(const char* message) { | |
195 const char* format = "Untested: %s"; | |
196 const intptr_t len = OS::SNPrint(NULL, 0, format, message); | |
197 char* buffer = reinterpret_cast<char*>(malloc(len + 1)); | |
198 OS::SNPrint(buffer, len + 1, format, message); | |
199 Stop(buffer); | |
200 } | |
201 | |
202 | |
203 void Assembler::Unreachable(const char* message) { | |
204 const char* format = "Unreachable: %s"; | |
205 const intptr_t len = OS::SNPrint(NULL, 0, format, message); | |
206 char* buffer = reinterpret_cast<char*>(malloc(len + 1)); | |
207 OS::SNPrint(buffer, len + 1, format, message); | |
208 Stop(buffer); | |
209 } | |
210 | |
211 | |
212 void Assembler::Comment(const char* format, ...) { | 184 void Assembler::Comment(const char* format, ...) { |
213 if (EmittingComments()) { | 185 if (EmittingComments()) { |
214 char buffer[1024]; | 186 char buffer[1024]; |
215 | 187 |
216 va_list args; | 188 va_list args; |
217 va_start(args, format); | 189 va_start(args, format); |
218 OS::VSNPrint(buffer, sizeof(buffer), format, args); | 190 OS::VSNPrint(buffer, sizeof(buffer), format, args); |
219 va_end(args); | 191 va_end(args); |
220 | 192 |
221 comments_.Add(new CodeComment(buffer_.GetPosition(), | 193 comments_.Add(new CodeComment(buffer_.GetPosition(), |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
320 result.SetObjectAt(i, *object_pool_[i].obj_); | 292 result.SetObjectAt(i, *object_pool_[i].obj_); |
321 } else { | 293 } else { |
322 result.SetRawValueAt(i, object_pool_[i].raw_value_); | 294 result.SetRawValueAt(i, object_pool_[i].raw_value_); |
323 } | 295 } |
324 } | 296 } |
325 return result.raw(); | 297 return result.raw(); |
326 } | 298 } |
327 | 299 |
328 | 300 |
329 } // namespace dart | 301 } // namespace dart |
OLD | NEW |