aboutsummaryrefslogtreecommitdiff
path: root/deps/v8/src/api-natives.cc
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/api-natives.cc')
-rw-r--r--deps/v8/src/api-natives.cc75
1 files changed, 38 insertions, 37 deletions
diff --git a/deps/v8/src/api-natives.cc b/deps/v8/src/api-natives.cc
index 11b63d56d8..d0088bbf1c 100644
--- a/deps/v8/src/api-natives.cc
+++ b/deps/v8/src/api-natives.cc
@@ -7,9 +7,10 @@
#include "src/api-inl.h"
#include "src/isolate-inl.h"
#include "src/lookup.h"
-#include "src/messages.h"
+#include "src/message-template.h"
#include "src/objects/api-callbacks.h"
#include "src/objects/hash-table-inl.h"
+#include "src/objects/property-cell.h"
#include "src/objects/templates.h"
namespace v8 {
@@ -161,8 +162,7 @@ class AccessCheckDisableScope {
Handle<JSObject> obj_;
};
-
-Object* GetIntrinsic(Isolate* isolate, v8::Intrinsic intrinsic) {
+Object GetIntrinsic(Isolate* isolate, v8::Intrinsic intrinsic) {
Handle<Context> native_context = isolate->native_context();
DCHECK(!native_context.is_null());
switch (intrinsic) {
@@ -172,10 +172,9 @@ Object* GetIntrinsic(Isolate* isolate, v8::Intrinsic intrinsic) {
V8_INTRINSICS_LIST(GET_INTRINSIC_VALUE)
#undef GET_INTRINSIC_VALUE
}
- return nullptr;
+ return Object();
}
-
template <typename TemplateInfoT>
MaybeHandle<JSObject> ConfigureInstance(Isolate* isolate, Handle<JSObject> obj,
Handle<TemplateInfoT> data,
@@ -186,9 +185,9 @@ MaybeHandle<JSObject> ConfigureInstance(Isolate* isolate, Handle<JSObject> obj,
// Walk the inheritance chain and copy all accessors to current object.
int max_number_of_properties = 0;
- TemplateInfoT* info = *data;
- while (info != nullptr) {
- Object* props = info->property_accessors();
+ TemplateInfoT info = *data;
+ while (!info.is_null()) {
+ Object props = info->property_accessors();
if (!props->IsUndefined(isolate)) {
max_number_of_properties += TemplateList::cast(props)->length();
}
@@ -201,10 +200,10 @@ MaybeHandle<JSObject> ConfigureInstance(Isolate* isolate, Handle<JSObject> obj,
Handle<FixedArray> array =
isolate->factory()->NewFixedArray(max_number_of_properties);
- for (Handle<TemplateInfoT> temp(*data, isolate); *temp != nullptr;
+ for (Handle<TemplateInfoT> temp(*data, isolate); !temp->is_null();
temp = handle(temp->GetParent(isolate), isolate)) {
// Accumulate accessors.
- Object* maybe_properties = temp->property_accessors();
+ Object maybe_properties = temp->property_accessors();
if (!maybe_properties->IsUndefined(isolate)) {
valid_descriptors = AccessorInfo::AppendUnique(
isolate, handle(maybe_properties, isolate), array,
@@ -222,7 +221,7 @@ MaybeHandle<JSObject> ConfigureInstance(Isolate* isolate, Handle<JSObject> obj,
}
}
- Object* maybe_property_list = data->property_list();
+ Object maybe_property_list = data->property_list();
if (maybe_property_list->IsUndefined(isolate)) return obj;
Handle<TemplateList> properties(TemplateList::cast(maybe_property_list),
isolate);
@@ -231,7 +230,7 @@ MaybeHandle<JSObject> ConfigureInstance(Isolate* isolate, Handle<JSObject> obj,
int i = 0;
for (int c = 0; c < data->number_of_properties(); c++) {
auto name = handle(Name::cast(properties->get(i++)), isolate);
- Object* bit = properties->get(i++);
+ Object bit = properties->get(i++);
if (bit->IsSmi()) {
PropertyDetails details(Smi::cast(bit));
PropertyAttributes attributes = details.attributes();
@@ -347,12 +346,12 @@ void UncacheTemplateInstantiation(Isolate* isolate, int serial_number,
}
}
-bool IsSimpleInstantiation(Isolate* isolate, ObjectTemplateInfo* info,
- JSReceiver* new_target) {
+bool IsSimpleInstantiation(Isolate* isolate, ObjectTemplateInfo info,
+ JSReceiver new_target) {
DisallowHeapAllocation no_gc;
if (!new_target->IsJSFunction()) return false;
- JSFunction* fun = JSFunction::cast(new_target);
+ JSFunction fun = JSFunction::cast(new_target);
if (fun->shared()->function_data() != info->constructor()) return false;
if (info->immutable_proto()) return false;
return fun->context()->native_context() == isolate->raw_native_context();
@@ -383,7 +382,7 @@ MaybeHandle<JSObject> InstantiateObject(Isolate* isolate,
}
if (constructor.is_null()) {
- Object* maybe_constructor_info = info->constructor();
+ Object maybe_constructor_info = info->constructor();
if (maybe_constructor_info->IsUndefined(isolate)) {
constructor = isolate->object_function();
} else {
@@ -432,7 +431,7 @@ MaybeHandle<JSObject> InstantiateObject(Isolate* isolate,
namespace {
MaybeHandle<Object> GetInstancePrototype(Isolate* isolate,
- Object* function_template) {
+ Object function_template) {
// Enter a new scope. Recursion could otherwise create a lot of handles.
HandleScope scope(isolate);
Handle<JSFunction> parent_instance;
@@ -467,9 +466,9 @@ MaybeHandle<JSFunction> InstantiateFunction(Isolate* isolate,
}
Handle<Object> prototype;
if (!data->remove_prototype()) {
- Object* prototype_templ = data->prototype_template();
+ Object prototype_templ = data->GetPrototypeTemplate();
if (prototype_templ->IsUndefined(isolate)) {
- Object* protoype_provider_templ = data->prototype_provider_template();
+ Object protoype_provider_templ = data->GetPrototypeProviderTemplate();
if (protoype_provider_templ->IsUndefined(isolate)) {
prototype = isolate->factory()->NewJSObject(isolate->object_function());
} else {
@@ -486,7 +485,7 @@ MaybeHandle<JSFunction> InstantiateFunction(Isolate* isolate,
Handle<JSReceiver>(), data->hidden_prototype(), true),
JSFunction);
}
- Object* parent = data->parent_template();
+ Object parent = data->GetParentTemplate();
if (!parent->IsUndefined(isolate)) {
Handle<Object> parent_prototype;
ASSIGN_RETURN_ON_EXCEPTION(isolate, parent_prototype,
@@ -498,8 +497,8 @@ MaybeHandle<JSFunction> InstantiateFunction(Isolate* isolate,
}
InstanceType function_type =
(!data->needs_access_check() &&
- data->named_property_handler()->IsUndefined(isolate) &&
- data->indexed_property_handler()->IsUndefined(isolate))
+ data->GetNamedPropertyHandler()->IsUndefined(isolate) &&
+ data->GetIndexedPropertyHandler()->IsUndefined(isolate))
? JS_API_OBJECT_TYPE
: JS_SPECIAL_API_OBJECT_TYPE;
@@ -526,7 +525,7 @@ MaybeHandle<JSFunction> InstantiateFunction(Isolate* isolate,
void AddPropertyToPropertyList(Isolate* isolate, Handle<TemplateInfo> templ,
int length, Handle<Object>* data) {
- Object* maybe_list = templ->property_list();
+ Object maybe_list = templ->property_list();
Handle<TemplateList> list;
if (maybe_list->IsUndefined(isolate)) {
list = TemplateList::New(isolate, length);
@@ -570,7 +569,8 @@ MaybeHandle<JSObject> ApiNatives::InstantiateRemoteObject(
FunctionTemplateInfo::cast(data->constructor()), isolate);
Handle<Map> object_map = isolate->factory()->NewMap(
JS_SPECIAL_API_OBJECT_TYPE,
- JSObject::kHeaderSize + data->embedder_field_count() * kPointerSize,
+ JSObject::kHeaderSize +
+ data->embedder_field_count() * kEmbedderDataSlotSize,
TERMINAL_FAST_ELEMENTS_KIND);
object_map->SetConstructor(*constructor);
object_map->set_is_access_check_needed(true);
@@ -620,7 +620,7 @@ void ApiNatives::AddAccessorProperty(Isolate* isolate,
void ApiNatives::AddNativeDataProperty(Isolate* isolate,
Handle<TemplateInfo> info,
Handle<AccessorInfo> property) {
- Object* maybe_list = info->property_accessors();
+ Object maybe_list = info->property_accessors();
Handle<TemplateList> list;
if (maybe_list->IsUndefined(isolate)) {
list = TemplateList::New(isolate, 1);
@@ -662,7 +662,7 @@ Handle<JSFunction> ApiNatives::CreateApiFunction(
if (prototype->IsTheHole(isolate)) {
prototype = isolate->factory()->NewFunctionPrototype(result);
- } else if (obj->prototype_provider_template()->IsUndefined(isolate)) {
+ } else if (obj->GetPrototypeProviderTemplate()->IsUndefined(isolate)) {
JSObject::AddProperty(isolate, Handle<JSObject>::cast(prototype),
isolate->factory()->constructor_string(), result,
DONT_ENUM);
@@ -670,17 +670,17 @@ Handle<JSFunction> ApiNatives::CreateApiFunction(
int embedder_field_count = 0;
bool immutable_proto = false;
- if (!obj->instance_template()->IsUndefined(isolate)) {
- Handle<ObjectTemplateInfo> instance_template = Handle<ObjectTemplateInfo>(
- ObjectTemplateInfo::cast(obj->instance_template()), isolate);
- embedder_field_count = instance_template->embedder_field_count();
- immutable_proto = instance_template->immutable_proto();
+ if (!obj->GetInstanceTemplate()->IsUndefined(isolate)) {
+ Handle<ObjectTemplateInfo> GetInstanceTemplate = Handle<ObjectTemplateInfo>(
+ ObjectTemplateInfo::cast(obj->GetInstanceTemplate()), isolate);
+ embedder_field_count = GetInstanceTemplate->embedder_field_count();
+ immutable_proto = GetInstanceTemplate->immutable_proto();
}
// JS_FUNCTION_TYPE requires information about the prototype slot.
DCHECK_NE(JS_FUNCTION_TYPE, type);
- int instance_size =
- JSObject::GetHeaderSize(type) + kPointerSize * embedder_field_count;
+ int instance_size = JSObject::GetHeaderSize(type) +
+ kEmbedderDataSlotSize * embedder_field_count;
Handle<Map> map = isolate->factory()->NewMap(type, instance_size,
TERMINAL_FAST_ELEMENTS_KIND);
@@ -693,7 +693,7 @@ Handle<JSFunction> ApiNatives::CreateApiFunction(
// undetectable and callable. If we ever see the need to have an object
// that is undetectable but not callable, we need to update the types.h
// to allow encoding this.
- CHECK(!obj->instance_call_handler()->IsUndefined(isolate));
+ CHECK(!obj->GetInstanceCallHandler()->IsUndefined(isolate));
map->set_is_undetectable(true);
}
@@ -704,17 +704,18 @@ Handle<JSFunction> ApiNatives::CreateApiFunction(
}
// Set interceptor information in the map.
- if (!obj->named_property_handler()->IsUndefined(isolate)) {
+ if (!obj->GetNamedPropertyHandler()->IsUndefined(isolate)) {
map->set_has_named_interceptor(true);
map->set_may_have_interesting_symbols(true);
}
- if (!obj->indexed_property_handler()->IsUndefined(isolate)) {
+ if (!obj->GetIndexedPropertyHandler()->IsUndefined(isolate)) {
map->set_has_indexed_interceptor(true);
}
// Mark instance as callable in the map.
- if (!obj->instance_call_handler()->IsUndefined(isolate)) {
+ if (!obj->GetInstanceCallHandler()->IsUndefined(isolate)) {
map->set_is_callable(true);
+ map->set_is_constructor(!obj->undetectable());
}
if (immutable_proto) map->set_is_immutable_proto(true);