OLD | NEW |
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/objects-inl.h" |
| 8 |
7 namespace v8 { | 9 namespace v8 { |
8 namespace internal { | 10 namespace internal { |
9 | 11 |
10 MaybeHandle<String> ReplacementStringBuilder::ToString() { | 12 MaybeHandle<String> ReplacementStringBuilder::ToString() { |
11 Isolate* isolate = heap_->isolate(); | 13 Isolate* isolate = heap_->isolate(); |
12 if (array_builder_.length() == 0) { | 14 if (array_builder_.length() == 0) { |
13 return isolate->factory()->empty_string(); | 15 return isolate->factory()->empty_string(); |
14 } | 16 } |
15 | 17 |
16 Handle<String> joined_string; | 18 Handle<String> joined_string; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 | 100 |
99 | 101 |
100 void IncrementalStringBuilder::AppendString(Handle<String> string) { | 102 void IncrementalStringBuilder::AppendString(Handle<String> string) { |
101 ShrinkCurrentPart(); | 103 ShrinkCurrentPart(); |
102 part_length_ = kInitialPartLength; // Allocate conservatively. | 104 part_length_ = kInitialPartLength; // Allocate conservatively. |
103 Extend(); // Attach current part and allocate new part. | 105 Extend(); // Attach current part and allocate new part. |
104 Accumulate(string); | 106 Accumulate(string); |
105 } | 107 } |
106 } // namespace internal | 108 } // namespace internal |
107 } // namespace v8 | 109 } // namespace v8 |
OLD | NEW |