| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <stdarg.h> | 5 #include <stdarg.h> |
| 6 #include <sys/stat.h> | 6 #include <sys/stat.h> |
| 7 | 7 |
| 8 #include "src/v8.h" | 8 #include "src/v8.h" |
| 9 | 9 |
| 10 #include "src/checks.h" | 10 #include "src/checks.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 | 95 |
| 96 void PrintPID(const char* format, ...) { | 96 void PrintPID(const char* format, ...) { |
| 97 OS::Print("[%d] ", OS::GetCurrentProcessId()); | 97 OS::Print("[%d] ", OS::GetCurrentProcessId()); |
| 98 va_list arguments; | 98 va_list arguments; |
| 99 va_start(arguments, format); | 99 va_start(arguments, format); |
| 100 OS::VPrint(format, arguments); | 100 OS::VPrint(format, arguments); |
| 101 va_end(arguments); | 101 va_end(arguments); |
| 102 } | 102 } |
| 103 | 103 |
| 104 | 104 |
| 105 int SNPrintF(Vector<char> str, const char* format, ...) { |
| 106 va_list args; |
| 107 va_start(args, format); |
| 108 int result = VSNPrintF(str, format, args); |
| 109 va_end(args); |
| 110 return result; |
| 111 } |
| 112 |
| 113 |
| 114 int VSNPrintF(Vector<char> str, const char* format, va_list args) { |
| 115 return OS::VSNPrintF(str.start(), str.length(), format, args); |
| 116 } |
| 117 |
| 118 |
| 119 void StrNCpy(Vector<char> dest, const char* src, size_t n) { |
| 120 OS::StrNCpy(dest.start(), dest.length(), src, n); |
| 121 } |
| 122 |
| 123 |
| 105 void Flush(FILE* out) { | 124 void Flush(FILE* out) { |
| 106 fflush(out); | 125 fflush(out); |
| 107 } | 126 } |
| 108 | 127 |
| 109 | 128 |
| 110 char* ReadLine(const char* prompt) { | 129 char* ReadLine(const char* prompt) { |
| 111 char* result = NULL; | 130 char* result = NULL; |
| 112 char line_buf[256]; | 131 char line_buf[256]; |
| 113 int offset = 0; | 132 int offset = 0; |
| 114 bool keep_going = true; | 133 bool keep_going = true; |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 void StringBuilder::AddFormatted(const char* format, ...) { | 317 void StringBuilder::AddFormatted(const char* format, ...) { |
| 299 va_list arguments; | 318 va_list arguments; |
| 300 va_start(arguments, format); | 319 va_start(arguments, format); |
| 301 AddFormattedList(format, arguments); | 320 AddFormattedList(format, arguments); |
| 302 va_end(arguments); | 321 va_end(arguments); |
| 303 } | 322 } |
| 304 | 323 |
| 305 | 324 |
| 306 void StringBuilder::AddFormattedList(const char* format, va_list list) { | 325 void StringBuilder::AddFormattedList(const char* format, va_list list) { |
| 307 ASSERT(!is_finalized() && position_ <= buffer_.length()); | 326 ASSERT(!is_finalized() && position_ <= buffer_.length()); |
| 308 int n = OS::VSNPrintF(buffer_ + position_, format, list); | 327 int n = VSNPrintF(buffer_ + position_, format, list); |
| 309 if (n < 0 || n >= (buffer_.length() - position_)) { | 328 if (n < 0 || n >= (buffer_.length() - position_)) { |
| 310 position_ = buffer_.length(); | 329 position_ = buffer_.length(); |
| 311 } else { | 330 } else { |
| 312 position_ += n; | 331 position_ += n; |
| 313 } | 332 } |
| 314 } | 333 } |
| 315 | 334 |
| 316 | 335 |
| 317 #if V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X87 | 336 #if V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X87 |
| 318 static void MemMoveWrapper(void* dest, const void* src, size_t size) { | 337 static void MemMoveWrapper(void* dest, const void* src, size_t size) { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 } | 408 } |
| 390 if (u.bits.exp == 0) { | 409 if (u.bits.exp == 0) { |
| 391 // Detect +0, and -0 for IEEE double precision floating point. | 410 // Detect +0, and -0 for IEEE double precision floating point. |
| 392 if ((u.bits.man_low | u.bits.man_high) == 0) return false; | 411 if ((u.bits.man_low | u.bits.man_high) == 0) return false; |
| 393 } | 412 } |
| 394 return true; | 413 return true; |
| 395 } | 414 } |
| 396 | 415 |
| 397 | 416 |
| 398 } } // namespace v8::internal | 417 } } // namespace v8::internal |
| OLD | NEW |