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

Unified Diff: src/builtins.cc

Issue 1551473002: [builtins] Fix context for ConstructStub calls into C++. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE Created 5 years 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/bootstrapper.cc ('k') | src/ia32/builtins-ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/builtins.cc
diff --git a/src/builtins.cc b/src/builtins.cc
index 8da5e92ddec8071302fa14f2ce6a490655cd031b..d28516e1413a36b920d6e44595e82f7ec4a5d6da 100644
--- a/src/builtins.cc
+++ b/src/builtins.cc
@@ -1539,8 +1539,7 @@ MaybeHandle<JSFunction> CompileString(Handle<Context> context,
// ES6 section 18.2.1 eval (x)
BUILTIN(GlobalEval) {
HandleScope scope(isolate);
- DCHECK_LE(1, args.length());
- Handle<Object> x = args.at<Object>(1);
+ Handle<Object> x = args.atOrUndefined(isolate, 1);
Handle<JSFunction> target = args.target();
Handle<JSObject> target_global_proxy(target->global_proxy(), isolate);
if (!x->IsString()) return *x;
@@ -2041,7 +2040,6 @@ BUILTIN(FunctionPrototypeBind) {
BUILTIN(FunctionPrototypeToString) {
HandleScope scope(isolate);
Handle<Object> receiver = args.receiver();
-
if (receiver->IsJSBoundFunction()) {
return *JSBoundFunction::ToString(Handle<JSBoundFunction>::cast(receiver));
} else if (receiver->IsJSFunction()) {
@@ -2067,9 +2065,8 @@ BUILTIN(GeneratorFunctionConstructor) {
// ES6 section 19.4.1.1 Symbol ( [ description ] ) for the [[Call]] case.
BUILTIN(SymbolConstructor) {
HandleScope scope(isolate);
- DCHECK_EQ(2, args.length());
Handle<Symbol> result = isolate->factory()->NewSymbol();
- Handle<Object> description = args.at<Object>(1);
+ Handle<Object> description = args.atOrUndefined(isolate, 1);
if (!description->IsUndefined()) {
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, description,
Object::ToString(isolate, description));
@@ -2082,9 +2079,6 @@ BUILTIN(SymbolConstructor) {
// ES6 section 19.4.1.1 Symbol ( [ description ] ) for the [[Construct]] case.
BUILTIN(SymbolConstructor_ConstructStub) {
HandleScope scope(isolate);
- // The ConstructStub is executed in the context of the caller, so we need
- // to enter the callee context first before raising an exception.
- isolate->set_context(args.target()->context());
THROW_NEW_ERROR_RETURN_FAILURE(
isolate, NewTypeError(MessageTemplate::kNotConstructor,
isolate->factory()->Symbol_string()));
@@ -2102,11 +2096,6 @@ BUILTIN(ObjectProtoToString) {
}
-namespace {
-
-} // namespace
-
-
// ES6 section 26.2.1.1 Proxy ( target, handler ) for the [[Call]] case.
BUILTIN(ProxyConstructor) {
HandleScope scope(isolate);
@@ -2123,9 +2112,6 @@ BUILTIN(ProxyConstructor_ConstructStub) {
DCHECK(isolate->proxy_function()->IsConstructor());
Handle<Object> target = args.atOrUndefined(isolate, 1);
Handle<Object> handler = args.atOrUndefined(isolate, 2);
- // The ConstructStub is executed in the context of the caller, so we need
- // to enter the callee context first before raising an exception.
- isolate->set_context(args.target()->context());
Handle<JSProxy> result;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
JSProxy::New(isolate, target, handler));
« no previous file with comments | « src/bootstrapper.cc ('k') | src/ia32/builtins-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698