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

Side by Side Diff: src/runtime/runtime-object.cc

Issue 1467473002: Install ConstructNonConstructable as construct stub for non-constructables. (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 unified diff | Download patch
« no previous file with comments | « src/runtime/runtime-internal.cc ('k') | src/x64/builtins-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/runtime/runtime-utils.h" 5 #include "src/runtime/runtime-utils.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/bootstrapper.h" 8 #include "src/bootstrapper.h"
9 #include "src/debug/debug.h" 9 #include "src/debug/debug.h"
10 #include "src/isolate-inl.h" 10 #include "src/isolate-inl.h"
(...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after
1037 return *result; 1037 return *result;
1038 } 1038 }
1039 1039
1040 1040
1041 RUNTIME_FUNCTION(Runtime_NewObject) { 1041 RUNTIME_FUNCTION(Runtime_NewObject) {
1042 HandleScope scope(isolate); 1042 HandleScope scope(isolate);
1043 DCHECK(args.length() == 2); 1043 DCHECK(args.length() == 2);
1044 CONVERT_ARG_HANDLE_CHECKED(JSFunction, constructor, 0); 1044 CONVERT_ARG_HANDLE_CHECKED(JSFunction, constructor, 0);
1045 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, new_target, 1); 1045 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, new_target, 1);
1046 1046
1047 // TODO(verwaest): Make sure |constructor| is guaranteed to be a constructor. 1047 DCHECK(constructor->IsConstructor());
1048 if (!constructor->IsConstructor()) {
1049 THROW_NEW_ERROR_RETURN_FAILURE(
1050 isolate, NewTypeError(MessageTemplate::kNotConstructor, constructor));
1051 }
1052 1048
1053 // If called through new, new.target can be: 1049 // If called through new, new.target can be:
1054 // - a subclass of constructor, 1050 // - a subclass of constructor,
1055 // - a proxy wrapper around constructor, or 1051 // - a proxy wrapper around constructor, or
1056 // - the constructor itself. 1052 // - the constructor itself.
1057 // If called through Reflect.construct, it's guaranteed to be a constructor by 1053 // If called through Reflect.construct, it's guaranteed to be a constructor by
1058 // REFLECT_CONSTRUCT_PREPARE. 1054 // REFLECT_CONSTRUCT_PREPARE.
1059 DCHECK(new_target->IsConstructor()); 1055 DCHECK(new_target->IsConstructor());
1060 1056
1061 return Runtime_NewObjectHelper(isolate, constructor, new_target, 1057 return Runtime_NewObjectHelper(isolate, constructor, new_target,
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
1587 1583
1588 RUNTIME_FUNCTION(Runtime_ObjectDefineProperties) { 1584 RUNTIME_FUNCTION(Runtime_ObjectDefineProperties) {
1589 HandleScope scope(isolate); 1585 HandleScope scope(isolate);
1590 DCHECK(args.length() == 2); 1586 DCHECK(args.length() == 2);
1591 CONVERT_ARG_HANDLE_CHECKED(Object, o, 0); 1587 CONVERT_ARG_HANDLE_CHECKED(Object, o, 0);
1592 CONVERT_ARG_HANDLE_CHECKED(Object, properties, 1); 1588 CONVERT_ARG_HANDLE_CHECKED(Object, properties, 1);
1593 return JSReceiver::DefineProperties(isolate, o, properties); 1589 return JSReceiver::DefineProperties(isolate, o, properties);
1594 } 1590 }
1595 } // namespace internal 1591 } // namespace internal
1596 } // namespace v8 1592 } // namespace v8
OLDNEW
« no previous file with comments | « src/runtime/runtime-internal.cc ('k') | src/x64/builtins-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698