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