[builtins] Set exception predictions during builtins set up
Change-Id: I622c3aca07580051c84c86cf895c23af70c11294 Reviewed-on: https://chromium-review.googlesource.com/453021 Reviewed-by: Caitlin Potter <caitp@igalia.com> Reviewed-by: Jakob Gruber <jgruber@chromium.org> Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org> Cr-Commit-Position: refs/heads/master@{#43796}
This commit is contained in:
parent
a75f7cd344
commit
399c1c18c8
@ -1994,10 +1994,6 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
|
||||
}
|
||||
|
||||
{ // -- P r o m i s e
|
||||
// Set catch prediction
|
||||
Handle<Code> promise_code = isolate->builtins()->PromiseConstructor();
|
||||
promise_code->set_is_promise_rejection(true);
|
||||
|
||||
Handle<JSObject> prototype =
|
||||
factory->NewJSObject(isolate->object_function(), TENURED);
|
||||
Handle<JSFunction> promise_fun =
|
||||
@ -2036,7 +2032,6 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
|
||||
|
||||
SimpleInstallFunction(promise_fun, "resolve", Builtins::kPromiseResolve, 1,
|
||||
true, DONT_ENUM);
|
||||
isolate->builtins()->PromiseResolve()->set_is_promise_rejection(true);
|
||||
|
||||
SimpleInstallFunction(promise_fun, "reject", Builtins::kPromiseReject, 1,
|
||||
true, DONT_ENUM);
|
||||
@ -2072,7 +2067,6 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
|
||||
function->shared()->set_native(false);
|
||||
InstallWithIntrinsicDefaultProto(isolate, function,
|
||||
Context::PROMISE_RESOLVE_INDEX);
|
||||
isolate->builtins()->ResolvePromise()->set_is_promise_rejection(true);
|
||||
}
|
||||
|
||||
{ // Internal: PromiseHandle
|
||||
@ -2080,9 +2074,6 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
|
||||
isolate, factory->empty_string(), Builtins::kPromiseHandle, 5, false);
|
||||
InstallWithIntrinsicDefaultProto(isolate, function,
|
||||
Context::PROMISE_HANDLE_INDEX);
|
||||
// Set up catch prediction
|
||||
Handle<Code> promise_handle = isolate->builtins()->PromiseHandle();
|
||||
promise_handle->set_is_promise_rejection(true);
|
||||
}
|
||||
|
||||
{ // Internal: PromiseHandleReject
|
||||
@ -2091,9 +2082,6 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
|
||||
Builtins::kPromiseHandleReject, 3, false);
|
||||
InstallWithIntrinsicDefaultProto(isolate, function,
|
||||
Context::PROMISE_HANDLE_REJECT_INDEX);
|
||||
// Set up catch prediction
|
||||
Handle<Code> promise_handle = isolate->builtins()->PromiseHandleReject();
|
||||
promise_handle->set_is_exception_caught(true);
|
||||
}
|
||||
|
||||
{ // Internal: InternalPromiseReject
|
||||
@ -2109,7 +2097,6 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
|
||||
Handle<Code> code =
|
||||
handle(isolate->builtins()->builtin(Builtins::kPromiseResolveClosure),
|
||||
isolate);
|
||||
code->set_is_promise_rejection(true);
|
||||
Handle<SharedFunctionInfo> info =
|
||||
factory->NewSharedFunctionInfo(factory->empty_string(), code, false);
|
||||
info->set_internal_formal_parameter_count(1);
|
||||
@ -3534,8 +3521,6 @@ void Bootstrapper::ExportFromRuntime(Isolate* isolate,
|
||||
Handle<JSFunction> function =
|
||||
SimpleCreateFunction(isolate, factory->empty_string(),
|
||||
Builtins::kAsyncFunctionAwaitCaught, 3, false);
|
||||
isolate->builtins()->AsyncFunctionAwaitCaught()->set_is_promise_rejection(
|
||||
true);
|
||||
InstallWithIntrinsicDefaultProto(
|
||||
isolate, function, Context::ASYNC_FUNCTION_AWAIT_CAUGHT_INDEX);
|
||||
}
|
||||
@ -3544,9 +3529,6 @@ void Bootstrapper::ExportFromRuntime(Isolate* isolate,
|
||||
Handle<JSFunction> function =
|
||||
SimpleCreateFunction(isolate, factory->empty_string(),
|
||||
Builtins::kAsyncFunctionAwaitUncaught, 3, false);
|
||||
isolate->builtins()
|
||||
->AsyncFunctionAwaitUncaught()
|
||||
->set_is_promise_rejection(true);
|
||||
InstallWithIntrinsicDefaultProto(
|
||||
isolate, function, Context::ASYNC_FUNCTION_AWAIT_UNCAUGHT_INDEX);
|
||||
}
|
||||
|
@ -168,11 +168,17 @@ void Builtins::SetUp(Isolate* isolate, bool create_heap_objects) {
|
||||
Code::cast(builtins_[i])->set_builtin_index(i);
|
||||
}
|
||||
|
||||
#define EXCEPTION_PREDICTION(Name, type) \
|
||||
Code::cast(builtins_[k##Name])->set_##type(true);
|
||||
#define SET_PROMISE_REJECTION_PREDICTION(Name) \
|
||||
Code::cast(builtins_[k##Name])->set_is_promise_rejection(true);
|
||||
|
||||
BUILTIN_EXCEPTION_PREDICTION_LIST(EXCEPTION_PREDICTION)
|
||||
#undef EXCEPTION_PREDICTION
|
||||
BUILTIN_PROMISE_REJECTION_PREDICTION_LIST(SET_PROMISE_REJECTION_PREDICTION)
|
||||
#undef SET_PROMISE_REJECTION_PREDICTION
|
||||
|
||||
#define SET_EXCEPTION_CAUGHT_PREDICTION(Name) \
|
||||
Code::cast(builtins_[k##Name])->set_is_exception_caught(true);
|
||||
|
||||
BUILTIN_EXCEPTION_CAUGHT_PREDICTION_LIST(SET_EXCEPTION_CAUGHT_PREDICTION)
|
||||
#undef SET_EXCEPTION_CAUGHT_PREDICTION
|
||||
}
|
||||
|
||||
// Mark as initialized.
|
||||
|
@ -865,10 +865,19 @@ class Isolate;
|
||||
/* proposal-async-iteration/#sec-async-iterator-value-unwrap-functions */ \
|
||||
TFJ(AsyncIteratorValueUnwrap, 1)
|
||||
|
||||
#define BUILTIN_EXCEPTION_PREDICTION_LIST(V) \
|
||||
V(AsyncFromSyncIteratorPrototypeNext, is_promise_rejection) \
|
||||
V(AsyncFromSyncIteratorPrototypeReturn, is_promise_rejection) \
|
||||
V(AsyncFromSyncIteratorPrototypeThrow, is_promise_rejection)
|
||||
#define BUILTIN_PROMISE_REJECTION_PREDICTION_LIST(V) \
|
||||
V(AsyncFromSyncIteratorPrototypeNext) \
|
||||
V(AsyncFromSyncIteratorPrototypeReturn) \
|
||||
V(AsyncFromSyncIteratorPrototypeThrow) \
|
||||
V(AsyncFunctionAwaitCaught) \
|
||||
V(AsyncFunctionAwaitUncaught) \
|
||||
V(PromiseConstructor) \
|
||||
V(PromiseHandle) \
|
||||
V(PromiseResolve) \
|
||||
V(PromiseResolveClosure) \
|
||||
V(ResolvePromise)
|
||||
|
||||
#define BUILTIN_EXCEPTION_CAUGHT_PREDICTION_LIST(V) V(PromiseHandleReject)
|
||||
|
||||
#define IGNORE_BUILTIN(...)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user