Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(311)

Unified Diff: src/bootstrapper.cc

Issue 2536463002: Create JSPromise (Closed)
Patch Set: rebase Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/builtins/builtins.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/bootstrapper.cc
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc
index 98f709c4f4b8987013d74a08c51528a7701e38d2..47d7eb83ba393c90257bce7755e19dcbd2bca278 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -1795,9 +1795,9 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
Handle<JSObject> prototype =
factory->NewJSObject(isolate->object_function(), TENURED);
- Handle<JSFunction> promise_fun = InstallFunction(
- global, "Promise", JS_PROMISE_TYPE, JSObject::kHeaderSize, prototype,
- Builtins::kPromiseConstructor);
+ Handle<JSFunction> promise_fun =
+ InstallFunction(global, "Promise", JS_PROMISE_TYPE, JSPromise::kSize,
+ prototype, Builtins::kPromiseConstructor);
InstallWithIntrinsicDefaultProto(isolate, promise_fun,
Context::PROMISE_FUNCTION_INDEX);
@@ -1816,6 +1816,9 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
prototype, factory->to_string_tag_symbol(), factory->Promise_string(),
static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY));
+ SimpleInstallFunction(prototype, "then", Builtins::kPromiseThen, 2, true,
+ DONT_ENUM);
+
{ // Internal: PromiseInternalConstructor
Handle<JSFunction> function =
SimpleCreateFunction(isolate, factory->empty_string(),
@@ -1824,6 +1827,14 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
isolate, function, Context::PROMISE_INTERNAL_CONSTRUCTOR_INDEX);
}
+ { // Internal: PromiseCreateAndSet
+ Handle<JSFunction> function =
+ SimpleCreateFunction(isolate, factory->empty_string(),
+ Builtins::kPromiseCreateAndSet, 2, false);
+ InstallWithIntrinsicDefaultProto(isolate, function,
+ Context::PROMISE_CREATE_AND_SET_INDEX);
+ }
+
{ // Internal: IsPromise
Handle<JSFunction> function = SimpleCreateFunction(
isolate, factory->empty_string(), Builtins::kIsPromise, 1, false);
@@ -1831,6 +1842,14 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
Context::IS_PROMISE_INDEX);
}
+ { // Internal: PerformPromiseThen
+ Handle<JSFunction> function =
+ SimpleCreateFunction(isolate, factory->empty_string(),
+ Builtins::kPerformPromiseThen, 4, false);
+ InstallWithIntrinsicDefaultProto(isolate, function,
+ Context::PERFORM_PROMISE_THEN_INDEX);
+ }
+
{
Handle<Code> code =
handle(isolate->builtins()->builtin(Builtins::kPromiseResolveClosure),
« no previous file with comments | « no previous file | src/builtins/builtins.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698