Index: src/factory.cc |
diff --git a/src/factory.cc b/src/factory.cc |
index 8226a0e5d7f0e92dfe4775a327fee2776b16a55e..cc98357d6d10ce241a89d3def5f3b7012ccf2dce 100644 |
--- a/src/factory.cc |
+++ b/src/factory.cc |
@@ -2236,186 +2236,6 @@ Handle<JSObject> Factory::NewArgumentsObject(Handle<JSFunction> callee, |
} |
-Handle<JSFunction> Factory::CreateApiFunction( |
- Handle<FunctionTemplateInfo> obj, |
- Handle<Object> prototype, |
- ApiInstanceType instance_type) { |
- Handle<Code> code = isolate()->builtins()->HandleApiCall(); |
- Handle<Code> construct_stub = isolate()->builtins()->JSConstructStubApi(); |
- |
- obj->set_instantiated(true); |
- Handle<JSFunction> result; |
- if (obj->remove_prototype()) { |
- result = NewFunctionWithoutPrototype(empty_string(), code); |
- } else { |
- int internal_field_count = 0; |
- if (!obj->instance_template()->IsUndefined()) { |
- Handle<ObjectTemplateInfo> instance_template = |
- Handle<ObjectTemplateInfo>( |
- ObjectTemplateInfo::cast(obj->instance_template())); |
- internal_field_count = |
- Smi::cast(instance_template->internal_field_count())->value(); |
- } |
- |
- // TODO(svenpanne) Kill ApiInstanceType and refactor things by generalizing |
- // JSObject::GetHeaderSize. |
- int instance_size = kPointerSize * internal_field_count; |
- InstanceType type; |
- switch (instance_type) { |
- case JavaScriptObjectType: |
- type = JS_OBJECT_TYPE; |
- instance_size += JSObject::kHeaderSize; |
- break; |
- case GlobalObjectType: |
- type = JS_GLOBAL_OBJECT_TYPE; |
- instance_size += JSGlobalObject::kSize; |
- break; |
- case GlobalProxyType: |
- type = JS_GLOBAL_PROXY_TYPE; |
- instance_size += JSGlobalProxy::kSize; |
- break; |
- default: |
- UNREACHABLE(); |
- type = JS_OBJECT_TYPE; // Keep the compiler happy. |
- break; |
- } |
- |
- result = NewFunction(empty_string(), code, prototype, type, instance_size, |
- obj->read_only_prototype(), true); |
- } |
- |
- result->shared()->set_length(obj->length()); |
- Handle<Object> class_name(obj->class_name(), isolate()); |
- if (class_name->IsString()) { |
- result->shared()->set_instance_class_name(*class_name); |
- result->shared()->set_name(*class_name); |
- } |
- result->shared()->set_function_data(*obj); |
- result->shared()->set_construct_stub(*construct_stub); |
- result->shared()->DontAdaptArguments(); |
- |
- if (obj->remove_prototype()) { |
- DCHECK(result->shared()->IsApiFunction()); |
- DCHECK(!result->has_initial_map()); |
- DCHECK(!result->has_prototype()); |
- return result; |
- } |
- |
-#ifdef DEBUG |
- LookupIterator it(handle(JSObject::cast(result->prototype())), |
- constructor_string(), LookupIterator::OWN_SKIP_INTERCEPTOR); |
- MaybeHandle<Object> maybe_prop = Object::GetProperty(&it); |
- DCHECK(it.IsFound()); |
- DCHECK(maybe_prop.ToHandleChecked().is_identical_to(result)); |
-#endif |
- |
- // Down from here is only valid for API functions that can be used as a |
- // constructor (don't set the "remove prototype" flag). |
- |
- Handle<Map> map(result->initial_map()); |
- |
- // Mark as undetectable if needed. |
- if (obj->undetectable()) { |
- map->set_is_undetectable(); |
- } |
- |
- // Mark as hidden for the __proto__ accessor if needed. |
- if (obj->hidden_prototype()) { |
- map->set_is_hidden_prototype(); |
- } |
- |
- // Mark as needs_access_check if needed. |
- if (obj->needs_access_check()) { |
- map->set_is_access_check_needed(true); |
- } |
- |
- // Set interceptor information in the map. |
- if (!obj->named_property_handler()->IsUndefined()) { |
- map->set_has_named_interceptor(); |
- } |
- if (!obj->indexed_property_handler()->IsUndefined()) { |
- map->set_has_indexed_interceptor(); |
- } |
- |
- // Set instance call-as-function information in the map. |
- if (!obj->instance_call_handler()->IsUndefined()) { |
- map->set_has_instance_call_handler(); |
- } |
- |
- // Recursively copy parent instance templates' accessors, |
- // 'data' may be modified. |
- int max_number_of_additional_properties = 0; |
- int max_number_of_static_properties = 0; |
- FunctionTemplateInfo* info = *obj; |
- while (true) { |
- if (!info->instance_template()->IsUndefined()) { |
- Object* props = |
- ObjectTemplateInfo::cast( |
- info->instance_template())->property_accessors(); |
- if (!props->IsUndefined()) { |
- Handle<Object> props_handle(props, isolate()); |
- NeanderArray props_array(props_handle); |
- max_number_of_additional_properties += props_array.length(); |
- } |
- } |
- if (!info->property_accessors()->IsUndefined()) { |
- Object* props = info->property_accessors(); |
- if (!props->IsUndefined()) { |
- Handle<Object> props_handle(props, isolate()); |
- NeanderArray props_array(props_handle); |
- max_number_of_static_properties += props_array.length(); |
- } |
- } |
- Object* parent = info->parent_template(); |
- if (parent->IsUndefined()) break; |
- info = FunctionTemplateInfo::cast(parent); |
- } |
- |
- Map::EnsureDescriptorSlack(map, max_number_of_additional_properties); |
- |
- // Use a temporary FixedArray to acculumate static accessors |
- int valid_descriptors = 0; |
- Handle<FixedArray> array; |
- if (max_number_of_static_properties > 0) { |
- array = NewFixedArray(max_number_of_static_properties); |
- } |
- |
- while (true) { |
- // Install instance descriptors |
- if (!obj->instance_template()->IsUndefined()) { |
- Handle<ObjectTemplateInfo> instance = |
- Handle<ObjectTemplateInfo>( |
- ObjectTemplateInfo::cast(obj->instance_template()), isolate()); |
- Handle<Object> props = Handle<Object>(instance->property_accessors(), |
- isolate()); |
- if (!props->IsUndefined()) { |
- Map::AppendCallbackDescriptors(map, props); |
- } |
- } |
- // Accumulate static accessors |
- if (!obj->property_accessors()->IsUndefined()) { |
- Handle<Object> props = Handle<Object>(obj->property_accessors(), |
- isolate()); |
- valid_descriptors = |
- AccessorInfo::AppendUnique(props, array, valid_descriptors); |
- } |
- // Climb parent chain |
- Handle<Object> parent = Handle<Object>(obj->parent_template(), isolate()); |
- if (parent->IsUndefined()) break; |
- obj = Handle<FunctionTemplateInfo>::cast(parent); |
- } |
- |
- // Install accumulated static accessors |
- for (int i = 0; i < valid_descriptors; i++) { |
- Handle<AccessorInfo> accessor(AccessorInfo::cast(array->get(i))); |
- JSObject::SetAccessor(result, accessor).Assert(); |
- } |
- |
- DCHECK(result->shared()->IsApiFunction()); |
- return result; |
-} |
- |
- |
Handle<Map> Factory::ObjectLiteralMapFromCache(Handle<Context> context, |
int number_of_properties, |
bool* is_result_from_cache) { |
@@ -2492,21 +2312,6 @@ void Factory::SetRegExpIrregexpData(Handle<JSRegExp> regexp, |
} |
-MaybeHandle<FunctionTemplateInfo> Factory::ConfigureInstance( |
- Handle<FunctionTemplateInfo> desc, Handle<JSObject> instance) { |
- // Configure the instance by adding the properties specified by the |
- // instance template. |
- Handle<Object> instance_template(desc->instance_template(), isolate()); |
- if (!instance_template->IsUndefined()) { |
- RETURN_ON_EXCEPTION( |
- isolate(), |
- Execution::ConfigureInstance(isolate(), instance, instance_template), |
- FunctionTemplateInfo); |
- } |
- return desc; |
-} |
- |
- |
Handle<Object> Factory::GlobalConstantFor(Handle<String> name) { |
if (String::Equals(name, undefined_string())) return undefined_value(); |
if (String::Equals(name, nan_string())) return nan_value(); |