Commit 1f2d9475 authored by Irina Yatsenko's avatar Irina Yatsenko Committed by Commit Bot

Torquefy a few simple types

Creates Torque classes for JSProxy, JSAccessorPropertyDescriptor, JSCollection, JSProxyRevocableResult, JSValue

Change-Id: I01eec27b158b4beb778cb5efce44f241c09ef0f7
Reviewed-on: https://chromium-review.googlesource.com/c/1489184
Commit-Queue: Irina Yatsenko <irinayat@microsoft.com>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59921}
parent 95506041
...@@ -87,7 +87,6 @@ extern class JSReceiver extends HeapObject { ...@@ -87,7 +87,6 @@ extern class JSReceiver extends HeapObject {
} }
type Constructor extends JSReceiver; type Constructor extends JSReceiver;
type JSProxy extends JSReceiver generates 'TNode<JSProxy>';
extern class JSObject extends JSReceiver { elements: FixedArrayBase; } extern class JSObject extends JSReceiver { elements: FixedArrayBase; }
...@@ -103,6 +102,20 @@ macro NewJSObject(implicit context: Context)(): JSObject { ...@@ -103,6 +102,20 @@ macro NewJSObject(implicit context: Context)(): JSObject {
return new JSObject{map, kEmptyFixedArray, kEmptyFixedArray}; return new JSObject{map, kEmptyFixedArray, kEmptyFixedArray};
} }
extern class JSProxy extends JSReceiver {
target: Object;
handler: Object;
}
extern class JSProxyRevocableResult extends JSObject {
proxy: Object;
revoke: Object;
}
extern class JSGlobalProxy extends JSObject { native_context: Object; }
extern class JSValue extends JSObject { value: Object; }
extern class JSArgumentsObjectWithLength extends JSObject { length: Object; } extern class JSArgumentsObjectWithLength extends JSObject { length: Object; }
extern class JSArray extends JSObject { extern class JSArray extends JSObject {
...@@ -258,6 +271,15 @@ extern class JSTypedArray extends JSArrayBufferView { ...@@ -258,6 +271,15 @@ extern class JSTypedArray extends JSArrayBufferView {
length: Smi; length: Smi;
} }
extern class JSAccessorPropertyDescriptor extends JSObject {
get: Object;
set: Object;
enumerable: Object;
configurable: Object;
}
extern class JSCollection extends JSObject { table: Object; }
type JSDataView extends JSArrayBufferView generates 'TNode<JSDataView>'; type JSDataView extends JSArrayBufferView generates 'TNode<JSDataView>';
type InstanceType generates 'TNode<Int32T>' constexpr 'InstanceType'; type InstanceType generates 'TNode<Int32T>' constexpr 'InstanceType';
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "src/objects/data-handler.h" #include "src/objects/data-handler.h"
#include "src/objects/heap-number.h" #include "src/objects/heap-number.h"
#include "src/objects/js-array-buffer.h" #include "src/objects/js-array-buffer.h"
#include "src/objects/js-collection.h"
#include "src/objects/map.h" #include "src/objects/map.h"
#include "src/objects/maybe-object.h" #include "src/objects/maybe-object.h"
#include "src/objects/oddball.h" #include "src/objects/oddball.h"
......
...@@ -273,6 +273,7 @@ class JSAsyncGeneratorObject; ...@@ -273,6 +273,7 @@ class JSAsyncGeneratorObject;
class JSGlobalProxy; class JSGlobalProxy;
class JSPromise; class JSPromise;
class JSProxy; class JSProxy;
class JSProxyRevocableResult;
class KeyAccumulator; class KeyAccumulator;
class LayoutDescriptor; class LayoutDescriptor;
class LookupIterator; class LookupIterator;
......
...@@ -19,14 +19,8 @@ class JSCollection : public JSObject { ...@@ -19,14 +19,8 @@ class JSCollection : public JSObject {
// [table]: the backing hash table // [table]: the backing hash table
DECL_ACCESSORS(table, Object) DECL_ACCESSORS(table, Object)
// Layout description. // Layout description.
#define JS_COLLECTION_FIELDS(V) \ DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize, JSCOLLECTION_FIELDS)
V(kTableOffset, kTaggedSize) \
/* Header size. */ \
V(kSize, 0)
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize, JS_COLLECTION_FIELDS)
#undef JS_COLLECTION_FIELDS
static const int kAddFunctionDescriptorIndex = 3; static const int kAddFunctionDescriptorIndex = 3;
......
...@@ -832,17 +832,8 @@ class JSObject : public JSReceiver { ...@@ -832,17 +832,8 @@ class JSObject : public JSReceiver {
class JSAccessorPropertyDescriptor : public JSObject { class JSAccessorPropertyDescriptor : public JSObject {
public: public:
// Layout description. // Layout description.
#define JS_ACCESSOR_PROPERTY_DESCRIPTOR_FIELDS(V) \
V(kGetOffset, kTaggedSize) \
V(kSetOffset, kTaggedSize) \
V(kEnumerableOffset, kTaggedSize) \
V(kConfigurableOffset, kTaggedSize) \
/* Total size. */ \
V(kSize, 0)
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize, DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize,
JS_ACCESSOR_PROPERTY_DESCRIPTOR_FIELDS) JSACCESSOR_PROPERTY_DESCRIPTOR_FIELDS)
#undef JS_ACCESSOR_PROPERTY_DESCRIPTOR_FIELDS
// Indices of in-object properties. // Indices of in-object properties.
static const int kGetIndex = 0; static const int kGetIndex = 0;
...@@ -1168,13 +1159,7 @@ class JSGlobalProxy : public JSObject { ...@@ -1168,13 +1159,7 @@ class JSGlobalProxy : public JSObject {
DECL_VERIFIER(JSGlobalProxy) DECL_VERIFIER(JSGlobalProxy)
// Layout description. // Layout description.
#define JS_GLOBAL_PROXY_FIELDS(V) \ DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize, JSGLOBAL_PROXY_FIELDS)
V(kNativeContextOffset, kTaggedSize) \
/* Header size. */ \
V(kSize, 0)
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize, JS_GLOBAL_PROXY_FIELDS)
#undef JS_GLOBAL_PROXY_FIELDS
OBJECT_CONSTRUCTORS(JSGlobalProxy, JSObject); OBJECT_CONSTRUCTORS(JSGlobalProxy, JSObject);
}; };
...@@ -1234,13 +1219,7 @@ class JSValue : public JSObject { ...@@ -1234,13 +1219,7 @@ class JSValue : public JSObject {
DECL_VERIFIER(JSValue) DECL_VERIFIER(JSValue)
// Layout description. // Layout description.
#define JS_VALUE_FIELDS(V) \ DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize, JSVALUE_FIELDS)
V(kValueOffset, kTaggedSize) \
/* Header size. */ \
V(kSize, 0)
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize, JS_VALUE_FIELDS)
#undef JS_VALUE_FIELDS
OBJECT_CONSTRUCTORS(JSValue, JSObject); OBJECT_CONSTRUCTORS(JSValue, JSObject);
}; };
......
...@@ -106,14 +106,7 @@ class JSProxy : public JSReceiver { ...@@ -106,14 +106,7 @@ class JSProxy : public JSReceiver {
static const int kMaxIterationLimit = 100 * 1024; static const int kMaxIterationLimit = 100 * 1024;
// Layout description. // Layout description.
#define JS_PROXY_FIELDS(V) \ DEFINE_FIELD_OFFSET_CONSTANTS(JSReceiver::kHeaderSize, JSPROXY_FIELDS)
V(kTargetOffset, kTaggedSize) \
V(kHandlerOffset, kTaggedSize) \
/* Total size. */ \
V(kSize, 0)
DEFINE_FIELD_OFFSET_CONSTANTS(JSReceiver::kHeaderSize, JS_PROXY_FIELDS)
#undef JS_PROXY_FIELDS
// kTargetOffset aliases with the elements of JSObject. The fact that // kTargetOffset aliases with the elements of JSObject. The fact that
// JSProxy::target is a Javascript value which cannot be confused with an // JSProxy::target is a Javascript value which cannot be confused with an
...@@ -139,15 +132,8 @@ class JSProxy : public JSReceiver { ...@@ -139,15 +132,8 @@ class JSProxy : public JSReceiver {
class JSProxyRevocableResult : public JSObject { class JSProxyRevocableResult : public JSObject {
public: public:
// Layout description. // Layout description.
#define JS_PROXY_REVOCATABLE_RESULT_FIELDS(V) \
V(kProxyOffset, kTaggedSize) \
V(kRevokeOffset, kTaggedSize) \
/* Total size. */ \
V(kSize, 0)
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize, DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize,
JS_PROXY_REVOCATABLE_RESULT_FIELDS) JSPROXY_REVOCABLE_RESULT_FIELDS)
#undef JS_PROXY_REVOCATABLE_RESULT_FIELDS
// Indices of in-object properties. // Indices of in-object properties.
static const int kProxyIndex = 0; static const int kProxyIndex = 0;
......
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