Commit 10aa375c authored by Camillo Bruni's avatar Camillo Bruni Committed by Commit Bot

[cleanup] Use LoadObjectMap and LoadObjectWithNullPrototypeMap helpers

Bug: v8:10763
Change-Id: I959661854e5b138186406d4d6fda77558200d454
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2402878Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Reviewed-by: 's avatarVictor Gomes <victorgomes@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69820}
parent 120eb388
...@@ -623,10 +623,7 @@ TNode<HeapObject> ConstructorBuiltinsAssembler::CreateShallowObjectLiteral( ...@@ -623,10 +623,7 @@ TNode<HeapObject> ConstructorBuiltinsAssembler::CreateShallowObjectLiteral(
TNode<JSObject> ConstructorBuiltinsAssembler::CreateEmptyObjectLiteral( TNode<JSObject> ConstructorBuiltinsAssembler::CreateEmptyObjectLiteral(
TNode<Context> context) { TNode<Context> context) {
TNode<NativeContext> native_context = LoadNativeContext(context); TNode<NativeContext> native_context = LoadNativeContext(context);
TNode<JSFunction> object_function = TNode<Map> map = LoadObjectMap(native_context);
CAST(LoadContextElement(native_context, Context::OBJECT_FUNCTION_INDEX));
TNode<Map> map = LoadObjectField<Map>(
object_function, JSFunction::kPrototypeOrInitialMapOffset);
// Ensure that slack tracking is disabled for the map. // Ensure that slack tracking is disabled for the map.
STATIC_ASSERT(Map::kNoSlackTracking == 0); STATIC_ASSERT(Map::kNoSlackTracking == 0);
CSA_ASSERT(this, IsClearWord32<Map::Bits3::ConstructionCounterBits>( CSA_ASSERT(this, IsClearWord32<Map::Bits3::ConstructionCounterBits>(
......
...@@ -1073,8 +1073,7 @@ TF_BUILTIN(ObjectCreate, ObjectBuiltinsAssembler) { ...@@ -1073,8 +1073,7 @@ TF_BUILTIN(ObjectCreate, ObjectBuiltinsAssembler) {
BIND(&good); BIND(&good);
{ {
map = CAST(LoadContextElement( map = LoadObjectWithNullPrototypeMap(context);
context, Context::SLOW_OBJECT_WITH_NULL_PROTOTYPE_MAP));
properties = AllocateNameDictionary(NameDictionary::kInitialCapacity); properties = AllocateNameDictionary(NameDictionary::kInitialCapacity);
Goto(&instantiate_map); Goto(&instantiate_map);
} }
...@@ -1082,11 +1081,7 @@ TF_BUILTIN(ObjectCreate, ObjectBuiltinsAssembler) { ...@@ -1082,11 +1081,7 @@ TF_BUILTIN(ObjectCreate, ObjectBuiltinsAssembler) {
BIND(&non_null_proto); BIND(&non_null_proto);
{ {
properties = EmptyFixedArrayConstant(); properties = EmptyFixedArrayConstant();
TNode<HeapObject> object_function = map = LoadObjectMap(context);
CAST(LoadContextElement(context, Context::OBJECT_FUNCTION_INDEX));
TNode<Map> object_function_map = LoadObjectField<Map>(
object_function, JSFunction::kPrototypeOrInitialMapOffset);
map = object_function_map;
GotoIf(TaggedEqual(prototype, LoadMapPrototype(map.value())), GotoIf(TaggedEqual(prototype, LoadMapPrototype(map.value())),
&instantiate_map); &instantiate_map);
// Try loading the prototype info. // Try loading the prototype info.
......
...@@ -284,8 +284,7 @@ TNode<JSRegExpResult> RegExpBuiltinsAssembler::ConstructNewResultFromMatchInfo( ...@@ -284,8 +284,7 @@ TNode<JSRegExpResult> RegExpBuiltinsAssembler::ConstructNewResultFromMatchInfo(
TNode<IntPtrT> num_properties = WordSar(names_length, 1); TNode<IntPtrT> num_properties = WordSar(names_length, 1);
TNode<NativeContext> native_context = LoadNativeContext(context); TNode<NativeContext> native_context = LoadNativeContext(context);
TNode<Map> map = CAST(LoadContextElement( TNode<Map> map = LoadObjectWithNullPrototypeMap(native_context);
native_context, Context::SLOW_OBJECT_WITH_NULL_PROTOTYPE_MAP));
TNode<NameDictionary> properties = TNode<NameDictionary> properties =
AllocateNameDictionary(num_properties, kAllowLargeObjectAllocation); AllocateNameDictionary(num_properties, kAllowLargeObjectAllocation);
......
...@@ -2520,6 +2520,20 @@ TNode<Context> CodeStubAssembler::LoadModuleContext( ...@@ -2520,6 +2520,20 @@ TNode<Context> CodeStubAssembler::LoadModuleContext(
return UncheckedCast<Context>(cur_context.value()); return UncheckedCast<Context>(cur_context.value());
} }
TNode<Map> CodeStubAssembler::LoadObjectMap(TNode<Context> context) {
TNode<HeapObject> object_function =
CAST(LoadContextElement(context, Context::OBJECT_FUNCTION_INDEX));
return LoadObjectField<Map>(object_function,
JSFunction::kPrototypeOrInitialMapOffset);
}
TNode<Map> CodeStubAssembler::LoadObjectWithNullPrototypeMap(
TNode<Context> context) {
TNode<Map> map = CAST(LoadContextElement(
context, Context::SLOW_OBJECT_WITH_NULL_PROTOTYPE_MAP));
return map;
}
TNode<Map> CodeStubAssembler::LoadJSArrayElementsMap( TNode<Map> CodeStubAssembler::LoadJSArrayElementsMap(
SloppyTNode<Int32T> kind, SloppyTNode<NativeContext> native_context) { SloppyTNode<Int32T> kind, SloppyTNode<NativeContext> native_context) {
CSA_ASSERT(this, IsFastElementsKind(kind)); CSA_ASSERT(this, IsFastElementsKind(kind));
......
...@@ -1402,6 +1402,9 @@ class V8_EXPORT_PRIVATE CodeStubAssembler ...@@ -1402,6 +1402,9 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
if_equal); if_equal);
} }
TNode<Map> LoadObjectMap(TNode<Context> context);
TNode<Map> LoadObjectWithNullPrototypeMap(TNode<Context> context);
TNode<Map> LoadJSArrayElementsMap(ElementsKind kind, TNode<Map> LoadJSArrayElementsMap(ElementsKind kind,
SloppyTNode<NativeContext> native_context); SloppyTNode<NativeContext> native_context);
TNode<Map> LoadJSArrayElementsMap(SloppyTNode<Int32T> kind, TNode<Map> LoadJSArrayElementsMap(SloppyTNode<Int32T> kind,
......
...@@ -4065,12 +4065,7 @@ void AccessorAssembler::GenerateCloneObjectIC_Slow() { ...@@ -4065,12 +4065,7 @@ void AccessorAssembler::GenerateCloneObjectIC_Slow() {
// used. // used.
TNode<NativeContext> native_context = LoadNativeContext(context); TNode<NativeContext> native_context = LoadNativeContext(context);
TNode<JSFunction> object_fn = TNode<Map> initial_map = LoadObjectMap(native_context);
CAST(LoadContextElement(native_context, Context::OBJECT_FUNCTION_INDEX));
TNode<Map> initial_map = CAST(
LoadObjectField(object_fn, JSFunction::kPrototypeOrInitialMapOffset));
CSA_ASSERT(this, IsMap(initial_map));
TNode<JSObject> result = AllocateJSObjectFromMap(initial_map); TNode<JSObject> result = AllocateJSObjectFromMap(initial_map);
{ {
......
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