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

Side by Side Diff: src/code-stub-assembler.cc

Issue 2589113002: [api] add API for Promise status and result. (Closed)
Patch Set: addressed 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 unified diff | Download patch
« no previous file with comments | « src/builtins/builtins-promise.cc ('k') | src/counters.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 #include "src/code-stub-assembler.h" 4 #include "src/code-stub-assembler.h"
5 #include "src/code-factory.h" 5 #include "src/code-factory.h"
6 #include "src/frames-inl.h" 6 #include "src/frames-inl.h"
7 #include "src/frames.h" 7 #include "src/frames.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
(...skipping 8322 matching lines...) Expand 10 before | Expand all | Expand 10 after
8333 LoadContextElement(native_context, Context::PROMISE_FUNCTION_INDEX); 8333 LoadContextElement(native_context, Context::PROMISE_FUNCTION_INDEX);
8334 Node* const initial_map = 8334 Node* const initial_map =
8335 LoadObjectField(promise_fun, JSFunction::kPrototypeOrInitialMapOffset); 8335 LoadObjectField(promise_fun, JSFunction::kPrototypeOrInitialMapOffset);
8336 Node* const instance = AllocateJSObjectFromMap(initial_map); 8336 Node* const instance = AllocateJSObjectFromMap(initial_map);
8337 8337
8338 return instance; 8338 return instance;
8339 } 8339 }
8340 8340
8341 void CodeStubAssembler::PromiseInit(Node* promise) { 8341 void CodeStubAssembler::PromiseInit(Node* promise) {
8342 StoreObjectField(promise, JSPromise::kStatusOffset, 8342 StoreObjectField(promise, JSPromise::kStatusOffset,
8343 SmiConstant(kPromisePending)); 8343 SmiConstant(v8::Promise::kPending));
8344 StoreObjectField(promise, JSPromise::kFlagsOffset, SmiConstant(0)); 8344 StoreObjectField(promise, JSPromise::kFlagsOffset, SmiConstant(0));
8345 } 8345 }
8346 8346
8347 void CodeStubAssembler::PromiseSet(Node* promise, Node* status, Node* result) { 8347 void CodeStubAssembler::PromiseSet(Node* promise, Node* status, Node* result) {
8348 CSA_ASSERT(this, TaggedIsSmi(status)); 8348 CSA_ASSERT(this, TaggedIsSmi(status));
8349 StoreObjectField(promise, JSPromise::kStatusOffset, status); 8349 StoreObjectField(promise, JSPromise::kStatusOffset, status);
8350 StoreObjectField(promise, JSPromise::kResultOffset, result); 8350 StoreObjectField(promise, JSPromise::kResultOffset, result);
8351 StoreObjectField(promise, JSPromise::kFlagsOffset, SmiConstant(0)); 8351 StoreObjectField(promise, JSPromise::kFlagsOffset, SmiConstant(0));
8352 } 8352 }
8353 8353
(...skipping 13 matching lines...) Expand all
8367 Heap::kUndefinedValueRootIndex); 8367 Heap::kUndefinedValueRootIndex);
8368 StoreObjectFieldRoot(result, PromiseReactionJobInfo::kDebugNameOffset, 8368 StoreObjectFieldRoot(result, PromiseReactionJobInfo::kDebugNameOffset,
8369 Heap::kUndefinedValueRootIndex); 8369 Heap::kUndefinedValueRootIndex);
8370 StoreObjectFieldNoWriteBarrier(result, PromiseReactionJobInfo::kContextOffset, 8370 StoreObjectFieldNoWriteBarrier(result, PromiseReactionJobInfo::kContextOffset,
8371 context); 8371 context);
8372 return result; 8372 return result;
8373 } 8373 }
8374 8374
8375 } // namespace internal 8375 } // namespace internal
8376 } // namespace v8 8376 } // namespace v8
OLDNEW
« no previous file with comments | « src/builtins/builtins-promise.cc ('k') | src/counters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698