Commit 9933cbe9 authored by Shu-yu Guo's avatar Shu-yu Guo Committed by Commit Bot

[weakrefs] Support Cast<JSFinalizationRegistry> in Torque

Bug: v8:8179
Change-Id: I443024e663ebece4465cb58687b49a37624c6bbf
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2129274
Commit-Queue: Shu-yu Guo <syg@chromium.org>
Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66998}
parent 7d955faa
......@@ -12,6 +12,7 @@ extern macro IsMap(HeapObject): bool;
extern macro IsJSFunction(HeapObject): bool;
extern macro IsJSBoundFunction(HeapObject): bool;
extern macro IsJSObject(HeapObject): bool;
extern macro IsJSFinalizationRegistry(HeapObject): bool;
extern macro IsJSPromise(HeapObject): bool;
extern macro IsJSTypedArray(HeapObject): bool;
extern macro IsNumberDictionary(HeapObject): bool;
......@@ -733,6 +734,14 @@ Cast<JSPromise>(o: HeapObject): JSPromise labels CastError {
goto CastError;
}
Cast<JSFinalizationRegistry>(o: HeapObject):
JSFinalizationRegistry labels CastError {
if (IsJSFinalizationRegistry(o)) {
return %RawDownCast<JSFinalizationRegistry>(o);
}
goto CastError;
}
UnsafeCast<RegExpMatchInfo>(implicit context: Context)(o: Object):
RegExpMatchInfo {
assert(Is<FixedArray>(o));
......
......@@ -5988,6 +5988,16 @@ TNode<BoolT> CodeStubAssembler::IsJSObject(SloppyTNode<HeapObject> object) {
return IsJSObjectMap(LoadMap(object));
}
TNode<BoolT> CodeStubAssembler::IsJSFinalizationRegistryMap(TNode<Map> map) {
return InstanceTypeEqual(LoadMapInstanceType(map),
JS_FINALIZATION_REGISTRY_TYPE);
}
TNode<BoolT> CodeStubAssembler::IsJSFinalizationRegistry(
TNode<HeapObject> object) {
return IsJSFinalizationRegistryMap(LoadMap(object));
}
TNode<BoolT> CodeStubAssembler::IsJSPromiseMap(SloppyTNode<Map> map) {
CSA_ASSERT(this, IsMap(map));
return InstanceTypeEqual(LoadMapInstanceType(map), JS_PROMISE_TYPE);
......
......@@ -2565,6 +2565,8 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
TNode<BoolT> IsJSObjectInstanceType(SloppyTNode<Int32T> instance_type);
TNode<BoolT> IsJSObjectMap(SloppyTNode<Map> map);
TNode<BoolT> IsJSObject(SloppyTNode<HeapObject> object);
TNode<BoolT> IsJSFinalizationRegistryMap(TNode<Map> map);
TNode<BoolT> IsJSFinalizationRegistry(TNode<HeapObject> object);
TNode<BoolT> IsJSPromiseMap(SloppyTNode<Map> map);
TNode<BoolT> IsJSPromise(SloppyTNode<HeapObject> object);
TNode<BoolT> IsJSProxy(SloppyTNode<HeapObject> object);
......
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