| Index: src/runtime.cc
|
| diff --git a/src/runtime.cc b/src/runtime.cc
|
| index eb5552e3ecb7423dc29553926c76ad233fc04954..a42932ccf0c54aa5f5a9584f82d7ef124da37a45 100644
|
| --- a/src/runtime.cc
|
| +++ b/src/runtime.cc
|
| @@ -8210,12 +8210,9 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_NewObjectFromBound) {
|
| }
|
|
|
|
|
| -RUNTIME_FUNCTION(MaybeObject*, Runtime_NewObject) {
|
| - HandleScope scope(isolate);
|
| - ASSERT(args.length() == 1);
|
| -
|
| - Handle<Object> constructor = args.at<Object>(0);
|
| -
|
| +static MaybeObject* Runtime_NewObjectHelper(Isolate* isolate,
|
| + Handle<Object> constructor,
|
| + Handle<AllocationSite> site) {
|
| // If the constructor isn't a proper function we throw a type error.
|
| if (!constructor->IsJSFunction()) {
|
| Vector< Handle<Object> > arguments = HandleVector(&constructor, 1);
|
| @@ -8273,7 +8270,12 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_NewObject) {
|
| shared->CompleteInobjectSlackTracking();
|
| }
|
|
|
| - Handle<JSObject> result = isolate->factory()->NewJSObject(function);
|
| + Handle<JSObject> result;
|
| + if (site.is_null()) {
|
| + result = isolate->factory()->NewJSObject(function);
|
| + } else {
|
| + result = isolate->factory()->NewJSObjectWithMemento(function, site);
|
| + }
|
| RETURN_IF_EMPTY_HANDLE(isolate, result);
|
|
|
| isolate->counters()->constructed_objects()->Increment();
|
| @@ -8283,6 +8285,34 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_NewObject) {
|
| }
|
|
|
|
|
| +RUNTIME_FUNCTION(MaybeObject*, Runtime_NewObject) {
|
| + HandleScope scope(isolate);
|
| + ASSERT(args.length() == 1);
|
| +
|
| + Handle<Object> constructor = args.at<Object>(0);
|
| + return Runtime_NewObjectHelper(isolate,
|
| + constructor,
|
| + Handle<AllocationSite>::null());
|
| +}
|
| +
|
| +
|
| +RUNTIME_FUNCTION(MaybeObject*, Runtime_NewObjectWithAllocationSite) {
|
| + HandleScope scope(isolate);
|
| + ASSERT(args.length() == 2);
|
| +
|
| + Handle<Object> constructor = args.at<Object>(1);
|
| + // TODO(mvstanton): make this a real site
|
| + Handle<Object> feedback = args.at<Object>(0);
|
| + Handle<AllocationSite> site;
|
| + if (feedback->IsAllocationSite()) {
|
| + site = Handle<AllocationSite>::cast(feedback);
|
| + }
|
| + return Runtime_NewObjectHelper(isolate,
|
| + constructor,
|
| + site);
|
| +}
|
| +
|
| +
|
| RUNTIME_FUNCTION(MaybeObject*, Runtime_FinalizeInstanceSize) {
|
| HandleScope scope(isolate);
|
| ASSERT(args.length() == 1);
|
|
|