Commit 47037bdc authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

[heap] Allow allocating Struct and Tuple* in new space

Aligns behavior with other allocate calls in factory that allow
choosing the generation depending on the use case.

Bug: v8:6771
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng
Change-Id: I63b95de7e664a51af8ca24a75f2122dfe1792c42
Reviewed-on: https://chromium-review.googlesource.com/642799Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47707}
parent 36ef81b6
...@@ -1345,7 +1345,7 @@ static Local<FunctionTemplate> FunctionTemplateNew( ...@@ -1345,7 +1345,7 @@ static Local<FunctionTemplate> FunctionTemplateNew(
v8::Local<Signature> signature, int length, bool do_not_cache, v8::Local<Signature> signature, int length, bool do_not_cache,
v8::Local<Private> cached_property_name = v8::Local<Private>()) { v8::Local<Private> cached_property_name = v8::Local<Private>()) {
i::Handle<i::Struct> struct_obj = i::Handle<i::Struct> struct_obj =
isolate->factory()->NewStruct(i::FUNCTION_TEMPLATE_INFO_TYPE); isolate->factory()->NewStruct(i::FUNCTION_TEMPLATE_INFO_TYPE, i::TENURED);
i::Handle<i::FunctionTemplateInfo> obj = i::Handle<i::FunctionTemplateInfo> obj =
i::Handle<i::FunctionTemplateInfo>::cast(struct_obj); i::Handle<i::FunctionTemplateInfo>::cast(struct_obj);
InitializeFunctionTemplate(obj); InitializeFunctionTemplate(obj);
...@@ -1439,7 +1439,7 @@ void FunctionTemplate::SetCallHandler(FunctionCallback callback, ...@@ -1439,7 +1439,7 @@ void FunctionTemplate::SetCallHandler(FunctionCallback callback,
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate); ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate);
i::HandleScope scope(isolate); i::HandleScope scope(isolate);
i::Handle<i::Struct> struct_obj = i::Handle<i::Struct> struct_obj =
isolate->factory()->NewStruct(i::TUPLE2_TYPE); isolate->factory()->NewStruct(i::TUPLE2_TYPE, i::TENURED);
i::Handle<i::CallHandlerInfo> obj = i::Handle<i::CallHandlerInfo> obj =
i::Handle<i::CallHandlerInfo>::cast(struct_obj); i::Handle<i::CallHandlerInfo>::cast(struct_obj);
SET_FIELD_WRAPPED(obj, set_callback, callback); SET_FIELD_WRAPPED(obj, set_callback, callback);
...@@ -1588,7 +1588,7 @@ static Local<ObjectTemplate> ObjectTemplateNew( ...@@ -1588,7 +1588,7 @@ static Local<ObjectTemplate> ObjectTemplateNew(
LOG_API(isolate, ObjectTemplate, New); LOG_API(isolate, ObjectTemplate, New);
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate); ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate);
i::Handle<i::Struct> struct_obj = i::Handle<i::Struct> struct_obj =
isolate->factory()->NewStruct(i::OBJECT_TEMPLATE_INFO_TYPE); isolate->factory()->NewStruct(i::OBJECT_TEMPLATE_INFO_TYPE, i::TENURED);
i::Handle<i::ObjectTemplateInfo> obj = i::Handle<i::ObjectTemplateInfo> obj =
i::Handle<i::ObjectTemplateInfo>::cast(struct_obj); i::Handle<i::ObjectTemplateInfo>::cast(struct_obj);
InitializeTemplate(obj, Consts::OBJECT_TEMPLATE); InitializeTemplate(obj, Consts::OBJECT_TEMPLATE);
...@@ -1739,7 +1739,7 @@ static i::Handle<i::InterceptorInfo> CreateInterceptorInfo( ...@@ -1739,7 +1739,7 @@ static i::Handle<i::InterceptorInfo> CreateInterceptorInfo(
definer == definer ==
nullptr); // Only use descriptor callback with definer callback. nullptr); // Only use descriptor callback with definer callback.
auto obj = i::Handle<i::InterceptorInfo>::cast( auto obj = i::Handle<i::InterceptorInfo>::cast(
isolate->factory()->NewStruct(i::INTERCEPTOR_INFO_TYPE)); isolate->factory()->NewStruct(i::INTERCEPTOR_INFO_TYPE, i::TENURED));
obj->set_flags(0); obj->set_flags(0);
if (getter != 0) SET_FIELD_WRAPPED(obj, set_getter, getter); if (getter != 0) SET_FIELD_WRAPPED(obj, set_getter, getter);
...@@ -1817,7 +1817,7 @@ void ObjectTemplate::SetAccessCheckCallback(AccessCheckCallback callback, ...@@ -1817,7 +1817,7 @@ void ObjectTemplate::SetAccessCheckCallback(AccessCheckCallback callback,
EnsureNotInstantiated(cons, "v8::ObjectTemplate::SetAccessCheckCallback"); EnsureNotInstantiated(cons, "v8::ObjectTemplate::SetAccessCheckCallback");
i::Handle<i::Struct> struct_info = i::Handle<i::Struct> struct_info =
isolate->factory()->NewStruct(i::ACCESS_CHECK_INFO_TYPE); isolate->factory()->NewStruct(i::ACCESS_CHECK_INFO_TYPE, i::TENURED);
i::Handle<i::AccessCheckInfo> info = i::Handle<i::AccessCheckInfo> info =
i::Handle<i::AccessCheckInfo>::cast(struct_info); i::Handle<i::AccessCheckInfo>::cast(struct_info);
...@@ -1847,7 +1847,7 @@ void ObjectTemplate::SetAccessCheckCallbackAndHandler( ...@@ -1847,7 +1847,7 @@ void ObjectTemplate::SetAccessCheckCallbackAndHandler(
cons, "v8::ObjectTemplate::SetAccessCheckCallbackWithHandler"); cons, "v8::ObjectTemplate::SetAccessCheckCallbackWithHandler");
i::Handle<i::Struct> struct_info = i::Handle<i::Struct> struct_info =
isolate->factory()->NewStruct(i::ACCESS_CHECK_INFO_TYPE); isolate->factory()->NewStruct(i::ACCESS_CHECK_INFO_TYPE, i::TENURED);
i::Handle<i::AccessCheckInfo> info = i::Handle<i::AccessCheckInfo> info =
i::Handle<i::AccessCheckInfo>::cast(struct_info); i::Handle<i::AccessCheckInfo>::cast(struct_info);
...@@ -1896,7 +1896,7 @@ void ObjectTemplate::SetCallAsFunctionHandler(FunctionCallback callback, ...@@ -1896,7 +1896,7 @@ void ObjectTemplate::SetCallAsFunctionHandler(FunctionCallback callback,
auto cons = EnsureConstructor(isolate, this); auto cons = EnsureConstructor(isolate, this);
EnsureNotInstantiated(cons, "v8::ObjectTemplate::SetCallAsFunctionHandler"); EnsureNotInstantiated(cons, "v8::ObjectTemplate::SetCallAsFunctionHandler");
i::Handle<i::Struct> struct_obj = i::Handle<i::Struct> struct_obj =
isolate->factory()->NewStruct(i::TUPLE2_TYPE); isolate->factory()->NewStruct(i::TUPLE2_TYPE, i::TENURED);
i::Handle<i::CallHandlerInfo> obj = i::Handle<i::CallHandlerInfo> obj =
i::Handle<i::CallHandlerInfo>::cast(struct_obj); i::Handle<i::CallHandlerInfo>::cast(struct_obj);
SET_FIELD_WRAPPED(obj, set_callback, callback); SET_FIELD_WRAPPED(obj, set_callback, callback);
...@@ -8829,7 +8829,7 @@ void Isolate::EnqueueMicrotask(MicrotaskCallback microtask, void* data) { ...@@ -8829,7 +8829,7 @@ void Isolate::EnqueueMicrotask(MicrotaskCallback microtask, void* data) {
i::HandleScope scope(isolate); i::HandleScope scope(isolate);
i::Handle<i::CallHandlerInfo> callback_info = i::Handle<i::CallHandlerInfo> callback_info =
i::Handle<i::CallHandlerInfo>::cast( i::Handle<i::CallHandlerInfo>::cast(
isolate->factory()->NewStruct(i::TUPLE2_TYPE)); isolate->factory()->NewStruct(i::TUPLE2_TYPE, i::NOT_TENURED));
SET_FIELD_WRAPPED(callback_info, set_callback, microtask); SET_FIELD_WRAPPED(callback_info, set_callback, microtask);
SET_FIELD_WRAPPED(callback_info, set_data, data); SET_FIELD_WRAPPED(callback_info, set_data, data);
isolate->EnqueueMicrotask(callback_info); isolate->EnqueueMicrotask(callback_info);
......
...@@ -94,7 +94,7 @@ Handle<HeapObject> Factory::NewFillerObject(int size, ...@@ -94,7 +94,7 @@ Handle<HeapObject> Factory::NewFillerObject(int size,
Handle<PrototypeInfo> Factory::NewPrototypeInfo() { Handle<PrototypeInfo> Factory::NewPrototypeInfo() {
Handle<PrototypeInfo> result = Handle<PrototypeInfo> result =
Handle<PrototypeInfo>::cast(NewStruct(PROTOTYPE_INFO_TYPE)); Handle<PrototypeInfo>::cast(NewStruct(PROTOTYPE_INFO_TYPE, TENURED));
result->set_prototype_users(WeakFixedArray::Empty()); result->set_prototype_users(WeakFixedArray::Empty());
result->set_registry_slot(PrototypeInfo::UNREGISTERED); result->set_registry_slot(PrototypeInfo::UNREGISTERED);
result->set_validity_cell(Smi::kZero); result->set_validity_cell(Smi::kZero);
...@@ -104,20 +104,23 @@ Handle<PrototypeInfo> Factory::NewPrototypeInfo() { ...@@ -104,20 +104,23 @@ Handle<PrototypeInfo> Factory::NewPrototypeInfo() {
Handle<EnumCache> Factory::NewEnumCache(Handle<FixedArray> keys, Handle<EnumCache> Factory::NewEnumCache(Handle<FixedArray> keys,
Handle<FixedArray> indices) { Handle<FixedArray> indices) {
return Handle<EnumCache>::cast(NewTuple2(keys, indices)); return Handle<EnumCache>::cast(NewTuple2(keys, indices, TENURED));
} }
Handle<Tuple2> Factory::NewTuple2(Handle<Object> value1, Handle<Tuple2> Factory::NewTuple2(Handle<Object> value1, Handle<Object> value2,
Handle<Object> value2) { PretenureFlag pretenure) {
Handle<Tuple2> result = Handle<Tuple2>::cast(NewStruct(TUPLE2_TYPE)); Handle<Tuple2> result =
Handle<Tuple2>::cast(NewStruct(TUPLE2_TYPE, pretenure));
result->set_value1(*value1); result->set_value1(*value1);
result->set_value2(*value2); result->set_value2(*value2);
return result; return result;
} }
Handle<Tuple3> Factory::NewTuple3(Handle<Object> value1, Handle<Object> value2, Handle<Tuple3> Factory::NewTuple3(Handle<Object> value1, Handle<Object> value2,
Handle<Object> value3) { Handle<Object> value3,
Handle<Tuple3> result = Handle<Tuple3>::cast(NewStruct(TUPLE3_TYPE)); PretenureFlag pretenure) {
Handle<Tuple3> result =
Handle<Tuple3>::cast(NewStruct(TUPLE3_TYPE, pretenure));
result->set_value1(*value1); result->set_value1(*value1);
result->set_value2(*value2); result->set_value2(*value2);
result->set_value3(*value3); result->set_value3(*value3);
...@@ -126,8 +129,8 @@ Handle<Tuple3> Factory::NewTuple3(Handle<Object> value1, Handle<Object> value2, ...@@ -126,8 +129,8 @@ Handle<Tuple3> Factory::NewTuple3(Handle<Object> value1, Handle<Object> value2,
Handle<ContextExtension> Factory::NewContextExtension( Handle<ContextExtension> Factory::NewContextExtension(
Handle<ScopeInfo> scope_info, Handle<Object> extension) { Handle<ScopeInfo> scope_info, Handle<Object> extension) {
Handle<ContextExtension> result = Handle<ContextExtension> result = Handle<ContextExtension>::cast(
Handle<ContextExtension>::cast(NewStruct(CONTEXT_EXTENSION_TYPE)); NewStruct(CONTEXT_EXTENSION_TYPE, TENURED));
result->set_scope_info(*scope_info); result->set_scope_info(*scope_info);
result->set_extension(*extension); result->set_extension(*extension);
return result; return result;
...@@ -136,7 +139,7 @@ Handle<ContextExtension> Factory::NewContextExtension( ...@@ -136,7 +139,7 @@ Handle<ContextExtension> Factory::NewContextExtension(
Handle<ConstantElementsPair> Factory::NewConstantElementsPair( Handle<ConstantElementsPair> Factory::NewConstantElementsPair(
ElementsKind elements_kind, Handle<FixedArrayBase> constant_values) { ElementsKind elements_kind, Handle<FixedArrayBase> constant_values) {
Handle<ConstantElementsPair> result = Handle<ConstantElementsPair> result =
Handle<ConstantElementsPair>::cast(NewStruct(TUPLE2_TYPE)); Handle<ConstantElementsPair>::cast(NewStruct(TUPLE2_TYPE, TENURED));
result->set_elements_kind(elements_kind); result->set_elements_kind(elements_kind);
result->set_constant_values(*constant_values); result->set_constant_values(*constant_values);
return result; return result;
...@@ -293,7 +296,7 @@ Handle<OrderedHashMap> Factory::NewOrderedHashMap() { ...@@ -293,7 +296,7 @@ Handle<OrderedHashMap> Factory::NewOrderedHashMap() {
Handle<AccessorPair> Factory::NewAccessorPair() { Handle<AccessorPair> Factory::NewAccessorPair() {
Handle<AccessorPair> accessors = Handle<AccessorPair> accessors =
Handle<AccessorPair>::cast(NewStruct(ACCESSOR_PAIR_TYPE)); Handle<AccessorPair>::cast(NewStruct(ACCESSOR_PAIR_TYPE, TENURED));
accessors->set_getter(*null_value(), SKIP_WRITE_BARRIER); accessors->set_getter(*null_value(), SKIP_WRITE_BARRIER);
accessors->set_setter(*null_value(), SKIP_WRITE_BARRIER); accessors->set_setter(*null_value(), SKIP_WRITE_BARRIER);
return accessors; return accessors;
...@@ -302,7 +305,7 @@ Handle<AccessorPair> Factory::NewAccessorPair() { ...@@ -302,7 +305,7 @@ Handle<AccessorPair> Factory::NewAccessorPair() {
Handle<TypeFeedbackInfo> Factory::NewTypeFeedbackInfo() { Handle<TypeFeedbackInfo> Factory::NewTypeFeedbackInfo() {
Handle<TypeFeedbackInfo> info = Handle<TypeFeedbackInfo> info =
Handle<TypeFeedbackInfo>::cast(NewStruct(TUPLE3_TYPE)); Handle<TypeFeedbackInfo>::cast(NewStruct(TUPLE3_TYPE, TENURED));
info->initialize_storage(); info->initialize_storage();
return info; return info;
} }
...@@ -1109,17 +1112,15 @@ Handle<Context> Factory::NewBlockContext(Handle<JSFunction> function, ...@@ -1109,17 +1112,15 @@ Handle<Context> Factory::NewBlockContext(Handle<JSFunction> function,
return context; return context;
} }
Handle<Struct> Factory::NewStruct(InstanceType type) { Handle<Struct> Factory::NewStruct(InstanceType type, PretenureFlag pretenure) {
CALL_HEAP_FUNCTION( CALL_HEAP_FUNCTION(
isolate(), isolate(), isolate()->heap()->AllocateStruct(type, pretenure), Struct);
isolate()->heap()->AllocateStruct(type),
Struct);
} }
Handle<AliasedArgumentsEntry> Factory::NewAliasedArgumentsEntry( Handle<AliasedArgumentsEntry> Factory::NewAliasedArgumentsEntry(
int aliased_context_slot) { int aliased_context_slot) {
Handle<AliasedArgumentsEntry> entry = Handle<AliasedArgumentsEntry>::cast( Handle<AliasedArgumentsEntry> entry = Handle<AliasedArgumentsEntry>::cast(
NewStruct(ALIASED_ARGUMENTS_ENTRY_TYPE)); NewStruct(ALIASED_ARGUMENTS_ENTRY_TYPE, NOT_TENURED));
entry->set_aliased_context_slot(aliased_context_slot); entry->set_aliased_context_slot(aliased_context_slot);
return entry; return entry;
} }
...@@ -1127,7 +1128,7 @@ Handle<AliasedArgumentsEntry> Factory::NewAliasedArgumentsEntry( ...@@ -1127,7 +1128,7 @@ Handle<AliasedArgumentsEntry> Factory::NewAliasedArgumentsEntry(
Handle<AccessorInfo> Factory::NewAccessorInfo() { Handle<AccessorInfo> Factory::NewAccessorInfo() {
Handle<AccessorInfo> info = Handle<AccessorInfo> info =
Handle<AccessorInfo>::cast(NewStruct(ACCESSOR_INFO_TYPE)); Handle<AccessorInfo>::cast(NewStruct(ACCESSOR_INFO_TYPE, TENURED));
info->set_flag(0); // Must clear the flag, it was initialized as undefined. info->set_flag(0); // Must clear the flag, it was initialized as undefined.
info->set_is_sloppy(true); info->set_is_sloppy(true);
return info; return info;
...@@ -1137,7 +1138,7 @@ Handle<AccessorInfo> Factory::NewAccessorInfo() { ...@@ -1137,7 +1138,7 @@ Handle<AccessorInfo> Factory::NewAccessorInfo() {
Handle<Script> Factory::NewScript(Handle<String> source) { Handle<Script> Factory::NewScript(Handle<String> source) {
// Create and initialize script object. // Create and initialize script object.
Heap* heap = isolate()->heap(); Heap* heap = isolate()->heap();
Handle<Script> script = Handle<Script>::cast(NewStruct(SCRIPT_TYPE)); Handle<Script> script = Handle<Script>::cast(NewStruct(SCRIPT_TYPE, TENURED));
script->set_source(*source); script->set_source(*source);
script->set_name(heap->undefined_value()); script->set_name(heap->undefined_value());
script->set_id(isolate()->heap()->NextScriptId()); script->set_id(isolate()->heap()->NextScriptId());
...@@ -1714,7 +1715,7 @@ Handle<ModuleInfo> Factory::NewModuleInfo() { ...@@ -1714,7 +1715,7 @@ Handle<ModuleInfo> Factory::NewModuleInfo() {
Handle<PreParsedScopeData> Factory::NewPreParsedScopeData() { Handle<PreParsedScopeData> Factory::NewPreParsedScopeData() {
Handle<PreParsedScopeData> result = Handle<PreParsedScopeData> result =
Handle<PreParsedScopeData>::cast(NewStruct(TUPLE2_TYPE)); Handle<PreParsedScopeData>::cast(NewStruct(TUPLE2_TYPE, TENURED));
result->set_scope_data(PodArray<uint32_t>::cast(*empty_byte_array())); result->set_scope_data(PodArray<uint32_t>::cast(*empty_byte_array()));
result->set_child_data(*empty_fixed_array()); result->set_child_data(*empty_fixed_array());
return result; return result;
...@@ -2036,7 +2037,7 @@ Handle<Module> Factory::NewModule(Handle<SharedFunctionInfo> code) { ...@@ -2036,7 +2037,7 @@ Handle<Module> Factory::NewModule(Handle<SharedFunctionInfo> code) {
requested_modules_length > 0 ? NewFixedArray(requested_modules_length) requested_modules_length > 0 ? NewFixedArray(requested_modules_length)
: empty_fixed_array(); : empty_fixed_array();
Handle<Module> module = Handle<Module>::cast(NewStruct(MODULE_TYPE)); Handle<Module> module = Handle<Module>::cast(NewStruct(MODULE_TYPE, TENURED));
module->set_code(*code); module->set_code(*code);
module->set_exports(*exports); module->set_exports(*exports);
module->set_regular_exports(*regular_exports); module->set_regular_exports(*regular_exports);
...@@ -2645,7 +2646,7 @@ Handle<DebugInfo> Factory::NewDebugInfo(Handle<SharedFunctionInfo> shared) { ...@@ -2645,7 +2646,7 @@ Handle<DebugInfo> Factory::NewDebugInfo(Handle<SharedFunctionInfo> shared) {
Heap* heap = isolate()->heap(); Heap* heap = isolate()->heap();
Handle<DebugInfo> debug_info = Handle<DebugInfo> debug_info =
Handle<DebugInfo>::cast(NewStruct(DEBUG_INFO_TYPE)); Handle<DebugInfo>::cast(NewStruct(DEBUG_INFO_TYPE, TENURED));
debug_info->set_flags(DebugInfo::kNone); debug_info->set_flags(DebugInfo::kNone);
debug_info->set_shared(*shared); debug_info->set_shared(*shared);
debug_info->set_debugger_hints(shared->debugger_hints()); debug_info->set_debugger_hints(shared->debugger_hints());
...@@ -2676,7 +2677,7 @@ Handle<CoverageInfo> Factory::NewCoverageInfo( ...@@ -2676,7 +2677,7 @@ Handle<CoverageInfo> Factory::NewCoverageInfo(
Handle<BreakPointInfo> Factory::NewBreakPointInfo(int source_position) { Handle<BreakPointInfo> Factory::NewBreakPointInfo(int source_position) {
Handle<BreakPointInfo> new_break_point_info = Handle<BreakPointInfo> new_break_point_info =
Handle<BreakPointInfo>::cast(NewStruct(TUPLE2_TYPE)); Handle<BreakPointInfo>::cast(NewStruct(TUPLE2_TYPE, TENURED));
new_break_point_info->set_source_position(source_position); new_break_point_info->set_source_position(source_position);
new_break_point_info->set_break_point_objects(*undefined_value()); new_break_point_info->set_break_point_objects(*undefined_value());
return new_break_point_info; return new_break_point_info;
...@@ -2684,15 +2685,15 @@ Handle<BreakPointInfo> Factory::NewBreakPointInfo(int source_position) { ...@@ -2684,15 +2685,15 @@ Handle<BreakPointInfo> Factory::NewBreakPointInfo(int source_position) {
Handle<BreakPoint> Factory::NewBreakPoint(int id, Handle<String> condition) { Handle<BreakPoint> Factory::NewBreakPoint(int id, Handle<String> condition) {
Handle<BreakPoint> new_break_point = Handle<BreakPoint> new_break_point =
Handle<BreakPoint>::cast(NewStruct(TUPLE2_TYPE)); Handle<BreakPoint>::cast(NewStruct(TUPLE2_TYPE, TENURED));
new_break_point->set_id(id); new_break_point->set_id(id);
new_break_point->set_condition(*condition); new_break_point->set_condition(*condition);
return new_break_point; return new_break_point;
} }
Handle<StackFrameInfo> Factory::NewStackFrameInfo() { Handle<StackFrameInfo> Factory::NewStackFrameInfo() {
Handle<StackFrameInfo> stack_frame_info = Handle<StackFrameInfo> stack_frame_info = Handle<StackFrameInfo>::cast(
Handle<StackFrameInfo>::cast(NewStruct(STACK_FRAME_INFO_TYPE)); NewStruct(STACK_FRAME_INFO_TYPE, NOT_TENURED));
stack_frame_info->set_line_number(0); stack_frame_info->set_line_number(0);
stack_frame_info->set_column_number(0); stack_frame_info->set_column_number(0);
stack_frame_info->set_script_id(0); stack_frame_info->set_script_id(0);
...@@ -2710,7 +2711,7 @@ Factory::NewSourcePositionTableWithFrameCache( ...@@ -2710,7 +2711,7 @@ Factory::NewSourcePositionTableWithFrameCache(
Handle<SourcePositionTableWithFrameCache> Handle<SourcePositionTableWithFrameCache>
source_position_table_with_frame_cache = source_position_table_with_frame_cache =
Handle<SourcePositionTableWithFrameCache>::cast( Handle<SourcePositionTableWithFrameCache>::cast(
NewStruct(TUPLE2_TYPE)); NewStruct(TUPLE2_TYPE, TENURED));
source_position_table_with_frame_cache->set_source_position_table( source_position_table_with_frame_cache->set_source_position_table(
*source_position_table); *source_position_table);
source_position_table_with_frame_cache->set_stack_frame_cache( source_position_table_with_frame_cache->set_stack_frame_cache(
......
...@@ -131,11 +131,12 @@ class V8_EXPORT_PRIVATE Factory final { ...@@ -131,11 +131,12 @@ class V8_EXPORT_PRIVATE Factory final {
Handle<FixedArray> indices); Handle<FixedArray> indices);
// Create a new Tuple2 struct. // Create a new Tuple2 struct.
Handle<Tuple2> NewTuple2(Handle<Object> value1, Handle<Object> value2); Handle<Tuple2> NewTuple2(Handle<Object> value1, Handle<Object> value2,
PretenureFlag pretenure);
// Create a new Tuple3 struct. // Create a new Tuple3 struct.
Handle<Tuple3> NewTuple3(Handle<Object> value1, Handle<Object> value2, Handle<Tuple3> NewTuple3(Handle<Object> value1, Handle<Object> value2,
Handle<Object> value3); Handle<Object> value3, PretenureFlag pretenure);
// Create a new ContextExtension struct. // Create a new ContextExtension struct.
Handle<ContextExtension> NewContextExtension(Handle<ScopeInfo> scope_info, Handle<ContextExtension> NewContextExtension(Handle<ScopeInfo> scope_info,
...@@ -359,9 +360,8 @@ class V8_EXPORT_PRIVATE Factory final { ...@@ -359,9 +360,8 @@ class V8_EXPORT_PRIVATE Factory final {
Handle<Context> previous, Handle<Context> previous,
Handle<ScopeInfo> scope_info); Handle<ScopeInfo> scope_info);
// Allocate a new struct. The struct is pretenured (allocated directly in Handle<Struct> NewStruct(InstanceType type,
// the old generation). PretenureFlag pretenure = NOT_TENURED);
Handle<Struct> NewStruct(InstanceType type);
Handle<AliasedArgumentsEntry> NewAliasedArgumentsEntry( Handle<AliasedArgumentsEntry> NewAliasedArgumentsEntry(
int aliased_context_slot); int aliased_context_slot);
......
...@@ -4411,8 +4411,8 @@ AllocationResult Heap::AllocateSymbol() { ...@@ -4411,8 +4411,8 @@ AllocationResult Heap::AllocateSymbol() {
return result; return result;
} }
AllocationResult Heap::AllocateStruct(InstanceType type,
AllocationResult Heap::AllocateStruct(InstanceType type) { PretenureFlag pretenure) {
Map* map; Map* map;
switch (type) { switch (type) {
#define MAKE_CASE(NAME, Name, name) \ #define MAKE_CASE(NAME, Name, name) \
...@@ -4427,7 +4427,8 @@ AllocationResult Heap::AllocateStruct(InstanceType type) { ...@@ -4427,7 +4427,8 @@ AllocationResult Heap::AllocateStruct(InstanceType type) {
int size = map->instance_size(); int size = map->instance_size();
Struct* result = nullptr; Struct* result = nullptr;
{ {
AllocationResult allocation = Allocate(map, OLD_SPACE); AllocationSpace space = SelectSpace(pretenure);
AllocationResult allocation = Allocate(map, space);
if (!allocation.To(&result)) return allocation; if (!allocation.To(&result)) return allocation;
} }
result->InitializeBody(size); result->InitializeBody(size);
......
...@@ -2171,7 +2171,8 @@ class Heap { ...@@ -2171,7 +2171,8 @@ class Heap {
MUST_USE_RESULT AllocationResult AllocateTransitionArray(int capacity); MUST_USE_RESULT AllocationResult AllocateTransitionArray(int capacity);
// Allocates a new utility object in the old generation. // Allocates a new utility object in the old generation.
MUST_USE_RESULT AllocationResult AllocateStruct(InstanceType type); MUST_USE_RESULT AllocationResult
AllocateStruct(InstanceType type, PretenureFlag pretenure = NOT_TENURED);
// Allocates a new foreign object. // Allocates a new foreign object.
MUST_USE_RESULT AllocationResult MUST_USE_RESULT AllocationResult
......
...@@ -790,7 +790,7 @@ Handle<Object> LoadIC::LoadFromPrototype(Handle<Map> receiver_map, ...@@ -790,7 +790,7 @@ Handle<Object> LoadIC::LoadFromPrototype(Handle<Map> receiver_map,
if (checks_count == 0) { if (checks_count == 0) {
return isolate()->factory()->NewTuple3(holder_cell, smi_handler, return isolate()->factory()->NewTuple3(holder_cell, smi_handler,
validity_cell); validity_cell, TENURED);
} }
Handle<FixedArray> handler_array(isolate()->factory()->NewFixedArray( Handle<FixedArray> handler_array(isolate()->factory()->NewFixedArray(
LoadHandler::kFirstPrototypeIndex + checks_count, TENURED)); LoadHandler::kFirstPrototypeIndex + checks_count, TENURED));
...@@ -833,7 +833,7 @@ Handle<Object> LoadIC::LoadFullChain(Handle<Map> receiver_map, ...@@ -833,7 +833,7 @@ Handle<Object> LoadIC::LoadFullChain(Handle<Map> receiver_map,
Factory* factory = isolate()->factory(); Factory* factory = isolate()->factory();
if (checks_count == 0) { if (checks_count == 0) {
return factory->NewTuple3(holder, smi_handler, validity_cell); return factory->NewTuple3(holder, smi_handler, validity_cell, TENURED);
} }
Handle<FixedArray> handler_array(factory->NewFixedArray( Handle<FixedArray> handler_array(factory->NewFixedArray(
LoadHandler::kFirstPrototypeIndex + checks_count, TENURED)); LoadHandler::kFirstPrototypeIndex + checks_count, TENURED));
...@@ -1647,7 +1647,8 @@ Handle<Object> StoreIC::StoreTransition(Handle<Map> receiver_map, ...@@ -1647,7 +1647,8 @@ Handle<Object> StoreIC::StoreTransition(Handle<Map> receiver_map,
Factory* factory = isolate()->factory(); Factory* factory = isolate()->factory();
if (checks_count == 0) { if (checks_count == 0) {
return factory->NewTuple3(transition_cell, smi_handler, validity_cell); return factory->NewTuple3(transition_cell, smi_handler, validity_cell,
TENURED);
} }
Handle<FixedArray> handler_array(factory->NewFixedArray( Handle<FixedArray> handler_array(factory->NewFixedArray(
StoreHandler::kFirstPrototypeIndex + checks_count, TENURED)); StoreHandler::kFirstPrototypeIndex + checks_count, TENURED));
...@@ -2028,7 +2029,7 @@ Handle<Object> KeyedStoreIC::StoreElementHandler( ...@@ -2028,7 +2029,7 @@ Handle<Object> KeyedStoreIC::StoreElementHandler(
Handle<Object> validity_cell = Handle<Object> validity_cell =
Map::GetOrCreatePrototypeChainValidityCell(receiver_map, isolate()); Map::GetOrCreatePrototypeChainValidityCell(receiver_map, isolate());
if (validity_cell.is_null()) return stub; if (validity_cell.is_null()) return stub;
return isolate()->factory()->NewTuple2(validity_cell, stub); return isolate()->factory()->NewTuple2(validity_cell, stub, TENURED);
} }
void KeyedStoreIC::StoreElementPolymorphicHandlers( void KeyedStoreIC::StoreElementPolymorphicHandlers(
...@@ -2090,8 +2091,8 @@ void KeyedStoreIC::StoreElementPolymorphicHandlers( ...@@ -2090,8 +2091,8 @@ void KeyedStoreIC::StoreElementPolymorphicHandlers(
validity_cell = handle(Smi::kZero, isolate()); validity_cell = handle(Smi::kZero, isolate());
} }
Handle<WeakCell> transition = Map::WeakCellForMap(transitioned_map); Handle<WeakCell> transition = Map::WeakCellForMap(transitioned_map);
handler = handler = isolate()->factory()->NewTuple3(transition, stub,
isolate()->factory()->NewTuple3(transition, stub, validity_cell); validity_cell, TENURED);
} else { } else {
handler = StoreElementHandler(receiver_map, store_mode); handler = StoreElementHandler(receiver_map, store_mode);
} }
......
...@@ -827,7 +827,7 @@ Handle<ModuleInfoEntry> ModuleInfoEntry::New(Isolate* isolate, ...@@ -827,7 +827,7 @@ Handle<ModuleInfoEntry> ModuleInfoEntry::New(Isolate* isolate,
int module_request, int cell_index, int module_request, int cell_index,
int beg_pos, int end_pos) { int beg_pos, int end_pos) {
Handle<ModuleInfoEntry> result = Handle<ModuleInfoEntry>::cast( Handle<ModuleInfoEntry> result = Handle<ModuleInfoEntry>::cast(
isolate->factory()->NewStruct(MODULE_INFO_ENTRY_TYPE)); isolate->factory()->NewStruct(MODULE_INFO_ENTRY_TYPE, TENURED));
result->set_export_name(*export_name); result->set_export_name(*export_name);
result->set_local_name(*local_name); result->set_local_name(*local_name);
result->set_import_name(*import_name); result->set_import_name(*import_name);
......
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