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

Side by Side Diff: src/objects.h

Issue 2590563003: [promises] Remove deferred object (Closed)
Patch Set: rebase Created 3 years, 11 months 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/js/promise.js ('k') | src/objects-debug.cc » ('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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 4
5 #ifndef V8_OBJECTS_H_ 5 #ifndef V8_OBJECTS_H_
6 #define V8_OBJECTS_H_ 6 #define V8_OBJECTS_H_
7 7
8 #include <iosfwd> 8 #include <iosfwd>
9 #include <memory> 9 #include <memory>
10 10
(...skipping 6568 matching lines...) Expand 10 before | Expand all | Expand 10 after
6579 }; 6579 };
6580 6580
6581 class JSPromise; 6581 class JSPromise;
6582 6582
6583 // Struct to hold state required for PromiseReactionJob. 6583 // Struct to hold state required for PromiseReactionJob.
6584 class PromiseReactionJobInfo : public Struct { 6584 class PromiseReactionJobInfo : public Struct {
6585 public: 6585 public:
6586 DECL_ACCESSORS(promise, JSPromise) 6586 DECL_ACCESSORS(promise, JSPromise)
6587 DECL_ACCESSORS(value, Object) 6587 DECL_ACCESSORS(value, Object)
6588 DECL_ACCESSORS(tasks, Object) 6588 DECL_ACCESSORS(tasks, Object)
6589 DECL_ACCESSORS(deferred, Object) 6589
6590 // Check comment in JSPromise for information on what state these
6591 // deferred fields could be in.
6592 DECL_ACCESSORS(deferred_promise, Object)
6593 DECL_ACCESSORS(deferred_on_resolve, Object)
6594 DECL_ACCESSORS(deferred_on_reject, Object)
6590 DECL_ACCESSORS(debug_id, Object) 6595 DECL_ACCESSORS(debug_id, Object)
6591 DECL_ACCESSORS(debug_name, Object) 6596 DECL_ACCESSORS(debug_name, Object)
6592 DECL_ACCESSORS(context, Context) 6597 DECL_ACCESSORS(context, Context)
6593 6598
6594 static const int kPromiseOffset = Struct::kHeaderSize; 6599 static const int kPromiseOffset = Struct::kHeaderSize;
6595 static const int kValueOffset = kPromiseOffset + kPointerSize; 6600 static const int kValueOffset = kPromiseOffset + kPointerSize;
6596 static const int kTasksOffset = kValueOffset + kPointerSize; 6601 static const int kTasksOffset = kValueOffset + kPointerSize;
6597 static const int kDeferredOffset = kTasksOffset + kPointerSize; 6602 static const int kDeferredPromiseOffset = kTasksOffset + kPointerSize;
6598 static const int kDebugIdOffset = kDeferredOffset + kPointerSize; 6603 static const int kDeferredOnResolveOffset =
6604 kDeferredPromiseOffset + kPointerSize;
6605 static const int kDeferredOnRejectOffset =
6606 kDeferredOnResolveOffset + kPointerSize;
6607 static const int kDebugIdOffset = kDeferredOnRejectOffset + kPointerSize;
6599 static const int kDebugNameOffset = kDebugIdOffset + kPointerSize; 6608 static const int kDebugNameOffset = kDebugIdOffset + kPointerSize;
6600 static const int kContextOffset = kDebugNameOffset + kPointerSize; 6609 static const int kContextOffset = kDebugNameOffset + kPointerSize;
6601 static const int kSize = kContextOffset + kPointerSize; 6610 static const int kSize = kContextOffset + kPointerSize;
6602 6611
6603 DECLARE_CAST(PromiseReactionJobInfo) 6612 DECLARE_CAST(PromiseReactionJobInfo)
6604 DECLARE_PRINTER(PromiseReactionJobInfo) 6613 DECLARE_PRINTER(PromiseReactionJobInfo)
6605 DECLARE_VERIFIER(PromiseReactionJobInfo) 6614 DECLARE_VERIFIER(PromiseReactionJobInfo)
6606 6615
6607 private: 6616 private:
6608 DISALLOW_IMPLICIT_CONSTRUCTORS(PromiseReactionJobInfo); 6617 DISALLOW_IMPLICIT_CONSTRUCTORS(PromiseReactionJobInfo);
(...skipping 2020 matching lines...) Expand 10 before | Expand all | Expand 10 after
8629 kSize> BodyDescriptor; 8638 kSize> BodyDescriptor;
8630 }; 8639 };
8631 8640
8632 class JSPromise : public JSObject { 8641 class JSPromise : public JSObject {
8633 public: 8642 public:
8634 DECL_INT_ACCESSORS(status) 8643 DECL_INT_ACCESSORS(status)
8635 DECL_ACCESSORS(result, Object) 8644 DECL_ACCESSORS(result, Object)
8636 8645
8637 // There are 3 possible states for these fields -- 8646 // There are 3 possible states for these fields --
8638 // 1) Undefined -- This is the zero state when there is no callback 8647 // 1) Undefined -- This is the zero state when there is no callback
8639 // or deferred registered. 8648 // or deferred fields registered.
8649 //
8640 // 2) Object -- There is a single Callable directly attached to the 8650 // 2) Object -- There is a single Callable directly attached to the
8641 // fulfill_reactions, reject_reactions and the deferred JSObject is 8651 // fulfill_reactions, reject_reactions and the deferred fields are
8642 // directly attached to the deferred field. 8652 // directly attached to the slots. In this state, deferred_promise
8653 // is a JSReceiver and deferred_on_{resolve, reject} are Callables.
8654 //
8643 // 3) FixedArray -- There is more than one callback and deferred 8655 // 3) FixedArray -- There is more than one callback and deferred
8644 // attached to a FixedArray. 8656 // fields attached to a FixedArray.
8645 DECL_ACCESSORS(deferred, Object) 8657 DECL_ACCESSORS(deferred_promise, Object)
8658 DECL_ACCESSORS(deferred_on_resolve, Object)
8659 DECL_ACCESSORS(deferred_on_reject, Object)
8646 DECL_ACCESSORS(fulfill_reactions, Object) 8660 DECL_ACCESSORS(fulfill_reactions, Object)
8647 DECL_ACCESSORS(reject_reactions, Object) 8661 DECL_ACCESSORS(reject_reactions, Object)
8648 8662
8649 DECL_INT_ACCESSORS(flags) 8663 DECL_INT_ACCESSORS(flags)
8650 8664
8651 // [has_handler]: Whether this promise has a reject handler or not. 8665 // [has_handler]: Whether this promise has a reject handler or not.
8652 DECL_BOOLEAN_ACCESSORS(has_handler) 8666 DECL_BOOLEAN_ACCESSORS(has_handler)
8653 8667
8654 // [handled_hint]: Whether this promise will be handled by a catch 8668 // [handled_hint]: Whether this promise will be handled by a catch
8655 // block in an async function. 8669 // block in an async function.
8656 DECL_BOOLEAN_ACCESSORS(handled_hint) 8670 DECL_BOOLEAN_ACCESSORS(handled_hint)
8657 8671
8658 static const char* Status(int status); 8672 static const char* Status(int status);
8659 8673
8660 DECLARE_CAST(JSPromise) 8674 DECLARE_CAST(JSPromise)
8661 8675
8662 // Dispatched behavior. 8676 // Dispatched behavior.
8663 DECLARE_PRINTER(JSPromise) 8677 DECLARE_PRINTER(JSPromise)
8664 DECLARE_VERIFIER(JSPromise) 8678 DECLARE_VERIFIER(JSPromise)
8665 8679
8666 // Layout description. 8680 // Layout description.
8667 static const int kStatusOffset = JSObject::kHeaderSize; 8681 static const int kStatusOffset = JSObject::kHeaderSize;
8668 static const int kResultOffset = kStatusOffset + kPointerSize; 8682 static const int kResultOffset = kStatusOffset + kPointerSize;
8669 static const int kDeferredOffset = kResultOffset + kPointerSize; 8683 static const int kDeferredPromiseOffset = kResultOffset + kPointerSize;
8670 static const int kFulfillReactionsOffset = kDeferredOffset + kPointerSize; 8684 static const int kDeferredOnResolveOffset =
8685 kDeferredPromiseOffset + kPointerSize;
8686 static const int kDeferredOnRejectOffset =
8687 kDeferredOnResolveOffset + kPointerSize;
8688 static const int kFulfillReactionsOffset =
8689 kDeferredOnRejectOffset + kPointerSize;
8671 static const int kRejectReactionsOffset = 8690 static const int kRejectReactionsOffset =
8672 kFulfillReactionsOffset + kPointerSize; 8691 kFulfillReactionsOffset + kPointerSize;
8673 static const int kFlagsOffset = kRejectReactionsOffset + kPointerSize; 8692 static const int kFlagsOffset = kRejectReactionsOffset + kPointerSize;
8674 static const int kSize = kFlagsOffset + kPointerSize; 8693 static const int kSize = kFlagsOffset + kPointerSize;
8675 8694
8676 // Flags layout. 8695 // Flags layout.
8677 static const int kHasHandlerBit = 0; 8696 static const int kHasHandlerBit = 0;
8678 static const int kHandledHintBit = 1; 8697 static const int kHandledHintBit = 1;
8679 }; 8698 };
8680 8699
(...skipping 3020 matching lines...) Expand 10 before | Expand all | Expand 10 after
11701 } 11720 }
11702 }; 11721 };
11703 11722
11704 11723
11705 } // NOLINT, false-positive due to second-order macros. 11724 } // NOLINT, false-positive due to second-order macros.
11706 } // NOLINT, false-positive due to second-order macros. 11725 } // NOLINT, false-positive due to second-order macros.
11707 11726
11708 #include "src/objects/object-macros-undef.h" 11727 #include "src/objects/object-macros-undef.h"
11709 11728
11710 #endif // V8_OBJECTS_H_ 11729 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/js/promise.js ('k') | src/objects-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698