Commit e41f0580 authored by Darius M's avatar Darius M Committed by V8 LUCI CQ

[compiler] Add ObjectRef::IsCodeT and ObjectRef::AsCodeT

Change-Id: I951bdf428a7429b3500757ae3fcfb029c814001a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3845631Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Commit-Queue: Darius Mercadier <dmercadier@chromium.org>
Cr-Commit-Position: refs/heads/main@{#82669}
parent 75beca72
...@@ -1037,6 +1037,22 @@ ObjectData* JSHeapBroker::TryGetOrCreateData(Handle<Object> object, ...@@ -1037,6 +1037,22 @@ ObjectData* JSHeapBroker::TryGetOrCreateData(Handle<Object> object,
HEAP_BROKER_OBJECT_LIST(DEFINE_IS_AND_AS) HEAP_BROKER_OBJECT_LIST(DEFINE_IS_AND_AS)
#undef DEFINE_IS_AND_AS #undef DEFINE_IS_AND_AS
bool ObjectRef::IsCodeT() const {
#ifdef V8_EXTERNAL_CODE_SPACE
return IsCodeDataContainer();
#else
return IsCode();
#endif
}
CodeTRef ObjectRef::AsCodeT() const {
#ifdef V8_EXTERNAL_CODE_SPACE
return AsCodeDataContainer();
#else
return AsCode();
#endif
}
bool ObjectRef::IsSmi() const { return data()->is_smi(); } bool ObjectRef::IsSmi() const { return data()->is_smi(); }
int ObjectRef::AsSmi() const { int ObjectRef::AsSmi() const {
......
...@@ -237,6 +237,14 @@ class V8_EXPORT_PRIVATE ObjectRef { ...@@ -237,6 +237,14 @@ class V8_EXPORT_PRIVATE ObjectRef {
HEAP_BROKER_OBJECT_LIST(HEAP_AS_METHOD_DECL) HEAP_BROKER_OBJECT_LIST(HEAP_AS_METHOD_DECL)
#undef HEAP_AS_METHOD_DECL #undef HEAP_AS_METHOD_DECL
// CodeT is defined as an alias to either CodeDataContainer or Code, depending
// on the architecture. We can't put it in HEAP_BROKER_OBJECT_LIST, because
// this list already contains CodeDataContainer and Code. Still, defining
// IsCodeT and AsCodeT is useful to write code that is independent of
// V8_EXTERNAL_CODE_SPACE.
bool IsCodeT() const;
CodeTRef AsCodeT() const;
bool IsNull() const; bool IsNull() const;
bool IsNullOrUndefined() const; bool IsNullOrUndefined() const;
bool IsTheHole() const; bool IsTheHole() const;
......
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