Commit a50719d6 authored by Igor Sheludko's avatar Igor Sheludko Committed by Commit Bot

[test] Remove CSA::AllocateStruct() used only in tests

Bug: chromium:1024264
Change-Id: Ibb3965bb0619a2cefe64d2f8190dbc1959e5ef3d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1915419Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64972}
parent 7788f1ea
......@@ -266,6 +266,7 @@ namespace promise {
return executorContext;
}
@export
macro CreatePromiseCapability(
promise: JSReceiver|Undefined, resolve: JSFunction|Undefined,
reject: JSFunction|Undefined): PromiseCapability {
......
......@@ -3745,29 +3745,6 @@ template V8_EXPORT_PRIVATE TNode<SmallOrderedHashSet>
CodeStubAssembler::AllocateSmallOrderedHashTable<SmallOrderedHashSet>(
TNode<IntPtrT> capacity);
Node* CodeStubAssembler::AllocateStruct(Node* map, AllocationFlags flags) {
Comment("AllocateStruct");
CSA_ASSERT(this, IsMap(map));
TNode<IntPtrT> size = TimesTaggedSize(LoadMapInstanceSizeInWords(map));
TNode<HeapObject> object = Allocate(size, flags);
StoreMapNoWriteBarrier(object, map);
InitializeStructBody(object, size, Struct::kHeaderSize);
return object;
}
void CodeStubAssembler::InitializeStructBody(TNode<HeapObject> object,
TNode<IntPtrT> size,
int start_offset) {
Comment("InitializeStructBody");
TNode<Oddball> filler = UndefinedConstant();
// Calculate the untagged field addresses.
TNode<IntPtrT> start_address =
IntPtrAdd(BitcastTaggedToWord(object),
IntPtrConstant(start_offset - kHeapObjectTag));
TNode<IntPtrT> end_address = IntPtrAdd(start_address, size);
StoreFieldsNoWriteBarrier(start_address, end_address, filler);
}
TNode<JSObject> CodeStubAssembler::AllocateJSObjectFromMap(
SloppyTNode<Map> map, SloppyTNode<HeapObject> properties,
SloppyTNode<FixedArray> elements, AllocationFlags flags,
......
......@@ -1790,10 +1790,6 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
template <typename CollectionType>
TNode<CollectionType> AllocateSmallOrderedHashTable(TNode<IntPtrT> capacity);
Node* AllocateStruct(Node* map, AllocationFlags flags = kNone);
void InitializeStructBody(TNode<HeapObject> object, TNode<IntPtrT> size,
int start_offset = Struct::kHeaderSize);
TNode<JSObject> AllocateJSObjectFromMap(
SloppyTNode<Map> map, SloppyTNode<HeapObject> properties = nullptr,
SloppyTNode<FixedArray> elements = nullptr, AllocationFlags flags = kNone,
......
......@@ -2711,19 +2711,13 @@ TEST(CreatePromiseGetCapabilitiesExecutorContext) {
CodeAssemblerTester asm_tester(isolate, kNumParams);
PromiseBuiltinsAssembler m(asm_tester.state());
Node* const context = m.Parameter(kNumParams + 2);
const TNode<NativeContext> native_context = m.LoadNativeContext(context);
TNode<Context> context = m.CAST(m.Parameter(kNumParams + 2));
TNode<NativeContext> native_context = m.LoadNativeContext(context);
const TNode<Map> map = m.PromiseCapabilityMapConstant();
Node* const capability = m.AllocateStruct(map);
m.StoreObjectFieldNoWriteBarrier(
capability, PromiseCapability::kPromiseOffset, m.UndefinedConstant());
m.StoreObjectFieldNoWriteBarrier(
capability, PromiseCapability::kResolveOffset, m.UndefinedConstant());
m.StoreObjectFieldNoWriteBarrier(capability, PromiseCapability::kRejectOffset,
m.UndefinedConstant());
Node* const executor_context = m.CreatePromiseCapabilitiesExecutorContext(
native_context, m.CAST(capability));
TNode<PromiseCapability> capability = m.CreatePromiseCapability(
m.UndefinedConstant(), m.UndefinedConstant(), m.UndefinedConstant());
TNode<Context> executor_context =
m.CreatePromiseCapabilitiesExecutorContext(native_context, capability);
m.Return(executor_context);
FunctionTester ft(asm_tester.GenerateCode(), kNumParams);
......@@ -3049,40 +3043,6 @@ TEST(LoadJSArrayElementsMap) {
}
}
TEST(AllocateStruct) {
Isolate* isolate(CcTest::InitIsolateOnce());
const int kNumParams = 3;
CodeAssemblerTester asm_tester(isolate, kNumParams);
CodeStubAssembler m(asm_tester.state());
{
Node* map = m.Parameter(0);
Node* result = m.AllocateStruct(map);
m.Return(result);
}
FunctionTester ft(asm_tester.GenerateCode(), kNumParams);
Handle<Map> maps[] = {
handle(ReadOnlyRoots(isolate).tuple3_map(), isolate),
handle(ReadOnlyRoots(isolate).tuple2_map(), isolate),
};
{
for (size_t i = 0; i < 2; i++) {
Handle<Map> map = maps[i];
Handle<Struct> result =
Handle<Struct>::cast(ft.Call(map).ToHandleChecked());
CHECK_EQ(result->map(), *map);
#ifdef VERIFY_HEAP
isolate->heap()->Verify();
#endif
}
}
}
TEST(GotoIfNotWhiteSpaceOrLineTerminator) {
Isolate* isolate(CcTest::InitIsolateOnce());
......
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