| Index: src/v8utils.cc
|
| diff --git a/src/utils.cc b/src/v8utils.cc
|
| similarity index 82%
|
| copy from src/utils.cc
|
| copy to src/v8utils.cc
|
| index 812071a8bf8565739f48f66591704710ad8a48f7..7390d854e63eb850adffe1ecca53138ebcdd5a6a 100644
|
| --- a/src/utils.cc
|
| +++ b/src/v8utils.cc
|
| @@ -26,80 +26,17 @@
|
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
| #include <stdarg.h>
|
| -#include <sys/stat.h>
|
|
|
| #include "v8.h"
|
|
|
| -#include "checks.h"
|
| #include "platform.h"
|
| -#include "utils.h"
|
| +
|
| +#include "sys/stat.h"
|
|
|
| namespace v8 {
|
| namespace internal {
|
|
|
|
|
| -SimpleStringBuilder::SimpleStringBuilder(int size) {
|
| - buffer_ = Vector<char>::New(size);
|
| - position_ = 0;
|
| -}
|
| -
|
| -
|
| -void SimpleStringBuilder::AddString(const char* s) {
|
| - AddSubstring(s, StrLength(s));
|
| -}
|
| -
|
| -
|
| -void SimpleStringBuilder::AddSubstring(const char* s, int n) {
|
| - ASSERT(!is_finalized() && position_ + n <= buffer_.length());
|
| - ASSERT(static_cast<size_t>(n) <= strlen(s));
|
| - OS::MemCopy(&buffer_[position_], s, n * kCharSize);
|
| - position_ += n;
|
| -}
|
| -
|
| -
|
| -void SimpleStringBuilder::AddPadding(char c, int count) {
|
| - for (int i = 0; i < count; i++) {
|
| - AddCharacter(c);
|
| - }
|
| -}
|
| -
|
| -
|
| -void SimpleStringBuilder::AddDecimalInteger(int32_t value) {
|
| - uint32_t number = static_cast<uint32_t>(value);
|
| - if (value < 0) {
|
| - AddCharacter('-');
|
| - number = static_cast<uint32_t>(-value);
|
| - }
|
| - int digits = 1;
|
| - for (uint32_t factor = 10; digits < 10; digits++, factor *= 10) {
|
| - if (factor > number) break;
|
| - }
|
| - position_ += digits;
|
| - for (int i = 1; i <= digits; i++) {
|
| - buffer_[position_ - i] = '0' + static_cast<char>(number % 10);
|
| - number /= 10;
|
| - }
|
| -}
|
| -
|
| -
|
| -char* SimpleStringBuilder::Finalize() {
|
| - ASSERT(!is_finalized() && position_ <= buffer_.length());
|
| - // If there is no space for null termination, overwrite last character.
|
| - if (position_ == buffer_.length()) {
|
| - position_--;
|
| - // Print ellipsis.
|
| - for (int i = 3; i > 0 && position_ > i; --i) buffer_[position_ - i] = '.';
|
| - }
|
| - buffer_[position_] = '\0';
|
| - // Make sure nobody managed to add a 0-character to the
|
| - // buffer while building the string.
|
| - ASSERT(strlen(buffer_.start()) == static_cast<size_t>(position_));
|
| - position_ = -1;
|
| - ASSERT(is_finalized());
|
| - return buffer_.start();
|
| -}
|
| -
|
| -
|
| void PrintF(const char* format, ...) {
|
| va_list arguments;
|
| va_start(arguments, format);
|
| @@ -336,5 +273,4 @@ void StringBuilder::AddFormattedList(const char* format, va_list list) {
|
| }
|
| }
|
|
|
| -
|
| } } // namespace v8::internal
|
|
|