Commit a0d52d38 authored by Maya Lekova's avatar Maya Lekova Committed by Commit Bot

[cleanup] Handlify api-natives.cc

Bug: v8:9810
Change-Id: I239a624541a4132092c8be9e20da6d49dd5506ed
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1918252
Commit-Queue: Maya Lekova <mslekova@chromium.org>
Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65008}
parent 6b638e0d
......@@ -439,15 +439,14 @@ MaybeHandle<JSObject> InstantiateObject(Isolate* isolate,
namespace {
MaybeHandle<Object> GetInstancePrototype(Isolate* isolate,
Object function_template) {
Handle<Object> function_template) {
// Enter a new scope. Recursion could otherwise create a lot of handles.
HandleScope scope(isolate);
Handle<JSFunction> parent_instance;
ASSIGN_RETURN_ON_EXCEPTION(
isolate, parent_instance,
InstantiateFunction(
isolate,
handle(FunctionTemplateInfo::cast(function_template), isolate)),
isolate, Handle<FunctionTemplateInfo>::cast(function_template)),
JSFunction);
Handle<Object> instance_prototype;
// TODO(cbruni): decide what to do here.
......@@ -474,10 +473,11 @@ MaybeHandle<JSFunction> InstantiateFunction(
}
Handle<Object> prototype;
if (!data->remove_prototype()) {
Object prototype_templ = data->GetPrototypeTemplate();
if (prototype_templ.IsUndefined(isolate)) {
Object protoype_provider_templ = data->GetPrototypeProviderTemplate();
if (protoype_provider_templ.IsUndefined(isolate)) {
Handle<Object> prototype_templ(data->GetPrototypeTemplate(), isolate);
if (prototype_templ->IsUndefined(isolate)) {
Handle<Object> protoype_provider_templ(
data->GetPrototypeProviderTemplate(), isolate);
if (protoype_provider_templ->IsUndefined(isolate)) {
prototype = isolate->factory()->NewJSObject(isolate->object_function());
} else {
ASSIGN_RETURN_ON_EXCEPTION(
......@@ -487,14 +487,13 @@ MaybeHandle<JSFunction> InstantiateFunction(
} else {
ASSIGN_RETURN_ON_EXCEPTION(
isolate, prototype,
InstantiateObject(
isolate,
handle(ObjectTemplateInfo::cast(prototype_templ), isolate),
Handle<JSReceiver>(), true),
InstantiateObject(isolate,
Handle<ObjectTemplateInfo>::cast(prototype_templ),
Handle<JSReceiver>(), true),
JSFunction);
}
Object parent = data->GetParentTemplate();
if (!parent.IsUndefined(isolate)) {
Handle<Object> parent(data->GetParentTemplate(), isolate);
if (!parent->IsUndefined(isolate)) {
Handle<Object> parent_prototype;
ASSIGN_RETURN_ON_EXCEPTION(isolate, parent_prototype,
GetInstancePrototype(isolate, parent),
......
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