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

Side by Side Diff: src/utils.h

Issue 2654423004: [async-functions] support await expressions in finally statements (Closed)
Patch Set: I'd like to build with -Wunused-variables locally, but how!? Created 3 years, 10 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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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_UTILS_H_ 5 #ifndef V8_UTILS_H_
6 #define V8_UTILS_H_ 6 #define V8_UTILS_H_
7 7
8 #include <limits.h> 8 #include <limits.h>
9 #include <stdlib.h> 9 #include <stdlib.h>
10 #include <string.h> 10 #include <string.h>
(...skipping 1689 matching lines...) Expand 10 before | Expand all | Expand 10 after
1700 1700
1701 T value() { return value_; } 1701 T value() { return value_; }
1702 ThreadedListZoneEntry<T>** next() { return &next_; } 1702 ThreadedListZoneEntry<T>** next() { return &next_; }
1703 1703
1704 private: 1704 private:
1705 T value_; 1705 T value_;
1706 ThreadedListZoneEntry<T>* next_; 1706 ThreadedListZoneEntry<T>* next_;
1707 DISALLOW_COPY_AND_ASSIGN(ThreadedListZoneEntry); 1707 DISALLOW_COPY_AND_ASSIGN(ThreadedListZoneEntry);
1708 }; 1708 };
1709 1709
1710 template <typename T>
1711 class ScopedAssignment {
1712 public:
1713 V8_INLINE ScopedAssignment(T& previous, T&& value)
1714 : location_(&previous), prev_(previous) {
1715 *location_ = value;
1716 }
1717 V8_INLINE ScopedAssignment(T& previous, const T& value)
1718 : location_(&previous), prev_(previous) {
1719 *location_ = value;
1720 }
1721
1722 V8_INLINE ~ScopedAssignment() { *location_ = prev_; }
1723
1724 private:
1725 T* location_;
1726 T prev_;
1727 };
1728
1710 } // namespace internal 1729 } // namespace internal
1711 } // namespace v8 1730 } // namespace v8
1712 1731
1713 #endif // V8_UTILS_H_ 1732 #endif // V8_UTILS_H_
OLDNEW
« no previous file with comments | « src/parsing/preparser.cc ('k') | test/cctest/interpreter/bytecode_expectations/Generators.golden » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698