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

Side by Side Diff: src/interpreter-irregexp.cc

Issue 200303002: Remove unused irregexp cache. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/isolate.h » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 } 152 }
153 153
154 154
155 // A simple abstraction over the backtracking stack used by the interpreter. 155 // A simple abstraction over the backtracking stack used by the interpreter.
156 // This backtracking stack does not grow automatically, but it ensures that the 156 // This backtracking stack does not grow automatically, but it ensures that the
157 // the memory held by the stack is released or remembered in a cache if the 157 // the memory held by the stack is released or remembered in a cache if the
158 // matching terminates. 158 // matching terminates.
159 class BacktrackStack { 159 class BacktrackStack {
160 public: 160 public:
161 explicit BacktrackStack(Isolate* isolate) : isolate_(isolate) { 161 explicit BacktrackStack(Isolate* isolate) : isolate_(isolate) {
162 if (isolate->irregexp_interpreter_backtrack_stack_cache() != NULL) { 162 data_ = NewArray<int>(kBacktrackStackSize);
163 // If the cache is not empty reuse the previously allocated stack.
164 data_ = isolate->irregexp_interpreter_backtrack_stack_cache();
165 isolate->set_irregexp_interpreter_backtrack_stack_cache(NULL);
166 } else {
167 // Cache was empty. Allocate a new backtrack stack.
168 data_ = NewArray<int>(kBacktrackStackSize);
169 }
170 } 163 }
171 164
172 ~BacktrackStack() { 165 ~BacktrackStack() {
173 if (isolate_->irregexp_interpreter_backtrack_stack_cache() == NULL) { 166 DeleteArray(data_);
174 // The cache is empty. Keep this backtrack stack around.
175 isolate_->set_irregexp_interpreter_backtrack_stack_cache(data_);
176 } else {
177 // A backtrack stack was already cached, just release this one.
178 DeleteArray(data_);
179 }
180 } 167 }
181 168
182 int* data() const { return data_; } 169 int* data() const { return data_; }
183 170
184 int max_size() const { return kBacktrackStackSize; } 171 int max_size() const { return kBacktrackStackSize; }
185 172
186 private: 173 private:
187 static const int kBacktrackStackSize = 10000; 174 static const int kBacktrackStackSize = 10000;
188 175
189 int* data_; 176 int* data_;
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 return RawMatch(isolate, 625 return RawMatch(isolate,
639 code_base, 626 code_base,
640 subject_vector, 627 subject_vector,
641 registers, 628 registers,
642 start_position, 629 start_position,
643 previous_char); 630 previous_char);
644 } 631 }
645 } 632 }
646 633
647 } } // namespace v8::internal 634 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698