Index: src/runtime/runtime-object.cc |
diff --git a/src/runtime/runtime-object.cc b/src/runtime/runtime-object.cc |
index aa077c57464d046e7b5f98bb7dad4d3ab3bb01c2..75ddb7bc22b66e7d2efc11ded838b6e9e81d1ac2 100644 |
--- a/src/runtime/runtime-object.cc |
+++ b/src/runtime/runtime-object.cc |
@@ -795,46 +795,15 @@ RUNTIME_FUNCTION(Runtime_AllocateHeapNumber) { |
} |
-static Object* Runtime_NewObjectHelper(Isolate* isolate, |
- Handle<JSFunction> constructor, |
- Handle<JSReceiver> new_target, |
- Handle<AllocationSite> site) { |
- DCHECK(constructor->IsConstructor()); |
- |
- // If called through new, new.target can be: |
- // - a subclass of constructor, |
- // - a proxy wrapper around constructor, or |
- // - the constructor itself. |
- // If called through Reflect.construct, it's guaranteed to be a constructor by |
- // REFLECT_CONSTRUCT_PREPARE. |
- DCHECK(new_target->IsConstructor()); |
- |
- DCHECK(!constructor->has_initial_map() || |
- constructor->initial_map()->instance_type() != JS_FUNCTION_TYPE); |
- |
- Handle<Map> initial_map; |
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
- isolate, initial_map, |
- JSFunction::GetDerivedMap(isolate, constructor, new_target)); |
- |
- Handle<JSObject> result = |
- isolate->factory()->NewJSObjectFromMap(initial_map, NOT_TENURED, site); |
- |
- isolate->counters()->constructed_objects()->Increment(); |
- isolate->counters()->constructed_objects_runtime()->Increment(); |
- |
- return *result; |
-} |
- |
- |
RUNTIME_FUNCTION(Runtime_NewObject) { |
HandleScope scope(isolate); |
- DCHECK(args.length() == 2); |
- CONVERT_ARG_HANDLE_CHECKED(JSFunction, constructor, 0); |
+ DCHECK_EQ(2, args.length()); |
+ CONVERT_ARG_HANDLE_CHECKED(JSFunction, target, 0); |
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, new_target, 1); |
- |
- return Runtime_NewObjectHelper(isolate, constructor, new_target, |
- Handle<AllocationSite>::null()); |
+ Handle<JSObject> result; |
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, |
+ JSObject::New(target, new_target)); |
+ return *result; |
} |