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

Side by Side Diff: src/string-builder.h

Issue 1417013007: Revert of Canonicalize handles for optimized compilation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month 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 | « src/ppc/macro-assembler-ppc.cc ('k') | src/string-builder.cc » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 #ifndef V8_STRING_BUILDER_H_ 5 #ifndef V8_STRING_BUILDER_H_
6 #define V8_STRING_BUILDER_H_ 6 #define V8_STRING_BUILDER_H_
7 7
8 #include "src/assert-scope.h" 8 #include "src/assert-scope.h"
9 #include "src/factory.h" 9 #include "src/factory.h"
10 #include "src/handles.h" 10 #include "src/handles.h"
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 }; 339 };
340 340
341 template <typename DestChar> 341 template <typename DestChar>
342 class NoExtendString : public NoExtend<DestChar> { 342 class NoExtendString : public NoExtend<DestChar> {
343 public: 343 public:
344 NoExtendString(Handle<String> string, int required_length) 344 NoExtendString(Handle<String> string, int required_length)
345 : NoExtend<DestChar>(string, 0), string_(string) { 345 : NoExtend<DestChar>(string, 0), string_(string) {
346 DCHECK(string->length() >= required_length); 346 DCHECK(string->length() >= required_length);
347 } 347 }
348 348
349 Handle<String> Finalize() { 349 ~NoExtendString() {
350 Handle<SeqString> string = Handle<SeqString>::cast(string_); 350 Handle<SeqString> string = Handle<SeqString>::cast(string_);
351 int length = NoExtend<DestChar>::written(); 351 int length = NoExtend<DestChar>::written();
352 Handle<String> result = SeqString::Truncate(string, length); 352 *string_.location() = *SeqString::Truncate(string, length);
353 string_ = Handle<String>();
354 return result;
355 } 353 }
356 354
357 private: 355 private:
358 Handle<String> string_; 356 Handle<String> string_;
359 }; 357 };
360 358
361 template <typename DestChar> 359 template <typename DestChar>
362 class NoExtendBuilder : public NoExtend<DestChar> { 360 class NoExtendBuilder : public NoExtend<DestChar> {
363 public: 361 public:
364 NoExtendBuilder(IncrementalStringBuilder* builder, int required_length) 362 NoExtendBuilder(IncrementalStringBuilder* builder, int required_length)
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 DCHECK_EQ(String::TWO_BYTE_ENCODING, encoding_); 426 DCHECK_EQ(String::TWO_BYTE_ENCODING, encoding_);
429 SeqTwoByteString::cast(*current_part_) 427 SeqTwoByteString::cast(*current_part_)
430 ->SeqTwoByteStringSet(current_index_++, c); 428 ->SeqTwoByteStringSet(current_index_++, c);
431 } 429 }
432 if (current_index_ == part_length_) Extend(); 430 if (current_index_ == part_length_) Extend();
433 } 431 }
434 } // namespace internal 432 } // namespace internal
435 } // namespace v8 433 } // namespace v8
436 434
437 #endif // V8_STRING_BUILDER_H_ 435 #endif // V8_STRING_BUILDER_H_
OLDNEW
« no previous file with comments | « src/ppc/macro-assembler-ppc.cc ('k') | src/string-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698