Index: src/code-stub-assembler.cc |
diff --git a/src/code-stub-assembler.cc b/src/code-stub-assembler.cc |
index c6d79716a57a827279d3700c7c26e6ea72e8cafa..11568bf29b8f7a22c02b60af568d12fcee9f2975 100644 |
--- a/src/code-stub-assembler.cc |
+++ b/src/code-stub-assembler.cc |
@@ -8245,5 +8245,29 @@ Node* CodeStubAssembler::IsPromiseHookEnabled() { |
return WordNotEqual(is_promisehook_enabled, Int32Constant(0)); |
} |
+Node* CodeStubAssembler::AllocateJSPromise(Node* context) { |
+ Node* const native_context = LoadNativeContext(context); |
+ Node* const promise_fun = |
+ LoadContextElement(native_context, Context::PROMISE_FUNCTION_INDEX); |
+ Node* const initial_map = |
+ LoadObjectField(promise_fun, JSFunction::kPrototypeOrInitialMapOffset); |
+ Node* const instance = AllocateJSObjectFromMap(initial_map); |
+ |
+ return instance; |
+} |
+ |
+void CodeStubAssembler::PromiseInit(Node* promise) { |
+ StoreObjectField(promise, JSPromise::kStatusOffset, |
+ SmiConstant(kPromisePending)); |
+ StoreObjectField(promise, JSPromise::kFlagsOffset, SmiConstant(0)); |
+} |
+ |
+void CodeStubAssembler::PromiseSet(Node* promise, Node* status, Node* result) { |
+ CSA_ASSERT(this, TaggedIsSmi(status)); |
+ StoreObjectField(promise, JSPromise::kStatusOffset, status); |
+ StoreObjectField(promise, JSPromise::kResultOffset, result); |
+ StoreObjectField(promise, JSPromise::kFlagsOffset, SmiConstant(0)); |
+} |
+ |
} // namespace internal |
} // namespace v8 |