Commit a66712de authored by Tobias Tebbi's avatar Tobias Tebbi Committed by Commit Bot

[torque] give field layout macros names that refer to Torque

To make it obvious these are not defined in C++.

Bug: v8:7793
Change-Id: Ib846023992e32ddd10dadc3834ce42b7604a1f48
Reviewed-on: https://chromium-review.googlesource.com/c/1495993Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59978}
parent 77434fb9
......@@ -127,7 +127,7 @@ class AccessCheckInfo : public Struct {
static AccessCheckInfo Get(Isolate* isolate, Handle<JSObject> receiver);
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize,
ACCESS_CHECK_INFO_FIELDS)
TORQUE_GENERATED_ACCESS_CHECK_INFO_FIELDS)
OBJECT_CONSTRUCTORS(AccessCheckInfo, Struct);
};
......@@ -158,7 +158,7 @@ class InterceptorInfo : public Struct {
DECL_VERIFIER(InterceptorInfo)
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize,
INTERCEPTOR_INFO_FIELDS)
TORQUE_GENERATED_INTERCEPTOR_INFO_FIELDS)
static const int kCanInterceptSymbolsBit = 0;
static const int kAllCanReadBit = 1;
......
......@@ -31,8 +31,9 @@ class JSArgumentsObject : public JSObject {
class JSArgumentsObjectWithLength : public JSArgumentsObject {
public:
// Layout description.
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize,
JSARGUMENTS_OBJECT_WITH_LENGTH_FIELDS)
DEFINE_FIELD_OFFSET_CONSTANTS(
JSObject::kHeaderSize,
TORQUE_GENERATED_JSARGUMENTS_OBJECT_WITH_LENGTH_FIELDS)
// Indices of in-object properties.
static const int kLengthIndex = 0;
......@@ -141,7 +142,7 @@ class AliasedArgumentsEntry : public Struct {
DECL_VERIFIER(AliasedArgumentsEntry)
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize,
ALIASED_ARGUMENTS_ENTRY_FIELDS)
TORQUE_GENERATED_ALIASED_ARGUMENTS_ENTRY_FIELDS)
OBJECT_CONSTRUCTORS(AliasedArgumentsEntry, Struct);
};
......
......@@ -29,7 +29,8 @@ class Cell : public HeapObject {
DECL_PRINTER(Cell)
DECL_VERIFIER(Cell)
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize, CELL_FIELDS)
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize,
TORQUE_GENERATED_CELL_FIELDS)
typedef FixedBodyDescriptor<kValueOffset, kSize, kSize> BodyDescriptor;
......
......@@ -35,7 +35,8 @@ class DataHandler : public Struct {
DECL_ACCESSORS(data2, MaybeObject)
DECL_ACCESSORS(data3, MaybeObject)
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize, DATA_HANDLER_FIELDS)
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize,
TORQUE_GENERATED_DATA_HANDLER_FIELDS)
static const int kSizeWithData0 = kData1Offset;
static const int kSizeWithData1 = kData2Offset;
......
......@@ -99,7 +99,7 @@ class FixedArrayBase : public HeapObject {
// Layout description.
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize,
FIXED_ARRAY_BASE_FIELDS)
TORQUE_GENERATED_FIXED_ARRAY_BASE_FIELDS)
static const int kHeaderSize = kSize;
......@@ -591,7 +591,7 @@ class FixedTypedArrayBase : public FixedArrayBase {
DECL_CAST(FixedTypedArrayBase)
DEFINE_FIELD_OFFSET_CONSTANTS(FixedArrayBase::kHeaderSize,
FIXED_TYPED_ARRAY_BASE_FIELDS)
TORQUE_GENERATED_FIXED_TYPED_ARRAY_BASE_FIELDS)
static const int kHeaderSize = kSize;
STATIC_ASSERT(IsAligned(kHeaderSize, kDoubleAlignment));
......
......@@ -28,7 +28,8 @@ class Foreign : public HeapObject {
DECL_PRINTER(Foreign)
DECL_VERIFIER(Foreign)
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize, FOREIGN_FIELDS)
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize,
TORQUE_GENERATED_FOREIGN_FIELDS)
STATIC_ASSERT(IsAligned(kForeignAddressOffset, kSystemPointerSize));
STATIC_ASSERT(kForeignAddressOffset == Internals::kForeignAddressOffset);
......
......@@ -105,7 +105,8 @@ class JSArray : public JSObject {
// Number of element slots to pre-allocate for an empty array.
static const int kPreallocatedArrayElements = 4;
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize, JSARRAY_FIELDS)
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize,
TORQUE_GENERATED_JSARRAY_FIELDS)
static const int kLengthDescriptorIndex = 0;
......
......@@ -20,7 +20,8 @@ class JSCollection : public JSObject {
DECL_ACCESSORS(table, Object)
// Layout description.
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize, JSCOLLECTION_FIELDS)
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize,
TORQUE_GENERATED_JSCOLLECTION_FIELDS)
static const int kAddFunctionDescriptorIndex = 3;
......
......@@ -147,7 +147,7 @@ class AsyncGeneratorRequest : public Struct {
DECL_ACCESSORS(promise, Object)
DEFINE_FIELD_OFFSET_CONSTANTS(Struct::kHeaderSize,
ASYNC_GENERATOR_REQUEST_FIELDS)
TORQUE_GENERATED_ASYNC_GENERATOR_REQUEST_FIELDS)
DECL_CAST(AsyncGeneratorRequest)
DECL_PRINTER(AsyncGeneratorRequest)
......
......@@ -264,7 +264,8 @@ class JSReceiver : public HeapObject {
static const int kHashMask = PropertyArray::HashField::kMask;
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize, JSRECEIVER_FIELDS)
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize,
TORQUE_GENERATED_JSRECEIVER_FIELDS)
static const int kHeaderSize = kSize;
bool HasProxyInPrototype(Isolate* isolate);
......@@ -832,8 +833,9 @@ class JSObject : public JSReceiver {
class JSAccessorPropertyDescriptor : public JSObject {
public:
// Layout description.
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize,
JSACCESSOR_PROPERTY_DESCRIPTOR_FIELDS)
DEFINE_FIELD_OFFSET_CONSTANTS(
JSObject::kHeaderSize,
TORQUE_GENERATED_JSACCESSOR_PROPERTY_DESCRIPTOR_FIELDS)
// Indices of in-object properties.
static const int kGetIndex = 0;
......@@ -936,7 +938,8 @@ class JSBoundFunction : public JSObject {
static Handle<String> ToString(Handle<JSBoundFunction> function);
// Layout description.
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize, JSBOUND_FUNCTION_FIELDS)
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize,
TORQUE_GENERATED_JSBOUND_FUNCTION_FIELDS)
OBJECT_CONSTRUCTORS(JSBoundFunction, JSObject);
};
......@@ -1126,7 +1129,8 @@ class JSFunction : public JSObject {
// ES6 section 19.2.3.5 Function.prototype.toString ( ).
static Handle<String> ToString(Handle<JSFunction> function);
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize, JSFUNCTION_FIELDS)
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize,
TORQUE_GENERATED_JSFUNCTION_FIELDS)
static constexpr int kSizeWithoutPrototype = kPrototypeOrInitialMapOffset;
static constexpr int kSizeWithPrototype = kSize;
......@@ -1159,7 +1163,8 @@ class JSGlobalProxy : public JSObject {
DECL_VERIFIER(JSGlobalProxy)
// Layout description.
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize, JSGLOBAL_PROXY_FIELDS)
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize,
TORQUE_GENERATED_JSGLOBAL_PROXY_FIELDS)
OBJECT_CONSTRUCTORS(JSGlobalProxy, JSObject);
};
......@@ -1219,7 +1224,8 @@ class JSValue : public JSObject {
DECL_VERIFIER(JSValue)
// Layout description.
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize, JSVALUE_FIELDS)
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize,
TORQUE_GENERATED_JSVALUE_FIELDS)
OBJECT_CONSTRUCTORS(JSValue, JSObject);
};
......
......@@ -68,7 +68,8 @@ class JSPromise : public JSObject {
DECL_PRINTER(JSPromise)
DECL_VERIFIER(JSPromise)
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize, JSPROMISE_FIELDS)
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize,
TORQUE_GENERATED_JSPROMISE_FIELDS)
static const int kSizeWithEmbedderFields =
kSize + v8::Promise::kEmbedderFieldCount * kEmbedderDataSlotSize;
......
......@@ -106,7 +106,8 @@ class JSProxy : public JSReceiver {
static const int kMaxIterationLimit = 100 * 1024;
// Layout description.
DEFINE_FIELD_OFFSET_CONSTANTS(JSReceiver::kHeaderSize, JSPROXY_FIELDS)
DEFINE_FIELD_OFFSET_CONSTANTS(JSReceiver::kHeaderSize,
TORQUE_GENERATED_JSPROXY_FIELDS)
// kTargetOffset aliases with the elements of JSObject. The fact that
// JSProxy::target is a Javascript value which cannot be confused with an
......@@ -132,8 +133,8 @@ class JSProxy : public JSReceiver {
class JSProxyRevocableResult : public JSObject {
public:
// Layout description.
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize,
JSPROXY_REVOCABLE_RESULT_FIELDS)
DEFINE_FIELD_OFFSET_CONSTANTS(
JSObject::kHeaderSize, TORQUE_GENERATED_JSPROXY_REVOCABLE_RESULT_FIELDS)
// Indices of in-object properties.
static const int kProxyIndex = 0;
......
......@@ -68,8 +68,9 @@ class ArrayBoilerplateDescription : public Struct {
DECL_VERIFIER(ArrayBoilerplateDescription)
void BriefPrintDetails(std::ostream& os);
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize,
ARRAY_BOILERPLATE_DESCRIPTION_FIELDS)
DEFINE_FIELD_OFFSET_CONSTANTS(
HeapObject::kHeaderSize,
TORQUE_GENERATED_ARRAY_BOILERPLATE_DESCRIPTION_FIELDS)
private:
DECL_INT_ACCESSORS(flags)
......
......@@ -34,7 +34,8 @@ class CallbackTask : public Microtask {
DECL_ACCESSORS(callback, Foreign)
DECL_ACCESSORS(data, Foreign)
DEFINE_FIELD_OFFSET_CONSTANTS(Microtask::kHeaderSize, CALLBACK_TASK_FIELDS)
DEFINE_FIELD_OFFSET_CONSTANTS(Microtask::kHeaderSize,
TORQUE_GENERATED_CALLBACK_TASK_FIELDS)
// Dispatched behavior.
DECL_CAST(CallbackTask)
......@@ -52,7 +53,8 @@ class CallableTask : public Microtask {
DECL_ACCESSORS(callable, JSReceiver)
DECL_ACCESSORS(context, Context)
DEFINE_FIELD_OFFSET_CONSTANTS(Microtask::kHeaderSize, CALLABLE_TASK_FIELDS)
DEFINE_FIELD_OFFSET_CONSTANTS(Microtask::kHeaderSize,
TORQUE_GENERATED_CALLABLE_TASK_FIELDS)
// Dispatched behavior.
DECL_CAST(CallableTask)
......
......@@ -333,7 +333,8 @@ class ModuleInfoEntry : public Struct {
int module_request, int cell_index,
int beg_pos, int end_pos);
DEFINE_FIELD_OFFSET_CONSTANTS(Struct::kHeaderSize, MODULE_INFO_ENTRY_FIELDS)
DEFINE_FIELD_OFFSET_CONSTANTS(Struct::kHeaderSize,
TORQUE_GENERATED_MODULE_INFO_ENTRY_FIELDS)
OBJECT_CONSTRUCTORS(ModuleInfoEntry, Struct);
};
......
......@@ -111,7 +111,8 @@ class PromiseCapability : public Struct {
DECL_ACCESSORS(resolve, Object)
DECL_ACCESSORS(reject, Object)
DEFINE_FIELD_OFFSET_CONSTANTS(Struct::kHeaderSize, PROMISE_CAPABILITY_FIELDS)
DEFINE_FIELD_OFFSET_CONSTANTS(Struct::kHeaderSize,
TORQUE_GENERATED_PROMISE_CAPABILITY_FIELDS)
// Dispatched behavior.
DECL_CAST(PromiseCapability)
......@@ -149,7 +150,8 @@ class PromiseReaction : public Struct {
// a PromiseCapability (general case), or undefined (in case of await).
DECL_ACCESSORS(promise_or_capability, HeapObject)
DEFINE_FIELD_OFFSET_CONSTANTS(Struct::kHeaderSize, PROMISE_REACTION_FIELDS)
DEFINE_FIELD_OFFSET_CONSTANTS(Struct::kHeaderSize,
TORQUE_GENERATED_PROMISE_REACTION_FIELDS)
// Dispatched behavior.
DECL_CAST(PromiseReaction)
......
......@@ -660,7 +660,7 @@ class SharedFunctionInfo : public HeapObject {
STATIC_ASSERT(kMaximumFunctionTokenOffset + 1 == kFunctionTokenOutOfRange);
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize,
SHARED_FUNCTION_INFO_FIELDS)
TORQUE_GENERATED_SHARED_FUNCTION_INFO_FIELDS)
static const int kAlignedSize = POINTER_SIZE_ALIGN(kSize);
......@@ -746,8 +746,9 @@ class SharedFunctionInfoWithID : public SharedFunctionInfo {
DECL_CAST(SharedFunctionInfoWithID)
DEFINE_FIELD_OFFSET_CONSTANTS(SharedFunctionInfo::kSize,
SHARED_FUNCTION_INFO_WITH_ID_FIELDS)
DEFINE_FIELD_OFFSET_CONSTANTS(
SharedFunctionInfo::kSize,
TORQUE_GENERATED_SHARED_FUNCTION_INFO_WITH_ID_FIELDS)
static const int kAlignedSize = POINTER_SIZE_ALIGN(kSize);
......
......@@ -36,7 +36,8 @@ class StackFrameInfo : public Struct {
DECL_PRINTER(StackFrameInfo)
DECL_VERIFIER(StackFrameInfo)
DEFINE_FIELD_OFFSET_CONSTANTS(Struct::kHeaderSize, STACK_FRAME_INFO_FIELDS)
DEFINE_FIELD_OFFSET_CONSTANTS(Struct::kHeaderSize,
TORQUE_GENERATED_STACK_FRAME_INFO_FIELDS)
private:
// Bit position in the flag, from least significant bit position.
......
......@@ -39,8 +39,8 @@ class Tuple2 : public Struct {
DECL_VERIFIER(Tuple2)
void BriefPrintDetails(std::ostream& os);
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize, TUPLE2_FIELDS)
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize,
TORQUE_GENERATED_TUPLE2_FIELDS)
OBJECT_CONSTRUCTORS(Tuple2, Struct);
};
......@@ -56,7 +56,7 @@ class Tuple3 : public Tuple2 {
DECL_VERIFIER(Tuple3)
void BriefPrintDetails(std::ostream& os);
DEFINE_FIELD_OFFSET_CONSTANTS(Tuple2::kSize, TUPLE3_FIELDS)
DEFINE_FIELD_OFFSET_CONSTANTS(Tuple2::kSize, TORQUE_GENERATED_TUPLE3_FIELDS)
OBJECT_CONSTRUCTORS(Tuple3, Tuple2);
};
......@@ -118,7 +118,8 @@ class ClassPositions : public Struct {
DECL_VERIFIER(ClassPositions)
void BriefPrintDetails(std::ostream& os);
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize, CLASS_POSITIONS_FIELDS)
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize,
TORQUE_GENERATED_CLASS_POSITIONS_FIELDS)
OBJECT_CONSTRUCTORS(ClassPositions, Struct);
};
......
......@@ -166,7 +166,7 @@ void ImplementationVisitor::Visit(TypeAlias* alias) {
<< class_name << " {\n";
header_out() << " public:\n";
header_out() << " DEFINE_FIELD_OFFSET_CONSTANTS(" << class_name
<< "::kSize, "
<< "::kSize, TORQUE_GENERATED_"
<< CapifyStringWithUnderscores(class_type->name())
<< "_FIELDS)\n";
header_out() << " };\n";
......@@ -2247,7 +2247,7 @@ VisitResult ImplementationVisitor::Visit(CallMethodExpression* expr) {
DCHECK_EQ(expr->method->namespace_qualification.size(), 0);
QualifiedName qualified_name = QualifiedName(method_name);
Callable* callable = nullptr;
callable = LookupMethod(method_name, target, arguments, {});
callable = LookupMethod(method_name, target, arguments, {});
return scope.Yield(GenerateCall(callable, target, arguments, {}, false));
}
......@@ -2646,7 +2646,8 @@ void ImplementationVisitor::GenerateClassDefinitions(std::string& file_name) {
// currently just serves to additionally obfuscate where these values come
// from.
new_contents_stream << "#define ";
new_contents_stream << CapifyStringWithUnderscores(i.first)
new_contents_stream << "TORQUE_GENERATED_"
<< CapifyStringWithUnderscores(i.first)
<< "_FIELDS(V) \\\n";
std::vector<Field> fields = type->fields();
FieldSectionType section = FieldSectionType::kNoSection;
......
......@@ -758,7 +758,8 @@ class WasmExceptionTag : public Struct {
DECL_PRINTER(WasmExceptionTag)
DECL_VERIFIER(WasmExceptionTag)
DEFINE_FIELD_OFFSET_CONSTANTS(Struct::kHeaderSize, WASM_EXCEPTION_TAG_FIELDS)
DEFINE_FIELD_OFFSET_CONSTANTS(Struct::kHeaderSize,
TORQUE_GENERATED_WASM_EXCEPTION_TAG_FIELDS)
OBJECT_CONSTRUCTORS(WasmExceptionTag, Struct);
};
......
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