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

Side by Side Diff: src/scanner.h

Issue 1410543005: Always dispose backing store. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « no previous file | no next file » | 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 // 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 // Features shared by parsing and pre-parsing scanners. 5 // Features shared by parsing and pre-parsing scanners.
6 6
7 #ifndef V8_SCANNER_H_ 7 #ifndef V8_SCANNER_H_
8 #define V8_SCANNER_H_ 8 #define V8_SCANNER_H_
9 9
10 #include "src/allocation.h" 10 #include "src/allocation.h"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 }; 159 };
160 160
161 161
162 // ---------------------------------------------------------------------------- 162 // ----------------------------------------------------------------------------
163 // LiteralBuffer - Collector of chars of literals. 163 // LiteralBuffer - Collector of chars of literals.
164 164
165 class LiteralBuffer { 165 class LiteralBuffer {
166 public: 166 public:
167 LiteralBuffer() : is_one_byte_(true), position_(0), backing_store_() { } 167 LiteralBuffer() : is_one_byte_(true), position_(0), backing_store_() { }
168 168
169 ~LiteralBuffer() { 169 ~LiteralBuffer() { backing_store_.Dispose(); }
170 if (backing_store_.length() > 0) {
171 backing_store_.Dispose();
172 }
173 }
174 170
175 INLINE(void AddChar(uint32_t code_unit)) { 171 INLINE(void AddChar(uint32_t code_unit)) {
176 if (position_ >= backing_store_.length()) ExpandBuffer(); 172 if (position_ >= backing_store_.length()) ExpandBuffer();
177 if (is_one_byte_) { 173 if (is_one_byte_) {
178 if (code_unit <= unibrow::Latin1::kMaxChar) { 174 if (code_unit <= unibrow::Latin1::kMaxChar) {
179 backing_store_[position_] = static_cast<byte>(code_unit); 175 backing_store_[position_] = static_cast<byte>(code_unit);
180 position_ += kOneByteSize; 176 position_ += kOneByteSize;
181 return; 177 return;
182 } 178 }
183 ConvertToTwoByte(); 179 ConvertToTwoByte();
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 bool has_line_terminator_before_next_; 756 bool has_line_terminator_before_next_;
761 // Whether there is a multi-line comment that contains a 757 // Whether there is a multi-line comment that contains a
762 // line-terminator after the current token, and before the next. 758 // line-terminator after the current token, and before the next.
763 bool has_multiline_comment_before_next_; 759 bool has_multiline_comment_before_next_;
764 }; 760 };
765 761
766 } // namespace internal 762 } // namespace internal
767 } // namespace v8 763 } // namespace v8
768 764
769 #endif // V8_SCANNER_H_ 765 #endif // V8_SCANNER_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698