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

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

Issue 410333003: Shorter TryAllocate instruction sequence on ARM/ARM64/MIPS. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 5 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 | « no previous file | runtime/vm/assembler_arm.h » ('j') | runtime/vm/assembler_arm64.h » ('J')
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/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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 void Assembler::Unreachable(const char* message) { 203 void Assembler::Unreachable(const char* message) {
204 const char* format = "Unreachable: %s"; 204 const char* format = "Unreachable: %s";
205 const intptr_t len = OS::SNPrint(NULL, 0, format, message); 205 const intptr_t len = OS::SNPrint(NULL, 0, format, message);
206 char* buffer = reinterpret_cast<char*>(malloc(len + 1)); 206 char* buffer = reinterpret_cast<char*>(malloc(len + 1));
207 OS::SNPrint(buffer, len + 1, format, message); 207 OS::SNPrint(buffer, len + 1, format, message);
208 Stop(buffer); 208 Stop(buffer);
209 } 209 }
210 210
211 211
212 void Assembler::Comment(const char* format, ...) { 212 void Assembler::Comment(const char* format, ...) {
213 if (FLAG_code_comments || FLAG_disassemble || FLAG_disassemble_optimized) { 213 if (EmittingComments()) {
214 char buffer[1024]; 214 char buffer[1024];
215 215
216 va_list args; 216 va_list args;
217 va_start(args, format); 217 va_start(args, format);
218 OS::VSNPrint(buffer, sizeof(buffer), format, args); 218 OS::VSNPrint(buffer, sizeof(buffer), format, args);
219 va_end(args); 219 va_end(args);
220 220
221 comments_.Add(new CodeComment(buffer_.GetPosition(), 221 comments_.Add(new CodeComment(buffer_.GetPosition(),
222 String::ZoneHandle(String::New(buffer, 222 String::ZoneHandle(String::New(buffer,
223 Heap::kOld)))); 223 Heap::kOld))));
224 } 224 }
225 } 225 }
226 226
227 227
228 bool Assembler::EmittingComments() {
229 return FLAG_code_comments || FLAG_disassemble || FLAG_disassemble_optimized;
230 }
231
232
228 const Code::Comments& Assembler::GetCodeComments() const { 233 const Code::Comments& Assembler::GetCodeComments() const {
229 Code::Comments& comments = Code::Comments::New(comments_.length()); 234 Code::Comments& comments = Code::Comments::New(comments_.length());
230 235
231 for (intptr_t i = 0; i < comments_.length(); i++) { 236 for (intptr_t i = 0; i < comments_.length(); i++) {
232 comments.SetPCOffsetAt(i, comments_[i]->pc_offset()); 237 comments.SetPCOffsetAt(i, comments_[i]->pc_offset());
233 comments.SetCommentAt(i, comments_[i]->comment()); 238 comments.SetCommentAt(i, comments_[i]->comment());
234 } 239 }
235 240
236 return comments; 241 return comments;
237 } 242 }
238 243
239 } // namespace dart 244 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/assembler_arm.h » ('j') | runtime/vm/assembler_arm64.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698