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 1104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1115 Handle<Object> message_type(Smi::FromInt(template_index), isolate()); | 1115 Handle<Object> message_type(Smi::FromInt(template_index), isolate()); |
1116 if (arg0.is_null()) arg0 = undefined_value(); | 1116 if (arg0.is_null()) arg0 = undefined_value(); |
1117 if (arg1.is_null()) arg1 = undefined_value(); | 1117 if (arg1.is_null()) arg1 = undefined_value(); |
1118 if (arg2.is_null()) arg2 = undefined_value(); | 1118 if (arg2.is_null()) arg2 = undefined_value(); |
1119 Handle<Object> argv[] = {constructor, message_type, arg0, arg1, arg2}; | 1119 Handle<Object> argv[] = {constructor, message_type, arg0, arg1, arg2}; |
1120 | 1120 |
1121 // Invoke the JavaScript factory method. If an exception is thrown while | 1121 // Invoke the JavaScript factory method. If an exception is thrown while |
1122 // running the factory method, use the exception as the result. | 1122 // running the factory method, use the exception as the result. |
1123 Handle<Object> result; | 1123 Handle<Object> result; |
1124 MaybeHandle<Object> exception; | 1124 MaybeHandle<Object> exception; |
1125 if (!Execution::TryCall(fun, undefined_value(), arraysize(argv), argv, | 1125 if (!Execution::TryCall(isolate(), fun, undefined_value(), arraysize(argv), |
1126 &exception) | 1126 argv, &exception) |
1127 .ToHandle(&result)) { | 1127 .ToHandle(&result)) { |
1128 Handle<Object> exception_obj; | 1128 Handle<Object> exception_obj; |
1129 if (exception.ToHandle(&exception_obj)) { | 1129 if (exception.ToHandle(&exception_obj)) { |
1130 result = exception_obj; | 1130 result = exception_obj; |
1131 } else { | 1131 } else { |
1132 result = undefined_value(); | 1132 result = undefined_value(); |
1133 } | 1133 } |
1134 } | 1134 } |
1135 return scope.CloseAndEscape(result); | 1135 return scope.CloseAndEscape(result); |
1136 } | 1136 } |
1137 | 1137 |
1138 | 1138 |
1139 Handle<Object> Factory::NewError(Handle<JSFunction> constructor, | 1139 Handle<Object> Factory::NewError(Handle<JSFunction> constructor, |
1140 Handle<String> message) { | 1140 Handle<String> message) { |
1141 Handle<Object> argv[] = { message }; | 1141 Handle<Object> argv[] = { message }; |
1142 | 1142 |
1143 // Invoke the JavaScript factory method. If an exception is thrown while | 1143 // Invoke the JavaScript factory method. If an exception is thrown while |
1144 // running the factory method, use the exception as the result. | 1144 // running the factory method, use the exception as the result. |
1145 Handle<Object> result; | 1145 Handle<Object> result; |
1146 MaybeHandle<Object> exception; | 1146 MaybeHandle<Object> exception; |
1147 if (!Execution::TryCall(constructor, undefined_value(), arraysize(argv), argv, | 1147 if (!Execution::TryCall(isolate(), constructor, undefined_value(), |
1148 &exception) | 1148 arraysize(argv), argv, &exception) |
1149 .ToHandle(&result)) { | 1149 .ToHandle(&result)) { |
1150 Handle<Object> exception_obj; | 1150 Handle<Object> exception_obj; |
1151 if (exception.ToHandle(&exception_obj)) return exception_obj; | 1151 if (exception.ToHandle(&exception_obj)) return exception_obj; |
1152 return undefined_value(); | 1152 return undefined_value(); |
1153 } | 1153 } |
1154 return result; | 1154 return result; |
1155 } | 1155 } |
1156 | 1156 |
1157 | 1157 |
1158 #define DEFINE_ERROR(NAME, name) \ | 1158 #define DEFINE_ERROR(NAME, name) \ |
(...skipping 1225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2384 } | 2384 } |
2385 | 2385 |
2386 | 2386 |
2387 Handle<Object> Factory::ToBoolean(bool value) { | 2387 Handle<Object> Factory::ToBoolean(bool value) { |
2388 return value ? true_value() : false_value(); | 2388 return value ? true_value() : false_value(); |
2389 } | 2389 } |
2390 | 2390 |
2391 | 2391 |
2392 } // namespace internal | 2392 } // namespace internal |
2393 } // namespace v8 | 2393 } // namespace v8 |
OLD | NEW |