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