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

Side by Side Diff: src/objects.h

Issue 2590563003: [promises] Remove deferred object (Closed)
Patch Set: fix test Created 3 years, 12 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
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 6570 matching lines...) Expand 10 before | Expand all | Expand 10 after
6581 }; 6581 };
6582 6582
6583 class JSPromise; 6583 class JSPromise;
6584 6584
6585 // Struct to hold state required for PromiseReactionJob. 6585 // Struct to hold state required for PromiseReactionJob.
6586 class PromiseReactionJobInfo : public Struct { 6586 class PromiseReactionJobInfo : public Struct {
6587 public: 6587 public:
6588 DECL_ACCESSORS(promise, JSPromise) 6588 DECL_ACCESSORS(promise, JSPromise)
6589 DECL_ACCESSORS(value, Object) 6589 DECL_ACCESSORS(value, Object)
6590 DECL_ACCESSORS(tasks, Object) 6590 DECL_ACCESSORS(tasks, Object)
6591 DECL_ACCESSORS(deferred, Object) 6591 DECL_ACCESSORS(deferred_promise, Object)
jgruber 2016/12/21 08:08:28 Let's document the tristate (Object/Undefined/Fixe
gsathya 2016/12/21 19:26:28 Done.
6592 DECL_ACCESSORS(deferred_on_resolve, Object)
6593 DECL_ACCESSORS(deferred_on_reject, Object)
6592 DECL_ACCESSORS(debug_id, Object) 6594 DECL_ACCESSORS(debug_id, Object)
6593 DECL_ACCESSORS(debug_name, Object) 6595 DECL_ACCESSORS(debug_name, Object)
6594 DECL_ACCESSORS(context, Context) 6596 DECL_ACCESSORS(context, Context)
6595 6597
6596 static const int kPromiseOffset = Struct::kHeaderSize; 6598 static const int kPromiseOffset = Struct::kHeaderSize;
6597 static const int kValueOffset = kPromiseOffset + kPointerSize; 6599 static const int kValueOffset = kPromiseOffset + kPointerSize;
6598 static const int kTasksOffset = kValueOffset + kPointerSize; 6600 static const int kTasksOffset = kValueOffset + kPointerSize;
6599 static const int kDeferredOffset = kTasksOffset + kPointerSize; 6601 static const int kDeferredPromiseOffset = kTasksOffset + kPointerSize;
6600 static const int kDebugIdOffset = kDeferredOffset + kPointerSize; 6602 static const int kDeferredOnResolveOffset =
6603 kDeferredPromiseOffset + kPointerSize;
6604 static const int kDeferredOnRejectOffset =
6605 kDeferredOnResolveOffset + kPointerSize;
6606 static const int kDebugIdOffset = kDeferredOnRejectOffset + kPointerSize;
6601 static const int kDebugNameOffset = kDebugIdOffset + kPointerSize; 6607 static const int kDebugNameOffset = kDebugIdOffset + kPointerSize;
6602 static const int kContextOffset = kDebugNameOffset + kPointerSize; 6608 static const int kContextOffset = kDebugNameOffset + kPointerSize;
6603 static const int kSize = kContextOffset + kPointerSize; 6609 static const int kSize = kContextOffset + kPointerSize;
6604 6610
6605 DECLARE_CAST(PromiseReactionJobInfo) 6611 DECLARE_CAST(PromiseReactionJobInfo)
6606 DECLARE_PRINTER(PromiseReactionJobInfo) 6612 DECLARE_PRINTER(PromiseReactionJobInfo)
6607 DECLARE_VERIFIER(PromiseReactionJobInfo) 6613 DECLARE_VERIFIER(PromiseReactionJobInfo)
6608 6614
6609 private: 6615 private:
6610 DISALLOW_IMPLICIT_CONSTRUCTORS(PromiseReactionJobInfo); 6616 DISALLOW_IMPLICIT_CONSTRUCTORS(PromiseReactionJobInfo);
(...skipping 2026 matching lines...) Expand 10 before | Expand all | Expand 10 after
8637 DECL_ACCESSORS(result, Object) 8643 DECL_ACCESSORS(result, Object)
8638 8644
8639 // There are 3 possible states for these fields -- 8645 // There are 3 possible states for these fields --
8640 // 1) Undefined -- This is the zero state when there is no callback 8646 // 1) Undefined -- This is the zero state when there is no callback
8641 // or deferred registered. 8647 // or deferred registered.
8642 // 2) Object -- There is a single Callable directly attached to the 8648 // 2) Object -- There is a single Callable directly attached to the
8643 // fulfill_reactions, reject_reactions and the deferred JSObject is 8649 // fulfill_reactions, reject_reactions and the deferred JSObject is
8644 // directly attached to the deferred field. 8650 // directly attached to the deferred field.
8645 // 3) FixedArray -- There is more than one callback and deferred 8651 // 3) FixedArray -- There is more than one callback and deferred
8646 // attached to a FixedArray. 8652 // attached to a FixedArray.
8647 DECL_ACCESSORS(deferred, Object) 8653 DECL_ACCESSORS(deferred_promise, Object)
8654 DECL_ACCESSORS(deferred_on_resolve, Object)
8655 DECL_ACCESSORS(deferred_on_reject, Object)
8648 DECL_ACCESSORS(fulfill_reactions, Object) 8656 DECL_ACCESSORS(fulfill_reactions, Object)
8649 DECL_ACCESSORS(reject_reactions, Object) 8657 DECL_ACCESSORS(reject_reactions, Object)
8650 8658
8651 DECL_INT_ACCESSORS(flags) 8659 DECL_INT_ACCESSORS(flags)
8652 8660
8653 // [has_handler]: Whether this promise has a reject handler or not. 8661 // [has_handler]: Whether this promise has a reject handler or not.
8654 DECL_BOOLEAN_ACCESSORS(has_handler) 8662 DECL_BOOLEAN_ACCESSORS(has_handler)
8655 8663
8656 static const char* Status(int status); 8664 static const char* Status(int status);
8657 8665
8658 DECLARE_CAST(JSPromise) 8666 DECLARE_CAST(JSPromise)
8659 8667
8660 // Dispatched behavior. 8668 // Dispatched behavior.
8661 DECLARE_PRINTER(JSPromise) 8669 DECLARE_PRINTER(JSPromise)
8662 DECLARE_VERIFIER(JSPromise) 8670 DECLARE_VERIFIER(JSPromise)
8663 8671
8664 // Layout description. 8672 // Layout description.
8665 static const int kStatusOffset = JSObject::kHeaderSize; 8673 static const int kStatusOffset = JSObject::kHeaderSize;
8666 static const int kResultOffset = kStatusOffset + kPointerSize; 8674 static const int kResultOffset = kStatusOffset + kPointerSize;
8667 static const int kDeferredOffset = kResultOffset + kPointerSize; 8675 static const int kDeferredPromiseOffset = kResultOffset + kPointerSize;
8668 static const int kFulfillReactionsOffset = kDeferredOffset + kPointerSize; 8676 static const int kDeferredOnResolveOffset =
8677 kDeferredPromiseOffset + kPointerSize;
8678 static const int kDeferredOnRejectOffset =
8679 kDeferredOnResolveOffset + kPointerSize;
8680 static const int kFulfillReactionsOffset =
8681 kDeferredOnRejectOffset + kPointerSize;
8669 static const int kRejectReactionsOffset = 8682 static const int kRejectReactionsOffset =
8670 kFulfillReactionsOffset + kPointerSize; 8683 kFulfillReactionsOffset + kPointerSize;
8671 static const int kFlagsOffset = kRejectReactionsOffset + kPointerSize; 8684 static const int kFlagsOffset = kRejectReactionsOffset + kPointerSize;
8672 static const int kSize = kFlagsOffset + kPointerSize; 8685 static const int kSize = kFlagsOffset + kPointerSize;
8673 8686
8674 // Flags layout. 8687 // Flags layout.
8675 static const int kHasHandlerBit = 0; 8688 static const int kHasHandlerBit = 0;
8676 }; 8689 };
8677 8690
8678 // Regular expressions 8691 // Regular expressions
(...skipping 3027 matching lines...) Expand 10 before | Expand all | Expand 10 after
11706 } 11719 }
11707 }; 11720 };
11708 11721
11709 11722
11710 } // NOLINT, false-positive due to second-order macros. 11723 } // NOLINT, false-positive due to second-order macros.
11711 } // NOLINT, false-positive due to second-order macros. 11724 } // NOLINT, false-positive due to second-order macros.
11712 11725
11713 #include "src/objects/object-macros-undef.h" 11726 #include "src/objects/object-macros-undef.h"
11714 11727
11715 #endif // V8_OBJECTS_H_ 11728 #endif // V8_OBJECTS_H_
OLDNEW
« src/builtins/builtins-promise.cc ('K') | « src/js/promise.js ('k') | src/objects-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698