Commit a1462d9f authored by Seth Brenith's avatar Seth Brenith Committed by Commit Bot

[torque] Get rid of @noVerifier annotation on PromiseReactionJobTask

Include API-instantiated functions in the definition of Callable so
that PromiseReactionJobTask::handler can verify correctly. Also make
Callable verification stricter regarding JSProxy instances: they must
have the callable bit set.

Also update test-weak-references to use a different object type, since
FeedbackVector::optimized_code_weak_or_smi should never point to a
FixedArray.

Bug: v8:9311
Change-Id: I4242df993e381a75f5b53302fee8fd2b12e96d34
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1650563
Commit-Queue: Seth Brenith <seth.brenith@microsoft.com>
Reviewed-by: 's avatarSigurd Schneider <sigurds@chromium.org>
Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62153}
parent ccb7ff75
...@@ -513,7 +513,7 @@ extern class PrototypeInfo extends Struct { ...@@ -513,7 +513,7 @@ extern class PrototypeInfo extends Struct {
prototype_users: WeakArrayList | Zero; prototype_users: WeakArrayList | Zero;
registry_slot: Smi; registry_slot: Smi;
validity_cell: Object; validity_cell: Object;
@noVerifier object_create_map: Smi | WeakArrayList; @noVerifier object_create_map: Map | Undefined;
bit_field: Smi; bit_field: Smi;
} }
...@@ -570,7 +570,17 @@ extern class JSBoundFunction extends JSObject { ...@@ -570,7 +570,17 @@ extern class JSBoundFunction extends JSObject {
bound_arguments: FixedArray; bound_arguments: FixedArray;
} }
type Callable = JSFunction | JSBoundFunction | JSProxy; // Specialized types. The following two type definitions don't correspond to
// actual C++ classes, but have Is... methods that check additional constraints.
// A function built with InstantiateFunction for the public API.
type CallableApiObject extends HeapObject;
// A JSProxy with the callable bit set.
type CallableJSProxy extends JSProxy;
type Callable =
JSFunction | JSBoundFunction | CallableJSProxy | CallableApiObject;
extern operator '.length_intptr' macro LoadAndUntagFixedArrayBaseLength( extern operator '.length_intptr' macro LoadAndUntagFixedArrayBaseLength(
FixedArrayBase): intptr; FixedArrayBase): intptr;
...@@ -1147,7 +1157,7 @@ extern class PromiseReaction extends Struct { ...@@ -1147,7 +1157,7 @@ extern class PromiseReaction extends Struct {
extern class PromiseReactionJobTask extends Microtask { extern class PromiseReactionJobTask extends Microtask {
argument: Object; argument: Object;
context: Context; context: Context;
@noVerifier handler: Callable | Undefined; handler: Callable | Undefined;
promise_or_capability: JSPromise | PromiseCapability | Undefined; promise_or_capability: JSPromise | PromiseCapability | Undefined;
} }
......
...@@ -1373,11 +1373,7 @@ void CallableTask::CallableTaskVerify(Isolate* isolate) { ...@@ -1373,11 +1373,7 @@ void CallableTask::CallableTaskVerify(Isolate* isolate) {
USE_TORQUE_VERIFIER(CallbackTask) USE_TORQUE_VERIFIER(CallbackTask)
void PromiseReactionJobTask::PromiseReactionJobTaskVerify(Isolate* isolate) { USE_TORQUE_VERIFIER(PromiseReactionJobTask)
TorqueGeneratedClassVerifiers::PromiseReactionJobTaskVerify(*this, isolate);
VerifyHeapPointer(isolate, handler());
CHECK(handler().IsUndefined(isolate) || handler().IsCallable());
}
USE_TORQUE_VERIFIER(PromiseFulfillReactionJobTask) USE_TORQUE_VERIFIER(PromiseFulfillReactionJobTask)
......
...@@ -3802,7 +3802,8 @@ Handle<Map> Factory::ObjectLiteralMapFromCache(Handle<NativeContext> context, ...@@ -3802,7 +3802,8 @@ Handle<Map> Factory::ObjectLiteralMapFromCache(Handle<NativeContext> context,
return map; return map;
} }
Handle<LoadHandler> Factory::NewLoadHandler(int data_count) { Handle<LoadHandler> Factory::NewLoadHandler(int data_count,
AllocationType allocation) {
Handle<Map> map; Handle<Map> map;
switch (data_count) { switch (data_count) {
case 1: case 1:
...@@ -3817,7 +3818,7 @@ Handle<LoadHandler> Factory::NewLoadHandler(int data_count) { ...@@ -3817,7 +3818,7 @@ Handle<LoadHandler> Factory::NewLoadHandler(int data_count) {
default: default:
UNREACHABLE(); UNREACHABLE();
} }
return handle(LoadHandler::cast(New(map, AllocationType::kOld)), isolate()); return handle(LoadHandler::cast(New(map, allocation)), isolate());
} }
Handle<StoreHandler> Factory::NewStoreHandler(int data_count) { Handle<StoreHandler> Factory::NewStoreHandler(int data_count) {
......
...@@ -892,7 +892,8 @@ class V8_EXPORT_PRIVATE Factory { ...@@ -892,7 +892,8 @@ class V8_EXPORT_PRIVATE Factory {
Handle<Map> ObjectLiteralMapFromCache(Handle<NativeContext> native_context, Handle<Map> ObjectLiteralMapFromCache(Handle<NativeContext> native_context,
int number_of_properties); int number_of_properties);
Handle<LoadHandler> NewLoadHandler(int data_count); Handle<LoadHandler> NewLoadHandler(
int data_count, AllocationType allocation = AllocationType::kOld);
Handle<StoreHandler> NewStoreHandler(int data_count); Handle<StoreHandler> NewStoreHandler(int data_count);
Handle<RegExpMatchInfo> NewRegExpMatchInfo(); Handle<RegExpMatchInfo> NewRegExpMatchInfo();
......
...@@ -249,9 +249,16 @@ class ZoneForwardList; ...@@ -249,9 +249,16 @@ class ZoneForwardList;
#define HEAP_OBJECT_TEMPLATE_TYPE_LIST(V) V(HashTable) #define HEAP_OBJECT_TEMPLATE_TYPE_LIST(V) V(HashTable)
// Logical sub-types of heap objects that don't correspond to a C++ class but
// represent some specialization in terms of additional constraints.
#define HEAP_OBJECT_SPECIALIZED_TYPE_LIST(V) \
V(CallableApiObject) \
V(CallableJSProxy)
#define HEAP_OBJECT_TYPE_LIST(V) \ #define HEAP_OBJECT_TYPE_LIST(V) \
HEAP_OBJECT_ORDINARY_TYPE_LIST(V) \ HEAP_OBJECT_ORDINARY_TYPE_LIST(V) \
HEAP_OBJECT_TEMPLATE_TYPE_LIST(V) HEAP_OBJECT_TEMPLATE_TYPE_LIST(V) \
HEAP_OBJECT_SPECIALIZED_TYPE_LIST(V)
#define ODDBALL_LIST(V) \ #define ODDBALL_LIST(V) \
V(Undefined, undefined_value) \ V(Undefined, undefined_value) \
......
...@@ -152,6 +152,16 @@ bool HeapObject::IsFunction() const { ...@@ -152,6 +152,16 @@ bool HeapObject::IsFunction() const {
bool HeapObject::IsCallable() const { return map().is_callable(); } bool HeapObject::IsCallable() const { return map().is_callable(); }
bool HeapObject::IsCallableJSProxy() const {
return IsCallable() && IsJSProxy();
}
bool HeapObject::IsCallableApiObject() const {
InstanceType type = map().instance_type();
return IsCallable() &&
(type == JS_API_OBJECT_TYPE || type == JS_SPECIAL_API_OBJECT_TYPE);
}
bool HeapObject::IsConstructor() const { return map().is_constructor(); } bool HeapObject::IsConstructor() const { return map().is_constructor(); }
bool HeapObject::IsModuleInfo() const { bool HeapObject::IsModuleInfo() const {
......
This diff is collapsed.
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