| 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 1232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1243 &exception) | 1243 &exception) |
| 1244 .ToHandle(&result)) { | 1244 .ToHandle(&result)) { |
| 1245 Handle<Object> exception_obj; | 1245 Handle<Object> exception_obj; |
| 1246 if (exception.ToHandle(&exception_obj)) return exception_obj; | 1246 if (exception.ToHandle(&exception_obj)) return exception_obj; |
| 1247 return undefined_value(); | 1247 return undefined_value(); |
| 1248 } | 1248 } |
| 1249 return result; | 1249 return result; |
| 1250 } | 1250 } |
| 1251 | 1251 |
| 1252 | 1252 |
| 1253 Handle<Object> Factory::NewError(const char* constructor, | 1253 Handle<Object> Factory::NewError(Handle<JSFunction> constructor, |
| 1254 Handle<String> message) { | 1254 Handle<String> message) { |
| 1255 Handle<String> constr = InternalizeUtf8String(constructor); | |
| 1256 Handle<JSFunction> fun = Handle<JSFunction>::cast(Object::GetProperty( | |
| 1257 isolate()->js_builtins_object(), constr).ToHandleChecked()); | |
| 1258 Handle<Object> argv[] = { message }; | 1255 Handle<Object> argv[] = { message }; |
| 1259 | 1256 |
| 1260 // Invoke the JavaScript factory method. If an exception is thrown while | 1257 // Invoke the JavaScript factory method. If an exception is thrown while |
| 1261 // running the factory method, use the exception as the result. | 1258 // running the factory method, use the exception as the result. |
| 1262 Handle<Object> result; | 1259 Handle<Object> result; |
| 1263 MaybeHandle<Object> exception; | 1260 MaybeHandle<Object> exception; |
| 1264 if (!Execution::TryCall(fun, undefined_value(), arraysize(argv), argv, | 1261 if (!Execution::TryCall(constructor, undefined_value(), arraysize(argv), argv, |
| 1265 &exception) | 1262 &exception) |
| 1266 .ToHandle(&result)) { | 1263 .ToHandle(&result)) { |
| 1267 Handle<Object> exception_obj; | 1264 Handle<Object> exception_obj; |
| 1268 if (exception.ToHandle(&exception_obj)) return exception_obj; | 1265 if (exception.ToHandle(&exception_obj)) return exception_obj; |
| 1269 return undefined_value(); | 1266 return undefined_value(); |
| 1270 } | 1267 } |
| 1271 return result; | 1268 return result; |
| 1272 } | 1269 } |
| 1273 | 1270 |
| 1274 | 1271 |
| (...skipping 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2468 } | 2465 } |
| 2469 | 2466 |
| 2470 | 2467 |
| 2471 Handle<Object> Factory::ToBoolean(bool value) { | 2468 Handle<Object> Factory::ToBoolean(bool value) { |
| 2472 return value ? true_value() : false_value(); | 2469 return value ? true_value() : false_value(); |
| 2473 } | 2470 } |
| 2474 | 2471 |
| 2475 | 2472 |
| 2476 } // namespace internal | 2473 } // namespace internal |
| 2477 } // namespace v8 | 2474 } // namespace v8 |
| OLD | NEW |