Commit e654b5d8 authored by Paolo Severini's avatar Paolo Severini Committed by Commit Bot

[torque] Convert a few class layout definitions to torque.

Converted InterpreterData, JSDataView, StackTraceFrame, WasmDebugInfo,
WasmExportedFunctionData to torque.

Bug: v8:8952
Change-Id: I424edc04fd3f7a62d72f546dee898919d7a726df
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1542504Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Commit-Queue: Paolo Severini <paolosev@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#60878}
parent 23eec7c5
......@@ -149,6 +149,8 @@ extern class FixedDoubleArray extends FixedArrayBase {
extern class ByteArray extends FixedArrayBase {}
type BytecodeArray extends FixedArrayBase;
// These intrinsics should never be called from Torque code. They're used
// internally by the 'new' operator and only declared here because it's simpler
// than building the definition from C++.
......@@ -342,6 +344,11 @@ extern class PreparseData extends HeapObject {
inner_length: int32;
}
extern class InterpreterData extends Struct {
bytecode_array: BytecodeArray;
interpreter_trampoline: Code;
}
extern class SharedFunctionInfo extends HeapObject {
weak function_data: Object;
name_or_scope_info: String | NoSharedNameSentinel | ScopeInfo;
......@@ -544,7 +551,7 @@ extern class ObjectTemplateInfo extends TemplateInfo {
extern class PropertyArray extends HeapObject { length_and_hash: Smi; }
type JSDataView extends JSArrayBufferView generates 'TNode<JSDataView>';
extern class JSDataView extends JSArrayBufferView {}
type InstanceType generates 'TNode<Int32T>' constexpr 'InstanceType';
type ElementsKind generates 'TNode<Int32T>' constexpr 'ElementsKind';
......@@ -646,11 +653,36 @@ extern class StackFrameInfo extends Struct {
flag: Smi;
}
extern class StackTraceFrame extends Struct {
frame_array: Object;
frame_index: Smi;
frame_info: Object;
id: Smi;
}
extern class ClassPositions extends Struct {
start: Smi;
end: Smi;
}
type WasmInstanceObject extends JSObject;
extern class WasmExportedFunctionData extends Struct {
wrapper_code: Code;
instance: WasmInstanceObject;
jump_table_offset: Smi;
function_index: Smi;
}
extern class WasmDebugInfo extends Struct {
instance: WasmInstanceObject;
interpreter_handle: Foreign | Undefined;
interpreted_functions: FixedArray;
locals_names: FixedArray;
c_wasm_entries: FixedArray;
c_wasm_entry_map: Foreign; // Managed<wasm::SignatureMap>
}
extern class WasmExceptionTag extends Struct { index: Smi; }
const kSmiTagSize: constexpr int31 generates 'kSmiTagSize';
......
......@@ -1885,6 +1885,7 @@ void WasmDebugInfo::WasmDebugInfoVerify(Isolate* isolate) {
CHECK(interpreter_handle()->IsUndefined(isolate) ||
interpreter_handle()->IsForeign());
VerifyObjectField(isolate, kInterpretedFunctionsOffset);
CHECK(interpreted_functions()->IsFixedArray());
VerifyObjectField(isolate, kLocalsNamesOffset);
VerifyObjectField(isolate, kCWasmEntriesOffset);
VerifyObjectField(isolate, kCWasmEntryMapOffset);
......@@ -1915,6 +1916,7 @@ void WasmExportedFunctionData::WasmExportedFunctionDataVerify(
CHECK(wrapper_code()->kind() == Code::JS_TO_WASM_FUNCTION ||
wrapper_code()->kind() == Code::C_WASM_ENTRY);
VerifyObjectField(isolate, kInstanceOffset);
CHECK(instance()->IsWasmInstanceObject());
VerifySmiField(kJumpTableOffsetOffset);
VerifySmiField(kFunctionIndexOffset);
}
......@@ -2134,7 +2136,9 @@ void UncompiledDataWithoutPreparseData::UncompiledDataWithoutPreparseDataVerify(
void InterpreterData::InterpreterDataVerify(Isolate* isolate) {
CHECK(IsInterpreterData());
VerifyObjectField(isolate, kBytecodeArrayOffset);
CHECK(bytecode_array()->IsBytecodeArray());
VerifyObjectField(isolate, kInterpreterTrampolineOffset);
CHECK(interpreter_trampoline()->IsCode());
}
......
......@@ -1859,6 +1859,7 @@ void WasmExportedFunctionData::WasmExportedFunctionDataPrint(
PrintHeader(os, "WasmExportedFunctionData");
os << "\n - wrapper_code: " << Brief(wrapper_code());
os << "\n - instance: " << Brief(instance());
os << "\n - jump_table_offset: " << jump_table_offset();
os << "\n - function_index: " << function_index();
os << "\n";
}
......
......@@ -205,15 +205,8 @@ class InterpreterData : public Struct {
DECL_ACCESSORS(bytecode_array, BytecodeArray)
DECL_ACCESSORS(interpreter_trampoline, Code)
// Layout description.
#define INTERPRETER_DATA_FIELDS(V) \
V(kBytecodeArrayOffset, kTaggedSize) \
V(kInterpreterTrampolineOffset, kTaggedSize) \
/* Total size. */ \
V(kSize, 0)
DEFINE_FIELD_OFFSET_CONSTANTS(Struct::kHeaderSize, INTERPRETER_DATA_FIELDS)
#undef INTERPRETER_DATA_FIELDS
DEFINE_FIELD_OFFSET_CONSTANTS(Struct::kHeaderSize,
TORQUE_GENERATED_INTERPRETER_DATA_FIELDS)
DECL_CAST(InterpreterData)
DECL_PRINTER(InterpreterData)
......
......@@ -66,17 +66,8 @@ class StackTraceFrame : public Struct {
DECL_PRINTER(StackTraceFrame)
DECL_VERIFIER(StackTraceFrame)
// Layout description.
#define STACK_FRAME_FIELDS(V) \
V(kFrameArrayOffset, kTaggedSize) \
V(kFrameIndexOffset, kTaggedSize) \
V(kFrameInfoOffset, kTaggedSize) \
V(kIdOffset, kTaggedSize) \
/* Total size. */ \
V(kSize, 0)
DEFINE_FIELD_OFFSET_CONSTANTS(Struct::kHeaderSize, STACK_FRAME_FIELDS)
#undef STACK_FRAME_FIELDS
DEFINE_FIELD_OFFSET_CONSTANTS(Struct::kHeaderSize,
TORQUE_GENERATED_STACK_TRACE_FRAME_FIELDS)
static int GetLineNumber(Handle<StackTraceFrame> frame);
static int GetColumnNumber(Handle<StackTraceFrame> frame);
......
......@@ -699,16 +699,9 @@ class WasmExportedFunctionData : public Struct {
DECL_VERIFIER(WasmExportedFunctionData)
// Layout description.
#define WASM_EXPORTED_FUNCTION_DATA_FIELDS(V) \
V(kWrapperCodeOffset, kTaggedSize) \
V(kInstanceOffset, kTaggedSize) \
V(kJumpTableOffsetOffset, kTaggedSize) /* Smi */ \
V(kFunctionIndexOffset, kTaggedSize) /* Smi */ \
V(kSize, 0)
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize,
WASM_EXPORTED_FUNCTION_DATA_FIELDS)
#undef WASM_EXPORTED_FUNCTION_DATA_FIELDS
DEFINE_FIELD_OFFSET_CONSTANTS(
HeapObject::kHeaderSize,
TORQUE_GENERATED_WASM_EXPORTED_FUNCTION_DATA_FIELDS)
OBJECT_CONSTRUCTORS(WasmExportedFunctionData, Struct);
};
......@@ -730,17 +723,8 @@ class WasmDebugInfo : public Struct {
DECL_VERIFIER(WasmDebugInfo)
// Layout description.
#define WASM_DEBUG_INFO_FIELDS(V) \
V(kInstanceOffset, kTaggedSize) \
V(kInterpreterHandleOffset, kTaggedSize) \
V(kInterpretedFunctionsOffset, kTaggedSize) \
V(kLocalsNamesOffset, kTaggedSize) \
V(kCWasmEntriesOffset, kTaggedSize) \
V(kCWasmEntryMapOffset, kTaggedSize) \
V(kSize, 0)
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize, WASM_DEBUG_INFO_FIELDS)
#undef WASM_DEBUG_INFO_FIELDS
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize,
TORQUE_GENERATED_WASM_DEBUG_INFO_FIELDS)
static Handle<WasmDebugInfo> New(Handle<WasmInstanceObject>);
......
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