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

Unified Diff: src/builtins/builtins-error.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/builtins/builtins.h ('k') | src/contexts.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/builtins/builtins-error.cc
diff --git a/src/builtins/builtins-error.cc b/src/builtins/builtins-error.cc
index 43637060110df21c8ff878fcd197ec5c32212203..d1be5033d82d96831c3b7d6ff3e9ed1e8b7f7472 100644
--- a/src/builtins/builtins-error.cc
+++ b/src/builtins/builtins-error.cc
@@ -15,11 +15,23 @@ namespace internal {
// ES6 section 19.5.1.1 Error ( message )
BUILTIN(ErrorConstructor) {
HandleScope scope(isolate);
+
+ FrameSkipMode mode = SKIP_FIRST;
+ Handle<Object> caller;
+
+ // When we're passed a JSFunction as new target, we can skip frames until that
+ // specific function is seen instead of unconditionally skipping the first
+ // frame.
+ if (args.new_target()->IsJSFunction()) {
+ mode = SKIP_UNTIL_SEEN;
+ caller = args.new_target();
+ }
+
RETURN_RESULT_OR_FAILURE(
- isolate,
- ErrorUtils::Construct(isolate, args.target<JSFunction>(),
- Handle<Object>::cast(args.new_target()),
- args.atOrUndefined(isolate, 1), SKIP_FIRST, false));
+ isolate, ErrorUtils::Construct(isolate, args.target<JSFunction>(),
+ Handle<Object>::cast(args.new_target()),
+ args.atOrUndefined(isolate, 1), mode,
+ caller, false));
}
// static
@@ -69,5 +81,24 @@ BUILTIN(ErrorPrototypeToString) {
ErrorUtils::ToString(isolate, args.receiver()));
}
+BUILTIN(MakeGenericError) {
+ HandleScope scope(isolate);
+
+ Handle<Object> constructor = args.atOrUndefined(isolate, 1);
+ Handle<Object> template_index = args.atOrUndefined(isolate, 2);
+ Handle<Object> arg0 = args.atOrUndefined(isolate, 3);
+ Handle<Object> arg1 = args.atOrUndefined(isolate, 4);
+ Handle<Object> arg2 = args.atOrUndefined(isolate, 5);
+
+ DCHECK(constructor->IsJSFunction());
+ DCHECK(template_index->IsSmi());
+
+ RETURN_RESULT_OR_FAILURE(
+ isolate,
+ ErrorUtils::MakeGenericError(
+ isolate, Handle<JSFunction>::cast(constructor),
+ Smi::cast(*template_index)->value(), arg0, arg1, arg2, SKIP_FIRST));
+}
+
} // namespace internal
} // namespace v8
« no previous file with comments | « src/builtins/builtins.h ('k') | src/contexts.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698