| Index: src/full-codegen/ia32/full-codegen-ia32.cc
|
| diff --git a/src/full-codegen/ia32/full-codegen-ia32.cc b/src/full-codegen/ia32/full-codegen-ia32.cc
|
| index 4ae2d396e4b3e2bb9711b3d8e2ba5d32909f0b32..7800950033838ab64b2645ca8389e9fd7d9ad1ec 100644
|
| --- a/src/full-codegen/ia32/full-codegen-ia32.cc
|
| +++ b/src/full-codegen/ia32/full-codegen-ia32.cc
|
| @@ -3326,275 +3326,6 @@ void FullCodeGenerator::EmitGetSuperConstructor(CallRuntime* expr) {
|
| }
|
|
|
|
|
| -void FullCodeGenerator::EmitFastOneByteArrayJoin(CallRuntime* expr) {
|
| - Label bailout, done, one_char_separator, long_separator,
|
| - non_trivial_array, not_size_one_array, loop,
|
| - loop_1, loop_1_condition, loop_2, loop_2_entry, loop_3, loop_3_entry;
|
| -
|
| - ZoneList<Expression*>* args = expr->arguments();
|
| - DCHECK(args->length() == 2);
|
| - // We will leave the separator on the stack until the end of the function.
|
| - VisitForStackValue(args->at(1));
|
| - // Load this to eax (= array)
|
| - VisitForAccumulatorValue(args->at(0));
|
| - // All aliases of the same register have disjoint lifetimes.
|
| - Register array = eax;
|
| - Register elements = no_reg; // Will be eax.
|
| -
|
| - Register index = edx;
|
| -
|
| - Register string_length = ecx;
|
| -
|
| - Register string = esi;
|
| -
|
| - Register scratch = ebx;
|
| -
|
| - Register array_length = edi;
|
| - Register result_pos = no_reg; // Will be edi.
|
| -
|
| - // Separator operand is already pushed.
|
| - Operand separator_operand = Operand(esp, 2 * kPointerSize);
|
| - Operand result_operand = Operand(esp, 1 * kPointerSize);
|
| - Operand array_length_operand = Operand(esp, 0);
|
| - __ sub(esp, Immediate(2 * kPointerSize));
|
| - __ cld();
|
| - // Check that the array is a JSArray
|
| - __ JumpIfSmi(array, &bailout);
|
| - __ CmpObjectType(array, JS_ARRAY_TYPE, scratch);
|
| - __ j(not_equal, &bailout);
|
| -
|
| - // Check that the array has fast elements.
|
| - __ CheckFastElements(scratch, &bailout);
|
| -
|
| - // If the array has length zero, return the empty string.
|
| - __ mov(array_length, FieldOperand(array, JSArray::kLengthOffset));
|
| - __ SmiUntag(array_length);
|
| - __ j(not_zero, &non_trivial_array);
|
| - __ mov(result_operand, isolate()->factory()->empty_string());
|
| - __ jmp(&done);
|
| -
|
| - // Save the array length.
|
| - __ bind(&non_trivial_array);
|
| - __ mov(array_length_operand, array_length);
|
| -
|
| - // Save the FixedArray containing array's elements.
|
| - // End of array's live range.
|
| - elements = array;
|
| - __ mov(elements, FieldOperand(array, JSArray::kElementsOffset));
|
| - array = no_reg;
|
| -
|
| -
|
| - // Check that all array elements are sequential one-byte strings, and
|
| - // accumulate the sum of their lengths, as a smi-encoded value.
|
| - __ Move(index, Immediate(0));
|
| - __ Move(string_length, Immediate(0));
|
| - // Loop condition: while (index < length).
|
| - // Live loop registers: index, array_length, string,
|
| - // scratch, string_length, elements.
|
| - if (generate_debug_code_) {
|
| - __ cmp(index, array_length);
|
| - __ Assert(less, kNoEmptyArraysHereInEmitFastOneByteArrayJoin);
|
| - }
|
| - __ bind(&loop);
|
| - __ mov(string, FieldOperand(elements,
|
| - index,
|
| - times_pointer_size,
|
| - FixedArray::kHeaderSize));
|
| - __ JumpIfSmi(string, &bailout);
|
| - __ mov(scratch, FieldOperand(string, HeapObject::kMapOffset));
|
| - __ movzx_b(scratch, FieldOperand(scratch, Map::kInstanceTypeOffset));
|
| - __ and_(scratch, Immediate(
|
| - kIsNotStringMask | kStringEncodingMask | kStringRepresentationMask));
|
| - __ cmp(scratch, kStringTag | kOneByteStringTag | kSeqStringTag);
|
| - __ j(not_equal, &bailout);
|
| - __ add(string_length,
|
| - FieldOperand(string, SeqOneByteString::kLengthOffset));
|
| - __ j(overflow, &bailout);
|
| - __ add(index, Immediate(1));
|
| - __ cmp(index, array_length);
|
| - __ j(less, &loop);
|
| -
|
| - // If array_length is 1, return elements[0], a string.
|
| - __ cmp(array_length, 1);
|
| - __ j(not_equal, ¬_size_one_array);
|
| - __ mov(scratch, FieldOperand(elements, FixedArray::kHeaderSize));
|
| - __ mov(result_operand, scratch);
|
| - __ jmp(&done);
|
| -
|
| - __ bind(¬_size_one_array);
|
| -
|
| - // End of array_length live range.
|
| - result_pos = array_length;
|
| - array_length = no_reg;
|
| -
|
| - // Live registers:
|
| - // string_length: Sum of string lengths, as a smi.
|
| - // elements: FixedArray of strings.
|
| -
|
| - // Check that the separator is a flat one-byte string.
|
| - __ mov(string, separator_operand);
|
| - __ JumpIfSmi(string, &bailout);
|
| - __ mov(scratch, FieldOperand(string, HeapObject::kMapOffset));
|
| - __ movzx_b(scratch, FieldOperand(scratch, Map::kInstanceTypeOffset));
|
| - __ and_(scratch, Immediate(
|
| - kIsNotStringMask | kStringEncodingMask | kStringRepresentationMask));
|
| - __ cmp(scratch, kStringTag | kOneByteStringTag | kSeqStringTag);
|
| - __ j(not_equal, &bailout);
|
| -
|
| - // Add (separator length times array_length) - separator length
|
| - // to string_length.
|
| - __ mov(scratch, separator_operand);
|
| - __ mov(scratch, FieldOperand(scratch, SeqOneByteString::kLengthOffset));
|
| - __ sub(string_length, scratch); // May be negative, temporarily.
|
| - __ imul(scratch, array_length_operand);
|
| - __ j(overflow, &bailout);
|
| - __ add(string_length, scratch);
|
| - __ j(overflow, &bailout);
|
| -
|
| - __ shr(string_length, 1);
|
| -
|
| - // Bailout for large object allocations.
|
| - __ cmp(string_length, Page::kMaxRegularHeapObjectSize);
|
| - __ j(greater, &bailout);
|
| -
|
| - // Live registers and stack values:
|
| - // string_length
|
| - // elements
|
| - __ AllocateOneByteString(result_pos, string_length, scratch, index, string,
|
| - &bailout);
|
| - __ mov(result_operand, result_pos);
|
| - __ lea(result_pos, FieldOperand(result_pos, SeqOneByteString::kHeaderSize));
|
| -
|
| -
|
| - __ mov(string, separator_operand);
|
| - __ cmp(FieldOperand(string, SeqOneByteString::kLengthOffset),
|
| - Immediate(Smi::FromInt(1)));
|
| - __ j(equal, &one_char_separator);
|
| - __ j(greater, &long_separator);
|
| -
|
| -
|
| - // Empty separator case
|
| - __ mov(index, Immediate(0));
|
| - __ jmp(&loop_1_condition);
|
| - // Loop condition: while (index < length).
|
| - __ bind(&loop_1);
|
| - // Each iteration of the loop concatenates one string to the result.
|
| - // Live values in registers:
|
| - // index: which element of the elements array we are adding to the result.
|
| - // result_pos: the position to which we are currently copying characters.
|
| - // elements: the FixedArray of strings we are joining.
|
| -
|
| - // Get string = array[index].
|
| - __ mov(string, FieldOperand(elements, index,
|
| - times_pointer_size,
|
| - FixedArray::kHeaderSize));
|
| - __ mov(string_length,
|
| - FieldOperand(string, String::kLengthOffset));
|
| - __ shr(string_length, 1);
|
| - __ lea(string,
|
| - FieldOperand(string, SeqOneByteString::kHeaderSize));
|
| - __ CopyBytes(string, result_pos, string_length, scratch);
|
| - __ add(index, Immediate(1));
|
| - __ bind(&loop_1_condition);
|
| - __ cmp(index, array_length_operand);
|
| - __ j(less, &loop_1); // End while (index < length).
|
| - __ jmp(&done);
|
| -
|
| -
|
| -
|
| - // One-character separator case
|
| - __ bind(&one_char_separator);
|
| - // Replace separator with its one-byte character value.
|
| - __ mov_b(scratch, FieldOperand(string, SeqOneByteString::kHeaderSize));
|
| - __ mov_b(separator_operand, scratch);
|
| -
|
| - __ Move(index, Immediate(0));
|
| - // Jump into the loop after the code that copies the separator, so the first
|
| - // element is not preceded by a separator
|
| - __ jmp(&loop_2_entry);
|
| - // Loop condition: while (index < length).
|
| - __ bind(&loop_2);
|
| - // Each iteration of the loop concatenates one string to the result.
|
| - // Live values in registers:
|
| - // index: which element of the elements array we are adding to the result.
|
| - // result_pos: the position to which we are currently copying characters.
|
| -
|
| - // Copy the separator character to the result.
|
| - __ mov_b(scratch, separator_operand);
|
| - __ mov_b(Operand(result_pos, 0), scratch);
|
| - __ inc(result_pos);
|
| -
|
| - __ bind(&loop_2_entry);
|
| - // Get string = array[index].
|
| - __ mov(string, FieldOperand(elements, index,
|
| - times_pointer_size,
|
| - FixedArray::kHeaderSize));
|
| - __ mov(string_length,
|
| - FieldOperand(string, String::kLengthOffset));
|
| - __ shr(string_length, 1);
|
| - __ lea(string,
|
| - FieldOperand(string, SeqOneByteString::kHeaderSize));
|
| - __ CopyBytes(string, result_pos, string_length, scratch);
|
| - __ add(index, Immediate(1));
|
| -
|
| - __ cmp(index, array_length_operand);
|
| - __ j(less, &loop_2); // End while (index < length).
|
| - __ jmp(&done);
|
| -
|
| -
|
| - // Long separator case (separator is more than one character).
|
| - __ bind(&long_separator);
|
| -
|
| - __ Move(index, Immediate(0));
|
| - // Jump into the loop after the code that copies the separator, so the first
|
| - // element is not preceded by a separator
|
| - __ jmp(&loop_3_entry);
|
| - // Loop condition: while (index < length).
|
| - __ bind(&loop_3);
|
| - // Each iteration of the loop concatenates one string to the result.
|
| - // Live values in registers:
|
| - // index: which element of the elements array we are adding to the result.
|
| - // result_pos: the position to which we are currently copying characters.
|
| -
|
| - // Copy the separator to the result.
|
| - __ mov(string, separator_operand);
|
| - __ mov(string_length,
|
| - FieldOperand(string, String::kLengthOffset));
|
| - __ shr(string_length, 1);
|
| - __ lea(string,
|
| - FieldOperand(string, SeqOneByteString::kHeaderSize));
|
| - __ CopyBytes(string, result_pos, string_length, scratch);
|
| -
|
| - __ bind(&loop_3_entry);
|
| - // Get string = array[index].
|
| - __ mov(string, FieldOperand(elements, index,
|
| - times_pointer_size,
|
| - FixedArray::kHeaderSize));
|
| - __ mov(string_length,
|
| - FieldOperand(string, String::kLengthOffset));
|
| - __ shr(string_length, 1);
|
| - __ lea(string,
|
| - FieldOperand(string, SeqOneByteString::kHeaderSize));
|
| - __ CopyBytes(string, result_pos, string_length, scratch);
|
| - __ add(index, Immediate(1));
|
| -
|
| - __ cmp(index, array_length_operand);
|
| - __ j(less, &loop_3); // End while (index < length).
|
| - __ jmp(&done);
|
| -
|
| -
|
| - __ bind(&bailout);
|
| - __ mov(result_operand, isolate()->factory()->undefined_value());
|
| - __ bind(&done);
|
| - __ mov(eax, result_operand);
|
| - // Drop temp values from the stack, and restore context register.
|
| - __ add(esp, Immediate(3 * kPointerSize));
|
| -
|
| - __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
|
| - context()->Plug(eax);
|
| -}
|
| -
|
| -
|
| void FullCodeGenerator::EmitDebugIsActive(CallRuntime* expr) {
|
| DCHECK(expr->arguments()->length() == 0);
|
| ExternalReference debug_is_active =
|
|
|