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

Unified Diff: src/factory.cc

Issue 2206573002: Move NoSideEffectToString to C++ (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address comments Created 4 years, 4 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
« no previous file with comments | « src/contexts.h ('k') | src/heap-symbols.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 2cd1ee73f9ab3764790ecdba1800cd52a75bd265..acfa5255c49e828c87d5f32359b2569b591682aa 100644
--- a/src/factory.cc
+++ b/src/factory.cc
@@ -1154,27 +1154,21 @@ Handle<Object> Factory::NewError(Handle<JSFunction> constructor,
MessageTemplate::TemplateString(template_index)));
}
- Handle<JSFunction> fun = isolate()->make_error_function();
- Handle<Object> message_type(Smi::FromInt(template_index), isolate());
if (arg0.is_null()) arg0 = undefined_value();
if (arg1.is_null()) arg1 = undefined_value();
if (arg2.is_null()) arg2 = undefined_value();
- Handle<Object> argv[] = {constructor, message_type, arg0, arg1, arg2};
- // Invoke the JavaScript factory method. If an exception is thrown while
- // running the factory method, use the exception as the result.
Handle<Object> result;
- MaybeHandle<Object> exception;
- if (!Execution::TryCall(isolate(), fun, undefined_value(), arraysize(argv),
- argv, &exception)
+ if (!ErrorUtils::MakeGenericError(isolate(), constructor, template_index,
+ arg0, arg1, arg2, SKIP_NONE)
.ToHandle(&result)) {
- Handle<Object> exception_obj;
- if (exception.ToHandle(&exception_obj)) {
- result = exception_obj;
- } else {
- result = undefined_value();
- }
+ // If an exception is thrown while
+ // running the factory method, use the exception as the result.
+ DCHECK(isolate()->has_pending_exception());
+ result = handle(isolate()->pending_exception(), isolate());
+ isolate()->clear_pending_exception();
}
+
return scope.CloseAndEscape(result);
}
« no previous file with comments | « src/contexts.h ('k') | src/heap-symbols.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698