| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 // A simple interpreter for the Irregexp byte code. | 5 // A simple interpreter for the Irregexp byte code. |
| 6 | 6 |
| 7 | 7 |
| 8 #include "src/v8.h" | 8 #include "src/v8.h" |
| 9 | 9 |
| 10 #include "src/ast.h" | 10 #include "src/ast.h" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 return *reinterpret_cast<const uint16_t *>(pc); | 129 return *reinterpret_cast<const uint16_t *>(pc); |
| 130 } | 130 } |
| 131 | 131 |
| 132 | 132 |
| 133 // A simple abstraction over the backtracking stack used by the interpreter. | 133 // A simple abstraction over the backtracking stack used by the interpreter. |
| 134 // This backtracking stack does not grow automatically, but it ensures that the | 134 // This backtracking stack does not grow automatically, but it ensures that the |
| 135 // the memory held by the stack is released or remembered in a cache if the | 135 // the memory held by the stack is released or remembered in a cache if the |
| 136 // matching terminates. | 136 // matching terminates. |
| 137 class BacktrackStack { | 137 class BacktrackStack { |
| 138 public: | 138 public: |
| 139 explicit BacktrackStack() { | 139 BacktrackStack() { data_ = NewArray<int>(kBacktrackStackSize); } |
| 140 data_ = NewArray<int>(kBacktrackStackSize); | |
| 141 } | |
| 142 | 140 |
| 143 ~BacktrackStack() { | 141 ~BacktrackStack() { |
| 144 DeleteArray(data_); | 142 DeleteArray(data_); |
| 145 } | 143 } |
| 146 | 144 |
| 147 int* data() const { return data_; } | 145 int* data() const { return data_; } |
| 148 | 146 |
| 149 int max_size() const { return kBacktrackStackSize; } | 147 int max_size() const { return kBacktrackStackSize; } |
| 150 | 148 |
| 151 private: | 149 private: |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 return RawMatch(isolate, | 600 return RawMatch(isolate, |
| 603 code_base, | 601 code_base, |
| 604 subject_vector, | 602 subject_vector, |
| 605 registers, | 603 registers, |
| 606 start_position, | 604 start_position, |
| 607 previous_char); | 605 previous_char); |
| 608 } | 606 } |
| 609 } | 607 } |
| 610 | 608 |
| 611 } } // namespace v8::internal | 609 } } // namespace v8::internal |
| OLD | NEW |