| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 #include "vm/cpu.h" | 6 #include "vm/cpu.h" |
| 7 #include "vm/heap.h" | 7 #include "vm/heap.h" |
| 8 #include "vm/memory_region.h" | 8 #include "vm/memory_region.h" |
| 9 #include "vm/os.h" |
| 9 #include "vm/utils.h" | 10 #include "vm/utils.h" |
| 10 #include "vm/zone.h" | 11 #include "vm/zone.h" |
| 11 | 12 |
| 12 namespace dart { | 13 namespace dart { |
| 13 | 14 |
| 14 static uword NewContents(int capacity) { | 15 static uword NewContents(int capacity) { |
| 15 Zone* zone = Isolate::Current()->current_zone(); | 16 Zone* zone = Isolate::Current()->current_zone(); |
| 16 uword result = zone->Allocate(capacity); | 17 uword result = zone->Allocate(capacity); |
| 17 #if defined(DEBUG) | 18 #if defined(DEBUG) |
| 18 // Initialize the buffer with kBreakPointInstruction to force a break | 19 // Initialize the buffer with kBreakPointInstruction to force a break |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 // the handle needs to be a zone handle. | 148 // the handle needs to be a zone handle. |
| 148 ASSERT(object.IsZoneHandle()); | 149 ASSERT(object.IsZoneHandle()); |
| 149 EmitFixup(new PatchCodeWithHandle(pointer_offsets_, object)); | 150 EmitFixup(new PatchCodeWithHandle(pointer_offsets_, object)); |
| 150 cursor_ += kWordSize; // Reserve space for pointer. | 151 cursor_ += kWordSize; // Reserve space for pointer. |
| 151 } | 152 } |
| 152 | 153 |
| 153 | 154 |
| 154 // Shared macros are implemented here. | 155 // Shared macros are implemented here. |
| 155 void Assembler::Unimplemented(const char* message) { | 156 void Assembler::Unimplemented(const char* message) { |
| 156 const char* format = "Unimplemented: %s"; | 157 const char* format = "Unimplemented: %s"; |
| 157 const intptr_t len = snprintf(NULL, 0, format, message); | 158 const intptr_t len = OS::SNPrint(NULL, 0, format, message); |
| 158 char* buffer = reinterpret_cast<char*>(malloc(len + 1)); | 159 char* buffer = reinterpret_cast<char*>(malloc(len + 1)); |
| 159 snprintf(buffer, len + 1, format, message); | 160 OS::SNPrint(buffer, len + 1, format, message); |
| 160 Stop(buffer); | 161 Stop(buffer); |
| 161 } | 162 } |
| 162 | 163 |
| 163 | 164 |
| 164 void Assembler::Untested(const char* message) { | 165 void Assembler::Untested(const char* message) { |
| 165 const char* format = "Untested: %s"; | 166 const char* format = "Untested: %s"; |
| 166 const intptr_t len = snprintf(NULL, 0, format, message); | 167 const intptr_t len = OS::SNPrint(NULL, 0, format, message); |
| 167 char* buffer = reinterpret_cast<char*>(malloc(len + 1)); | 168 char* buffer = reinterpret_cast<char*>(malloc(len + 1)); |
| 168 snprintf(buffer, len + 1, format, message); | 169 OS::SNPrint(buffer, len + 1, format, message); |
| 169 Stop(buffer); | 170 Stop(buffer); |
| 170 } | 171 } |
| 171 | 172 |
| 172 | 173 |
| 173 void Assembler::Unreachable(const char* message) { | 174 void Assembler::Unreachable(const char* message) { |
| 174 const char* format = "Unreachable: %s"; | 175 const char* format = "Unreachable: %s"; |
| 175 const intptr_t len = snprintf(NULL, 0, format, message); | 176 const intptr_t len = OS::SNPrint(NULL, 0, format, message); |
| 176 char* buffer = reinterpret_cast<char*>(malloc(len + 1)); | 177 char* buffer = reinterpret_cast<char*>(malloc(len + 1)); |
| 177 snprintf(buffer, len + 1, format, message); | 178 OS::SNPrint(buffer, len + 1, format, message); |
| 178 Stop(buffer); | 179 Stop(buffer); |
| 179 } | 180 } |
| 180 | 181 |
| 181 } // namespace dart | 182 } // namespace dart |
| OLD | NEW |