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

Side by Side Diff: src/factory.cc

Issue 328343003: Remove dependency on Vector from platform files (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: updates Created 6 years, 6 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 | « src/extensions/gc-extension.h ('k') | src/gdb-jit.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 "src/factory.h" 5 #include "src/factory.h"
6 6
7 #include "src/conversions.h" 7 #include "src/conversions.h"
8 #include "src/isolate-inl.h" 8 #include "src/isolate-inl.h"
9 #include "src/macro-assembler.h" 9 #include "src/macro-assembler.h"
10 10
(...skipping 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after
1090 1090
1091 1091
1092 Handle<String> Factory::EmergencyNewError(const char* message, 1092 Handle<String> Factory::EmergencyNewError(const char* message,
1093 Handle<JSArray> args) { 1093 Handle<JSArray> args) {
1094 const int kBufferSize = 1000; 1094 const int kBufferSize = 1000;
1095 char buffer[kBufferSize]; 1095 char buffer[kBufferSize];
1096 size_t space = kBufferSize; 1096 size_t space = kBufferSize;
1097 char* p = &buffer[0]; 1097 char* p = &buffer[0];
1098 1098
1099 Vector<char> v(buffer, kBufferSize); 1099 Vector<char> v(buffer, kBufferSize);
1100 OS::StrNCpy(v, message, space); 1100 StrNCpy(v, message, space);
1101 space -= Min(space, strlen(message)); 1101 space -= Min(space, strlen(message));
1102 p = &buffer[kBufferSize] - space; 1102 p = &buffer[kBufferSize] - space;
1103 1103
1104 for (unsigned i = 0; i < ARRAY_SIZE(args); i++) { 1104 for (unsigned i = 0; i < ARRAY_SIZE(args); i++) {
1105 if (space > 0) { 1105 if (space > 0) {
1106 *p++ = ' '; 1106 *p++ = ' ';
1107 space--; 1107 space--;
1108 if (space > 0) { 1108 if (space > 0) {
1109 Handle<String> arg_str = Handle<String>::cast( 1109 Handle<String> arg_str = Handle<String>::cast(
1110 Object::GetElement(isolate(), args, i).ToHandleChecked()); 1110 Object::GetElement(isolate(), args, i).ToHandleChecked());
1111 SmartArrayPointer<char> arg = arg_str->ToCString(); 1111 SmartArrayPointer<char> arg = arg_str->ToCString();
1112 Vector<char> v2(p, static_cast<int>(space)); 1112 Vector<char> v2(p, static_cast<int>(space));
1113 OS::StrNCpy(v2, arg.get(), space); 1113 StrNCpy(v2, arg.get(), space);
1114 space -= Min(space, strlen(arg.get())); 1114 space -= Min(space, strlen(arg.get()));
1115 p = &buffer[kBufferSize] - space; 1115 p = &buffer[kBufferSize] - space;
1116 } 1116 }
1117 } 1117 }
1118 } 1118 }
1119 if (space > 0) { 1119 if (space > 0) {
1120 *p = '\0'; 1120 *p = '\0';
1121 } else { 1121 } else {
1122 buffer[kBufferSize - 1] = '\0'; 1122 buffer[kBufferSize - 1] = '\0';
1123 } 1123 }
(...skipping 1213 matching lines...) Expand 10 before | Expand all | Expand 10 after
2337 return Handle<Object>::null(); 2337 return Handle<Object>::null();
2338 } 2338 }
2339 2339
2340 2340
2341 Handle<Object> Factory::ToBoolean(bool value) { 2341 Handle<Object> Factory::ToBoolean(bool value) {
2342 return value ? true_value() : false_value(); 2342 return value ? true_value() : false_value();
2343 } 2343 }
2344 2344
2345 2345
2346 } } // namespace v8::internal 2346 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/extensions/gc-extension.h ('k') | src/gdb-jit.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698