5 #ifndef V8_STRING_BUILDER_H_
6 #define V8_STRING_BUILDER_H_
21 template <
typename sink
char>
27 for (
int i = 0;
i < array_length;
i++) {
29 if (element->IsSmi()) {
31 int encoded_slice = Smi::cast(element)->value();
34 if (encoded_slice > 0) {
42 pos = Smi::cast(obj)->value();
48 String*
string = String::cast(element);
49 int element_length =
string->length();
51 position += element_length;
61 int array_length,
bool* one_byte) {
64 for (
int i = 0;
i < array_length;
i++) {
69 int smi_value = Smi::cast(elt)->value();
81 if (
i >= array_length)
return -1;
83 if (!next_smi->IsSmi())
return -1;
84 pos = Smi::cast(next_smi)->value();
85 if (pos < 0)
return -1;
89 if (pos > special_length || len > special_length - pos)
return -1;
91 }
else if (elt->IsString()) {
92 String* element = String::cast(elt);
93 int element_length = element->
length();
94 increment = element_length;
104 position += increment;
113 :
array_(isolate->factory()->NewFixedArrayWithHoles(initial_capacity)),
118 DCHECK(initial_capacity > 0);
125 DCHECK(backing_store->length() > 0);
130 int required_length =
length_ + elements;
131 return (
length >= required_length);
136 int required_length =
length_ + elements;
137 if (
length < required_length) {
141 }
while (new_length < required_length);
143 array_->GetIsolate()->factory()->NewFixedArrayWithHoles(new_length);
187 int estimated_part_count)
195 DCHECK(estimated_part_count > 0);
201 int length =
to - from;
226 int length =
string->length();
229 if (!string->IsOneByteRepresentation()) {
239 return isolate->
factory()->empty_string();
250 uint8_t* char_buffer = seq->GetChars();
262 uc16* char_buffer = seq->GetChars();
267 return joined_string;
282 DCHECK(element->IsSmi() || element->IsString());
static bool is_valid(T value)
static uint32_t encode(T value)
static T decode(uint32_t value)
Handle< FixedArray > array_
Handle< JSArray > ToJSArray(Handle< JSArray > target_array)
FixedArrayBuilder(Isolate *isolate, int initial_capacity)
FixedArrayBuilder(Handle< FixedArray > backing_store)
bool HasCapacity(int elements)
Handle< FixedArray > array()
void EnsureCapacity(int elements)
bool has_non_smi_elements_
static Handle< T > cast(Handle< S > that)
static void SetContent(Handle< JSArray > array, Handle< FixedArrayBase > storage)
void AddString(Handle< String > string)
void AddElement(Object *element)
Handle< String > subject_
MaybeHandle< String > ToString()
ReplacementStringBuilder(Heap *heap, Handle< String > subject, int estimated_part_count)
void EnsureCapacity(int elements)
static void AddSubjectSlice(FixedArrayBuilder *builder, int from, int to)
void IncrementCharacterCount(int by)
void AddSubjectSlice(int from, int to)
FixedArrayBuilder array_builder_
static Smi * FromInt(int value)
static void WriteToFlat(String *source, sinkchar *sink, int from, int to)
bool HasOnlyOneByteChars()
static const int kMaxLength
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be expose gc extension under the specified name show built in functions in stack traces use random jit cookie to mask large constants minimum length for automatic enable preparsing CPU profiler sampling interval in microseconds trace out of bounds accesses to external arrays default size of stack region v8 is allowed to maximum length of function source code printed in a stack trace min size of a semi the new space consists of two semi spaces print one trace line following each garbage collection do not print trace line after scavenger collection print cumulative GC statistics in only print modified registers Trace simulator debug messages Implied by trace sim abort randomize hashes to avoid predictable hash Fixed seed to use to hash property Print the time it takes to deserialize the snapshot A filename with extra code to be included in the A file to write the raw snapshot bytes to(mksnapshot only)") DEFINE_STRING(raw_context_file
#define ASSIGN_RETURN_ON_EXCEPTION(isolate, dst, call, T)
#define DCHECK(condition)
const int kStringBuilderConcatHelperPositionBits
static void StringBuilderConcatHelper(String *special, sinkchar *sink, FixedArray *fixed_array, int array_length)
BitField< int, kStringBuilderConcatHelperLengthBits, kStringBuilderConcatHelperPositionBits > StringBuilderSubstringPosition
STATIC_ASSERT(sizeof(CPURegister)==sizeof(Register))
const int kStringBuilderConcatHelperLengthBits
BitField< int, 0, kStringBuilderConcatHelperLengthBits > StringBuilderSubstringLength
static int StringBuilderConcatLength(int special_length, FixedArray *fixed_array, int array_length, bool *one_byte)
Debugger support for the V8 JavaScript engine.