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

Unified Diff: src/bootstrapper.cc

Issue 2541283002: [promises] Port ResolvePromise to TF (Closed)
Patch Set: add comments 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') | src/builtins/builtins-promise.cc » ('J')
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 ed57b11dd03c3fecec4132a3978d94ec46df7e9e..c830bdbf88b5219f846c0c35edb0ee87058dbfb5 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -1816,9 +1816,25 @@ 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,
+ Handle<JSFunction> promise_then =
+ SimpleCreateFunction(isolate, isolate->factory()->then_string(),
+ Builtins::kPromiseThen, 2, true);
+ JSObject::AddProperty(prototype, isolate->factory()->then_string(),
+ promise_then, DONT_ENUM);
+ InstallWithIntrinsicDefaultProto(isolate, promise_then,
+ Context::PROMISE_THEN_INDEX);
+
+ // TODO(gsathya): Move to TF
+ SimpleInstallFunction(prototype, "catch", Builtins::kIllegal, 1, true,
DONT_ENUM);
+ Handle<Map> prototype_map(prototype->map());
+ Map::SetShouldBeFastPrototypeMap(prototype_map, true, isolate);
+
+ // Store the initial Promise.prototype map. This is used in fast-path
+ // checks. Do not alter the prototype after this point.
+ native_context()->set_promise_prototype_map(*prototype_map);
+
{ // Internal: PromiseInternalConstructor
Handle<JSFunction> function =
SimpleCreateFunction(isolate, factory->empty_string(),
@@ -1850,6 +1866,14 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
Context::PERFORM_PROMISE_THEN_INDEX);
}
+ { // Internal: ResolvePromise
+ Handle<JSFunction> function =
+ SimpleCreateFunction(isolate, factory->empty_string(),
+ Builtins::kResolvePromise, 2, false);
+ InstallWithIntrinsicDefaultProto(isolate, function,
+ Context::RESOLVE_PROMISE_INDEX);
+ }
+
{
Handle<Code> code =
handle(isolate->builtins()->builtin(Builtins::kPromiseResolveClosure),
« no previous file with comments | « no previous file | src/builtins/builtins.h » ('j') | src/builtins/builtins-promise.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698