Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1209)

Unified Diff: src/factory.cc

Issue 231883007: Return MaybeHandle from Invoke. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/execution.cc ('K') | « src/factory.h ('k') | src/handles.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/factory.cc
diff --git a/src/factory.cc b/src/factory.cc
index 053f8704e61f73457f6b45b0dc26aee792c3dbc2..1c21dd07cf74d21ed500b8aaa62fbc6da95791a3 100644
--- a/src/factory.cc
+++ b/src/factory.cc
@@ -1158,12 +1158,13 @@ Handle<Object> Factory::NewError(const char* maker,
// Invoke the JavaScript factory method. If an exception is thrown while
// running the factory method, use the exception as the result.
- bool caught_exception;
- Handle<Object> result = Execution::TryCall(fun,
- isolate()->js_builtins_object(),
- ARRAY_SIZE(argv),
- argv,
- &caught_exception);
+ Handle<Object> result;
+ if (!Execution::TryCall(fun,
+ isolate()->js_builtins_object(),
+ ARRAY_SIZE(argv),
+ argv).ToHandle(&result)) {
+ result = Handle<Object>(isolate()->pending_exception(), isolate());
+ }
return result;
}
@@ -1183,12 +1184,13 @@ Handle<Object> Factory::NewError(const char* constructor,
// Invoke the JavaScript factory method. If an exception is thrown while
// running the factory method, use the exception as the result.
- bool caught_exception;
- Handle<Object> result = Execution::TryCall(fun,
- isolate()->js_builtins_object(),
- ARRAY_SIZE(argv),
- argv,
- &caught_exception);
+ Handle<Object> result;
+ if (!Execution::TryCall(fun,
+ isolate()->js_builtins_object(),
+ ARRAY_SIZE(argv),
+ argv).ToHandle(&result)) {
+ result = Handle<Object>(isolate()->pending_exception(), isolate());
+ }
return result;
}
@@ -1991,20 +1993,17 @@ void Factory::SetRegExpIrregexpData(Handle<JSRegExp> regexp,
-void Factory::ConfigureInstance(Handle<FunctionTemplateInfo> desc,
- Handle<JSObject> instance,
- bool* pending_exception) {
+MaybeHandle<FunctionTemplateInfo> Factory::ConfigureInstance(
+ Handle<FunctionTemplateInfo> desc, Handle<JSObject> instance) {
// Configure the instance by adding the properties specified by the
// instance template.
Handle<Object> instance_template(desc->instance_template(), isolate());
- if (!instance_template->IsUndefined()) {
- Execution::ConfigureInstance(isolate(),
- instance,
- instance_template,
- pending_exception);
- } else {
- *pending_exception = false;
+ if (instance_template->IsUndefined() ||
+ !Execution::ConfigureInstance(
+ isolate(), instance, instance_template).is_null()) {
+ return desc;
}
+ return MaybeHandle<FunctionTemplateInfo>();
}
« src/execution.cc ('K') | « src/factory.h ('k') | src/handles.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698