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 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1080 HeapNumber); | 1080 HeapNumber); |
1081 } | 1081 } |
1082 | 1082 |
1083 | 1083 |
1084 Handle<Object> Factory::NewError(const char* maker, | 1084 Handle<Object> Factory::NewError(const char* maker, |
1085 MessageTemplate::Template template_index, | 1085 MessageTemplate::Template template_index, |
1086 Handle<Object> arg0, Handle<Object> arg1, | 1086 Handle<Object> arg0, Handle<Object> arg1, |
1087 Handle<Object> arg2) { | 1087 Handle<Object> arg2) { |
1088 HandleScope scope(isolate()); | 1088 HandleScope scope(isolate()); |
1089 Handle<String> error_maker = InternalizeUtf8String(maker); | 1089 Handle<String> error_maker = InternalizeUtf8String(maker); |
| 1090 if (isolate()->bootstrapper()->IsActive()) { |
| 1091 // If this exception is being thrown during bootstrapping, |
| 1092 // js_builtins_object is unavailable. We return the error maker |
| 1093 // name's string as the exception since we have nothing better |
| 1094 // to do. |
| 1095 return scope.CloseAndEscape(error_maker); |
| 1096 } |
1090 Handle<Object> fun_obj = Object::GetProperty(isolate()->js_builtins_object(), | 1097 Handle<Object> fun_obj = Object::GetProperty(isolate()->js_builtins_object(), |
1091 error_maker).ToHandleChecked(); | 1098 error_maker).ToHandleChecked(); |
1092 | 1099 |
1093 Handle<JSFunction> fun = Handle<JSFunction>::cast(fun_obj); | 1100 Handle<JSFunction> fun = Handle<JSFunction>::cast(fun_obj); |
1094 Handle<Object> message_type(Smi::FromInt(template_index), isolate()); | 1101 Handle<Object> message_type(Smi::FromInt(template_index), isolate()); |
1095 if (arg0.is_null()) arg0 = undefined_value(); | 1102 if (arg0.is_null()) arg0 = undefined_value(); |
1096 if (arg1.is_null()) arg1 = undefined_value(); | 1103 if (arg1.is_null()) arg1 = undefined_value(); |
1097 if (arg2.is_null()) arg2 = undefined_value(); | 1104 if (arg2.is_null()) arg2 = undefined_value(); |
1098 Handle<Object> argv[] = {message_type, arg0, arg1, arg2}; | 1105 Handle<Object> argv[] = {message_type, arg0, arg1, arg2}; |
1099 | 1106 |
(...skipping 1365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2465 } | 2472 } |
2466 | 2473 |
2467 | 2474 |
2468 Handle<Object> Factory::ToBoolean(bool value) { | 2475 Handle<Object> Factory::ToBoolean(bool value) { |
2469 return value ? true_value() : false_value(); | 2476 return value ? true_value() : false_value(); |
2470 } | 2477 } |
2471 | 2478 |
2472 | 2479 |
2473 } // namespace internal | 2480 } // namespace internal |
2474 } // namespace v8 | 2481 } // namespace v8 |
OLD | NEW |