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, ...@@ -439,15 +439,14 @@ MaybeHandle<JSObject> InstantiateObject(Isolate* isolate,
namespace { namespace {
MaybeHandle<Object> GetInstancePrototype(Isolate* isolate, MaybeHandle<Object> GetInstancePrototype(Isolate* isolate,
Object function_template) { Handle<Object> function_template) {
// Enter a new scope. Recursion could otherwise create a lot of handles. // Enter a new scope. Recursion could otherwise create a lot of handles.
HandleScope scope(isolate); HandleScope scope(isolate);
Handle<JSFunction> parent_instance; Handle<JSFunction> parent_instance;
ASSIGN_RETURN_ON_EXCEPTION( ASSIGN_RETURN_ON_EXCEPTION(
isolate, parent_instance, isolate, parent_instance,
InstantiateFunction( InstantiateFunction(
isolate, isolate, Handle<FunctionTemplateInfo>::cast(function_template)),
handle(FunctionTemplateInfo::cast(function_template), isolate)),
JSFunction); JSFunction);
Handle<Object> instance_prototype; Handle<Object> instance_prototype;
// TODO(cbruni): decide what to do here. // TODO(cbruni): decide what to do here.
...@@ -474,10 +473,11 @@ MaybeHandle<JSFunction> InstantiateFunction( ...@@ -474,10 +473,11 @@ MaybeHandle<JSFunction> InstantiateFunction(
} }
Handle<Object> prototype; Handle<Object> prototype;
if (!data->remove_prototype()) { if (!data->remove_prototype()) {
Object prototype_templ = data->GetPrototypeTemplate(); Handle<Object> prototype_templ(data->GetPrototypeTemplate(), isolate);
if (prototype_templ.IsUndefined(isolate)) { if (prototype_templ->IsUndefined(isolate)) {
Object protoype_provider_templ = data->GetPrototypeProviderTemplate(); Handle<Object> protoype_provider_templ(
if (protoype_provider_templ.IsUndefined(isolate)) { data->GetPrototypeProviderTemplate(), isolate);
if (protoype_provider_templ->IsUndefined(isolate)) {
prototype = isolate->factory()->NewJSObject(isolate->object_function()); prototype = isolate->factory()->NewJSObject(isolate->object_function());
} else { } else {
ASSIGN_RETURN_ON_EXCEPTION( ASSIGN_RETURN_ON_EXCEPTION(
...@@ -487,14 +487,13 @@ MaybeHandle<JSFunction> InstantiateFunction( ...@@ -487,14 +487,13 @@ MaybeHandle<JSFunction> InstantiateFunction(
} else { } else {
ASSIGN_RETURN_ON_EXCEPTION( ASSIGN_RETURN_ON_EXCEPTION(
isolate, prototype, isolate, prototype,
InstantiateObject( InstantiateObject(isolate,
isolate, Handle<ObjectTemplateInfo>::cast(prototype_templ),
handle(ObjectTemplateInfo::cast(prototype_templ), isolate), Handle<JSReceiver>(), true),
Handle<JSReceiver>(), true),
JSFunction); JSFunction);
} }
Object parent = data->GetParentTemplate(); Handle<Object> parent(data->GetParentTemplate(), isolate);
if (!parent.IsUndefined(isolate)) { if (!parent->IsUndefined(isolate)) {
Handle<Object> parent_prototype; Handle<Object> parent_prototype;
ASSIGN_RETURN_ON_EXCEPTION(isolate, parent_prototype, ASSIGN_RETURN_ON_EXCEPTION(isolate, parent_prototype,
GetInstancePrototype(isolate, parent), 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