OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 | 254 |
255 | 255 |
256 void LogMessageBuilder::AppendAddress(Address addr) { | 256 void LogMessageBuilder::AppendAddress(Address addr) { |
257 static Address last_address_ = NULL; | 257 static Address last_address_ = NULL; |
258 AppendAddress(addr, last_address_); | 258 AppendAddress(addr, last_address_); |
259 last_address_ = addr; | 259 last_address_ = addr; |
260 } | 260 } |
261 | 261 |
262 | 262 |
263 void LogMessageBuilder::AppendAddress(Address addr, Address bias) { | 263 void LogMessageBuilder::AppendAddress(Address addr, Address bias) { |
264 if (!FLAG_compress_log || bias == NULL) { | 264 if (!FLAG_compress_log) { |
265 Append("0x%" V8PRIxPTR, addr); | 265 Append("0x%" V8PRIxPTR, addr); |
| 266 } else if (bias == NULL) { |
| 267 Append("%" V8PRIxPTR, addr); |
266 } else { | 268 } else { |
267 intptr_t delta = addr - bias; | 269 uintptr_t delta; |
268 // To avoid printing negative offsets in an unsigned form, | 270 char sign; |
269 // we are printing an absolute value with a sign. | 271 if (addr >= bias) { |
270 const char sign = delta >= 0 ? '+' : '-'; | 272 delta = addr - bias; |
271 if (sign == '-') { delta = -delta; } | 273 sign = '+'; |
| 274 } else { |
| 275 delta = bias - addr; |
| 276 sign = '-'; |
| 277 } |
272 Append("%c%" V8PRIxPTR, sign, delta); | 278 Append("%c%" V8PRIxPTR, sign, delta); |
273 } | 279 } |
274 } | 280 } |
275 | 281 |
276 | 282 |
277 void LogMessageBuilder::AppendDetailed(String* str, bool show_impl_info) { | 283 void LogMessageBuilder::AppendDetailed(String* str, bool show_impl_info) { |
278 AssertNoAllocation no_heap_allocation; // Ensure string stay valid. | 284 AssertNoAllocation no_heap_allocation; // Ensure string stay valid. |
279 int len = str->length(); | 285 int len = str->length(); |
280 if (len > 0x1000) | 286 if (len > 0x1000) |
281 len = 0x1000; | 287 len = 0x1000; |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 PrintBackwardReference(backref, best.distance, best.copy_from_pos); | 480 PrintBackwardReference(backref, best.distance, best.copy_from_pos); |
475 ASSERT(strlen(backref.start()) - best.backref_size == 0); | 481 ASSERT(strlen(backref.start()) - best.backref_size == 0); |
476 prev_record->Truncate(unchanged_len + best.backref_size); | 482 prev_record->Truncate(unchanged_len + best.backref_size); |
477 } | 483 } |
478 return true; | 484 return true; |
479 } | 485 } |
480 | 486 |
481 #endif // ENABLE_LOGGING_AND_PROFILING | 487 #endif // ENABLE_LOGGING_AND_PROFILING |
482 | 488 |
483 } } // namespace v8::internal | 489 } } // namespace v8::internal |
OLD | NEW |