| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 }; | 136 }; |
| 137 | 137 |
| 138 | 138 |
| 139 // Simple fixed-capacity list-based worklist (managed as a queue) of | 139 // Simple fixed-capacity list-based worklist (managed as a queue) of |
| 140 // pointers to T. | 140 // pointers to T. |
| 141 template<typename T> | 141 template<typename T> |
| 142 class WorkList BASE_EMBEDDED { | 142 class WorkList BASE_EMBEDDED { |
| 143 public: | 143 public: |
| 144 // The worklist cannot grow bigger than size. We keep one item empty to | 144 // The worklist cannot grow bigger than size. We keep one item empty to |
| 145 // distinguish between empty and full. | 145 // distinguish between empty and full. |
| 146 WorkList(int size) | 146 explicit WorkList(int size) |
| 147 : capacity_(size + 1), head_(0), tail_(0), queue_(capacity_) { | 147 : capacity_(size + 1), head_(0), tail_(0), queue_(capacity_) { |
| 148 for (int i = 0; i < capacity_; i++) queue_.Add(NULL); | 148 for (int i = 0; i < capacity_; i++) queue_.Add(NULL); |
| 149 } | 149 } |
| 150 | 150 |
| 151 bool is_empty() { return head_ == tail_; } | 151 bool is_empty() { return head_ == tail_; } |
| 152 | 152 |
| 153 bool is_full() { | 153 bool is_full() { |
| 154 // The worklist is full if head is at 0 and tail is at capacity - 1: | 154 // The worklist is full if head is at 0 and tail is at capacity - 1: |
| 155 // head == 0 && tail == capacity-1 ==> tail - head == capacity - 1 | 155 // head == 0 && tail == capacity-1 ==> tail - head == capacity - 1 |
| 156 // or if tail is immediately to the left of head: | 156 // or if tail is immediately to the left of head: |
| (...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 List<BitVector*> variables_; | 658 List<BitVector*> variables_; |
| 659 | 659 |
| 660 DISALLOW_COPY_AND_ASSIGN(ReachingDefinitions); | 660 DISALLOW_COPY_AND_ASSIGN(ReachingDefinitions); |
| 661 }; | 661 }; |
| 662 | 662 |
| 663 | 663 |
| 664 } } // namespace v8::internal | 664 } } // namespace v8::internal |
| 665 | 665 |
| 666 | 666 |
| 667 #endif // V8_DATAFLOW_H_ | 667 #endif // V8_DATAFLOW_H_ |
| OLD | NEW |