| OLD | NEW |
| 1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 // If the cache is not empty reuse the previously allocated stack. | 156 // If the cache is not empty reuse the previously allocated stack. |
| 157 data_ = isolate->irregexp_interpreter_backtrack_stack_cache(); | 157 data_ = isolate->irregexp_interpreter_backtrack_stack_cache(); |
| 158 isolate->set_irregexp_interpreter_backtrack_stack_cache(NULL); | 158 isolate->set_irregexp_interpreter_backtrack_stack_cache(NULL); |
| 159 } else { | 159 } else { |
| 160 // Cache was empty. Allocate a new backtrack stack. | 160 // Cache was empty. Allocate a new backtrack stack. |
| 161 data_ = NewArray<int>(kBacktrackStackSize); | 161 data_ = NewArray<int>(kBacktrackStackSize); |
| 162 } | 162 } |
| 163 } | 163 } |
| 164 | 164 |
| 165 ~BacktrackStack() { | 165 ~BacktrackStack() { |
| 166 Isolate* isolate = Isolate::Current(); | 166 if (isolate_->irregexp_interpreter_backtrack_stack_cache() == NULL) { |
| 167 if (isolate->irregexp_interpreter_backtrack_stack_cache() == NULL) { | |
| 168 // The cache is empty. Keep this backtrack stack around. | 167 // The cache is empty. Keep this backtrack stack around. |
| 169 isolate->set_irregexp_interpreter_backtrack_stack_cache(data_); | 168 isolate_->set_irregexp_interpreter_backtrack_stack_cache(data_); |
| 170 } else { | 169 } else { |
| 171 // A backtrack stack was already cached, just release this one. | 170 // A backtrack stack was already cached, just release this one. |
| 172 DeleteArray(data_); | 171 DeleteArray(data_); |
| 173 } | 172 } |
| 174 } | 173 } |
| 175 | 174 |
| 176 int* data() const { return data_; } | 175 int* data() const { return data_; } |
| 177 | 176 |
| 178 int max_size() const { return kBacktrackStackSize; } | 177 int max_size() const { return kBacktrackStackSize; } |
| 179 | 178 |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 return RawMatch(isolate, | 641 return RawMatch(isolate, |
| 643 code_base, | 642 code_base, |
| 644 subject_vector, | 643 subject_vector, |
| 645 registers, | 644 registers, |
| 646 start_position, | 645 start_position, |
| 647 previous_char); | 646 previous_char); |
| 648 } | 647 } |
| 649 } | 648 } |
| 650 | 649 |
| 651 } } // namespace v8::internal | 650 } } // namespace v8::internal |
| OLD | NEW |