OLD | NEW |
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/allocation-site-scopes.h" | 7 #include "src/allocation-site-scopes.h" |
8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/conversions.h" | 10 #include "src/conversions.h" |
(...skipping 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1073 HeapNumber); | 1073 HeapNumber); |
1074 } | 1074 } |
1075 | 1075 |
1076 | 1076 |
1077 Handle<Object> Factory::NewTypeError(const char* message, | 1077 Handle<Object> Factory::NewTypeError(const char* message, |
1078 Vector<Handle<Object> > args) { | 1078 Vector<Handle<Object> > args) { |
1079 return NewError("MakeTypeError", message, args); | 1079 return NewError("MakeTypeError", message, args); |
1080 } | 1080 } |
1081 | 1081 |
1082 | 1082 |
| 1083 Handle<Object> Factory::NewTypeError(MessageTemplate::Template template_index, |
| 1084 Handle<Object> arg0, Handle<Object> arg1, |
| 1085 Handle<Object> arg2) { |
| 1086 return NewError("MakeTypeError2", template_index, arg0, arg1, arg2); |
| 1087 } |
| 1088 |
| 1089 |
1083 Handle<Object> Factory::NewTypeError(Handle<String> message) { | 1090 Handle<Object> Factory::NewTypeError(Handle<String> message) { |
1084 return NewError("$TypeError", message); | 1091 return NewError("$TypeError", message); |
1085 } | 1092 } |
1086 | 1093 |
1087 | 1094 |
1088 Handle<Object> Factory::NewRangeError(const char* message, | 1095 Handle<Object> Factory::NewRangeError(const char* message, |
1089 Vector<Handle<Object> > args) { | 1096 Vector<Handle<Object> > args) { |
1090 return NewError("MakeRangeError", message, args); | 1097 return NewError("MakeRangeError", message, args); |
1091 } | 1098 } |
1092 | 1099 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1170 return scope.CloseAndEscape(result); | 1177 return scope.CloseAndEscape(result); |
1171 } | 1178 } |
1172 | 1179 |
1173 | 1180 |
1174 Handle<Object> Factory::NewEvalError(const char* message, | 1181 Handle<Object> Factory::NewEvalError(const char* message, |
1175 Vector<Handle<Object> > args) { | 1182 Vector<Handle<Object> > args) { |
1176 return NewError("MakeEvalError", message, args); | 1183 return NewError("MakeEvalError", message, args); |
1177 } | 1184 } |
1178 | 1185 |
1179 | 1186 |
1180 Handle<Object> Factory::NewError(MessageTemplate::Template template_index, | 1187 Handle<Object> Factory::NewError(const char* message, |
1181 Handle<Object> arg0, Handle<Object> arg1, | 1188 Vector<Handle<Object> > args) { |
1182 Handle<Object> arg2) { | 1189 return NewError("MakeError", message, args); |
1183 return NewError("MakeError", template_index, arg0, arg1, arg2); | |
1184 } | 1190 } |
1185 | 1191 |
1186 | 1192 |
1187 Handle<Object> Factory::NewTypeError(MessageTemplate::Template template_index, | |
1188 Handle<Object> arg0, Handle<Object> arg1, | |
1189 Handle<Object> arg2) { | |
1190 return NewError("MakeTypeError", template_index, arg0, arg1, arg2); | |
1191 } | |
1192 | |
1193 | |
1194 Handle<Object> Factory::NewEvalError(MessageTemplate::Template template_index, | |
1195 Handle<Object> arg0, Handle<Object> arg1, | |
1196 Handle<Object> arg2) { | |
1197 return NewError("MakeEvalError", template_index, arg0, arg1, arg2); | |
1198 } | |
1199 | |
1200 | |
1201 Handle<String> Factory::EmergencyNewError(const char* message, | 1193 Handle<String> Factory::EmergencyNewError(const char* message, |
1202 Handle<JSArray> args) { | 1194 Handle<JSArray> args) { |
1203 const int kBufferSize = 1000; | 1195 const int kBufferSize = 1000; |
1204 char buffer[kBufferSize]; | 1196 char buffer[kBufferSize]; |
1205 size_t space = kBufferSize; | 1197 size_t space = kBufferSize; |
1206 char* p = &buffer[0]; | 1198 char* p = &buffer[0]; |
1207 | 1199 |
1208 Vector<char> v(buffer, kBufferSize); | 1200 Vector<char> v(buffer, kBufferSize); |
1209 StrNCpy(v, message, space); | 1201 StrNCpy(v, message, space); |
1210 space -= Min(space, strlen(message)); | 1202 space -= Min(space, strlen(message)); |
(...skipping 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2398 return Handle<Object>::null(); | 2390 return Handle<Object>::null(); |
2399 } | 2391 } |
2400 | 2392 |
2401 | 2393 |
2402 Handle<Object> Factory::ToBoolean(bool value) { | 2394 Handle<Object> Factory::ToBoolean(bool value) { |
2403 return value ? true_value() : false_value(); | 2395 return value ? true_value() : false_value(); |
2404 } | 2396 } |
2405 | 2397 |
2406 | 2398 |
2407 } } // namespace v8::internal | 2399 } } // namespace v8::internal |
OLD | NEW |