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

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

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/string-builder.h ('k') | src/x64/macro-assembler-x64.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 #include "src/string-builder.h" 5 #include "src/string-builder.h"
6 6
7 #include "src/isolate-inl.h" 7 #include "src/isolate-inl.h"
8 #include "src/objects-inl.h" 8 #include "src/objects-inl.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 } 45 }
46 46
47 47
48 IncrementalStringBuilder::IncrementalStringBuilder(Isolate* isolate) 48 IncrementalStringBuilder::IncrementalStringBuilder(Isolate* isolate)
49 : isolate_(isolate), 49 : isolate_(isolate),
50 encoding_(String::ONE_BYTE_ENCODING), 50 encoding_(String::ONE_BYTE_ENCODING),
51 overflowed_(false), 51 overflowed_(false),
52 part_length_(kInitialPartLength), 52 part_length_(kInitialPartLength),
53 current_index_(0) { 53 current_index_(0) {
54 // Create an accumulator handle starting with the empty string. 54 // Create an accumulator handle starting with the empty string.
55 accumulator_ = Handle<String>::New(isolate->heap()->empty_string(), isolate); 55 accumulator_ = Handle<String>(isolate->heap()->empty_string(), isolate);
56 current_part_ = 56 current_part_ =
57 factory()->NewRawOneByteString(part_length_).ToHandleChecked(); 57 factory()->NewRawOneByteString(part_length_).ToHandleChecked();
58 } 58 }
59 59
60 60
61 void IncrementalStringBuilder::Accumulate(Handle<String> new_part) { 61 void IncrementalStringBuilder::Accumulate(Handle<String> new_part) {
62 Handle<String> new_accumulator; 62 Handle<String> new_accumulator;
63 if (accumulator()->length() + new_part->length() > String::kMaxLength) { 63 if (accumulator()->length() + new_part->length() > String::kMaxLength) {
64 // Set the flag and carry on. Delay throwing the exception till the end. 64 // Set the flag and carry on. Delay throwing the exception till the end.
65 new_accumulator = factory()->empty_string(); 65 new_accumulator = factory()->empty_string();
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 101
102 102
103 void IncrementalStringBuilder::AppendString(Handle<String> string) { 103 void IncrementalStringBuilder::AppendString(Handle<String> string) {
104 ShrinkCurrentPart(); 104 ShrinkCurrentPart();
105 part_length_ = kInitialPartLength; // Allocate conservatively. 105 part_length_ = kInitialPartLength; // Allocate conservatively.
106 Extend(); // Attach current part and allocate new part. 106 Extend(); // Attach current part and allocate new part.
107 Accumulate(string); 107 Accumulate(string);
108 } 108 }
109 } // namespace internal 109 } // namespace internal
110 } // namespace v8 110 } // namespace v8
OLDNEW
« no previous file with comments | « src/string-builder.h ('k') | src/x64/macro-assembler-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698