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

Side by Side Diff: src/utils.h

Issue 2475433002: Turn Scope::locals_ into a ThreadedList (Closed)
Patch Set: Addressed comments Created 4 years, 1 month 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/debug/liveedit.cc ('k') | test/mjsunit/regress/regress-abort-preparsing-params.js » ('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 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 1630 matching lines...) Expand 10 before | Expand all | Expand 10 after
1641 }; 1641 };
1642 1642
1643 Iterator begin() { return Iterator(&head_); } 1643 Iterator begin() { return Iterator(&head_); }
1644 Iterator end() { return Iterator(tail_); } 1644 Iterator end() { return Iterator(tail_); }
1645 1645
1646 void Rewind(Iterator reset_point) { 1646 void Rewind(Iterator reset_point) {
1647 tail_ = reset_point.entry_; 1647 tail_ = reset_point.entry_;
1648 *tail_ = nullptr; 1648 *tail_ = nullptr;
1649 } 1649 }
1650 1650
1651 void MoveTail(ThreadedList<T>* parent, Iterator location) {
1652 if (parent->end() != location) {
1653 DCHECK_NULL(*tail_);
1654 *tail_ = *location;
1655 tail_ = parent->tail_;
1656 parent->Rewind(location);
1657 }
1658 }
1659
1651 bool is_empty() const { return head_ == nullptr; } 1660 bool is_empty() const { return head_ == nullptr; }
1652 1661
1653 // Slow. For testing purposes. 1662 // Slow. For testing purposes.
1654 int LengthForTest() { 1663 int LengthForTest() {
1655 int result = 0; 1664 int result = 0;
1656 for (Iterator t = begin(); t != end(); ++t) ++result; 1665 for (Iterator t = begin(); t != end(); ++t) ++result;
1657 return result; 1666 return result;
1658 } 1667 }
1659 T* AtForTest(int i) { 1668 T* AtForTest(int i) {
1660 Iterator t = begin(); 1669 Iterator t = begin();
1661 while (i-- > 0) ++t; 1670 while (i-- > 0) ++t;
1662 return *t; 1671 return *t;
1663 } 1672 }
1664 1673
1665 private: 1674 private:
1666 T* head_; 1675 T* head_;
1667 T** tail_; 1676 T** tail_;
1668 DISALLOW_COPY_AND_ASSIGN(ThreadedList); 1677 DISALLOW_COPY_AND_ASSIGN(ThreadedList);
1669 }; 1678 };
1670 1679
1671 } // namespace internal 1680 } // namespace internal
1672 } // namespace v8 1681 } // namespace v8
1673 1682
1674 #endif // V8_UTILS_H_ 1683 #endif // V8_UTILS_H_
OLDNEW
« no previous file with comments | « src/debug/liveedit.cc ('k') | test/mjsunit/regress/regress-abort-preparsing-params.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698