1// Copyright 2019 the V8 project authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5bitfield struct JSPromiseFlags extends uint31 { 6 status: PromiseState: 2 bit; 7 has_handler: bool: 1 bit; 8 handled_hint: bool: 1 bit; 9 is_silent: bool: 1 bit; 10 async_task_id: int32: 22 bit; 11} 12 13extern class JSPromise extends JSObjectWithEmbedderSlots { 14 macro Status(): PromiseState { 15 return this.flags.status; 16 } 17 18 macro SetStatus(status: constexpr PromiseState): void { 19 dcheck(this.Status() == PromiseState::kPending); 20 dcheck(status != PromiseState::kPending); 21 22 this.flags.status = status; 23 } 24 25 macro HasHandler(): bool { 26 return this.flags.has_handler; 27 } 28 29 macro SetHasHandler(): void { 30 this.flags.has_handler = true; 31 } 32 33 // Smi 0 terminated list of PromiseReaction objects in case the JSPromise was 34 // not settled yet, otherwise the result. 35 reactions_or_result: Zero|PromiseReaction|JSAny; 36 flags: SmiTagged<JSPromiseFlags>; 37} 38 39@doNotGenerateCast 40extern class JSPromiseConstructor extends JSFunction 41 generates 'TNode<JSFunction>'; 42