Commit e61a957b authored by dtalley's avatar dtalley Committed by Commit bot

Added constructor call on object in InstantiateObject method

I found after upgrading from 4.2.2 where apinatives.js still
existed to 4.4.56 where everything had been converted to C++ in
api-natives.cc, my constructors for ObjectTemplate instantiated objects
were no longer being called.  After investigation, I noticed in
apinatives.js that a new call would handle that, but there was no
corresponding constructor call in api-natives.cc (or anywhere else
along the chain of InstantiateObject), so I added a call to
Execution::Call to actually construct the object.  Forgive me if that
isn't the right place to add it (InitializeBody in objects-inl.h also
looked like a good place), or if there's a reason constructors are
not being called.

I also added myself to the AUTHORS file in this CL.

Review URL: https://codereview.chromium.org/1137693003

Cr-Commit-Position: refs/heads/master@{#29076}
parent bb1b54a7
...@@ -98,3 +98,4 @@ Vladimir Shutoff <vovan@shutoff.ru> ...@@ -98,3 +98,4 @@ Vladimir Shutoff <vovan@shutoff.ru>
Yu Yin <xwafish@gmail.com> Yu Yin <xwafish@gmail.com>
Zhongping Wang <kewpie.w.zp@gmail.com> Zhongping Wang <kewpie.w.zp@gmail.com>
柳荣一 <admin@web-tinker.com> 柳荣一 <admin@web-tinker.com>
David Talley <dtalley@gmail.com>
\ No newline at end of file
...@@ -195,6 +195,10 @@ MaybeHandle<JSObject> InstantiateObject(Isolate* isolate, ...@@ -195,6 +195,10 @@ MaybeHandle<JSObject> InstantiateObject(Isolate* isolate,
auto object = isolate->factory()->NewJSObject(cons); auto object = isolate->factory()->NewJSObject(cons);
ASSIGN_RETURN_ON_EXCEPTION( ASSIGN_RETURN_ON_EXCEPTION(
isolate, result, ConfigureInstance(isolate, object, info), JSFunction); isolate, result, ConfigureInstance(isolate, object, info), JSFunction);
if (!constructor->IsUndefined()) {
RETURN_ON_EXCEPTION(
isolate, Execution::Call(isolate, cons, result, 0, nullptr), JSObject);
}
// TODO(dcarney): is this necessary? // TODO(dcarney): is this necessary?
JSObject::MigrateSlowToFast(result, 0, "ApiNatives::InstantiateObject"); JSObject::MigrateSlowToFast(result, 0, "ApiNatives::InstantiateObject");
return scope.CloseAndEscape(result); return scope.CloseAndEscape(result);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment