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

Unified Diff: src/runtime/runtime-object.cc

Issue 1556333002: [runtime] Migrate several Date builtins to C++. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address comments Created 4 years, 11 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/runtime/runtime-i18n.cc ('k') | test/mjsunit/stack-traces.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « src/runtime/runtime-i18n.cc ('k') | test/mjsunit/stack-traces.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698