OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 __ stop("stop-at"); | 142 __ stop("stop-at"); |
143 } | 143 } |
144 #endif | 144 #endif |
145 | 145 |
146 // Strict mode functions and builtins need to replace the receiver | 146 // Strict mode functions and builtins need to replace the receiver |
147 // with undefined when called as functions (without an explicit | 147 // with undefined when called as functions (without an explicit |
148 // receiver object). r5 is zero for method calls and non-zero for | 148 // receiver object). r5 is zero for method calls and non-zero for |
149 // function calls. | 149 // function calls. |
150 if (!info->is_classic_mode() || info->is_native()) { | 150 if (!info->is_classic_mode() || info->is_native()) { |
151 Label ok; | 151 Label ok; |
152 __ cmp(r5, Operand(0)); | 152 __ cmp(r5, Operand::Zero()); |
153 __ b(eq, &ok); | 153 __ b(eq, &ok); |
154 int receiver_offset = info->scope()->num_parameters() * kPointerSize; | 154 int receiver_offset = info->scope()->num_parameters() * kPointerSize; |
155 __ LoadRoot(r2, Heap::kUndefinedValueRootIndex); | 155 __ LoadRoot(r2, Heap::kUndefinedValueRootIndex); |
156 __ str(r2, MemOperand(sp, receiver_offset)); | 156 __ str(r2, MemOperand(sp, receiver_offset)); |
157 __ bind(&ok); | 157 __ bind(&ok); |
158 } | 158 } |
159 | 159 |
160 // Open a frame scope to indicate that there is a frame on the stack. The | 160 // Open a frame scope to indicate that there is a frame on the stack. The |
161 // MANUAL indicates that the scope shouldn't actually generate code to set up | 161 // MANUAL indicates that the scope shouldn't actually generate code to set up |
162 // the frame (that is done below). | 162 // the frame (that is done below). |
(...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1027 __ b(clause->body_target()); | 1027 __ b(clause->body_target()); |
1028 __ bind(&slow_case); | 1028 __ bind(&slow_case); |
1029 } | 1029 } |
1030 | 1030 |
1031 // Record position before stub call for type feedback. | 1031 // Record position before stub call for type feedback. |
1032 SetSourcePosition(clause->position()); | 1032 SetSourcePosition(clause->position()); |
1033 Handle<Code> ic = CompareIC::GetUninitialized(Token::EQ_STRICT); | 1033 Handle<Code> ic = CompareIC::GetUninitialized(Token::EQ_STRICT); |
1034 CallIC(ic, RelocInfo::CODE_TARGET, clause->CompareId()); | 1034 CallIC(ic, RelocInfo::CODE_TARGET, clause->CompareId()); |
1035 patch_site.EmitPatchInfo(); | 1035 patch_site.EmitPatchInfo(); |
1036 | 1036 |
1037 __ cmp(r0, Operand(0)); | 1037 __ cmp(r0, Operand::Zero()); |
1038 __ b(ne, &next_test); | 1038 __ b(ne, &next_test); |
1039 __ Drop(1); // Switch value is no longer needed. | 1039 __ Drop(1); // Switch value is no longer needed. |
1040 __ b(clause->body_target()); | 1040 __ b(clause->body_target()); |
1041 } | 1041 } |
1042 | 1042 |
1043 // Discard the test value and jump to the default if present, otherwise to | 1043 // Discard the test value and jump to the default if present, otherwise to |
1044 // the end of the statement. | 1044 // the end of the statement. |
1045 __ bind(&next_test); | 1045 __ bind(&next_test); |
1046 __ Drop(1); // Switch value is no longer needed. | 1046 __ Drop(1); // Switch value is no longer needed. |
1047 if (default_clause == NULL) { | 1047 if (default_clause == NULL) { |
(...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1979 __ sub(scratch1, left, Operand(right), SetCC); | 1979 __ sub(scratch1, left, Operand(right), SetCC); |
1980 __ b(vs, &stub_call); | 1980 __ b(vs, &stub_call); |
1981 __ mov(right, scratch1); | 1981 __ mov(right, scratch1); |
1982 break; | 1982 break; |
1983 case Token::MUL: { | 1983 case Token::MUL: { |
1984 __ SmiUntag(ip, right); | 1984 __ SmiUntag(ip, right); |
1985 __ smull(scratch1, scratch2, left, ip); | 1985 __ smull(scratch1, scratch2, left, ip); |
1986 __ mov(ip, Operand(scratch1, ASR, 31)); | 1986 __ mov(ip, Operand(scratch1, ASR, 31)); |
1987 __ cmp(ip, Operand(scratch2)); | 1987 __ cmp(ip, Operand(scratch2)); |
1988 __ b(ne, &stub_call); | 1988 __ b(ne, &stub_call); |
1989 __ cmp(scratch1, Operand(0)); | 1989 __ cmp(scratch1, Operand::Zero()); |
1990 __ mov(right, Operand(scratch1), LeaveCC, ne); | 1990 __ mov(right, Operand(scratch1), LeaveCC, ne); |
1991 __ b(ne, &done); | 1991 __ b(ne, &done); |
1992 __ add(scratch2, right, Operand(left), SetCC); | 1992 __ add(scratch2, right, Operand(left), SetCC); |
1993 __ mov(right, Operand(Smi::FromInt(0)), LeaveCC, pl); | 1993 __ mov(right, Operand(Smi::FromInt(0)), LeaveCC, pl); |
1994 __ b(mi, &stub_call); | 1994 __ b(mi, &stub_call); |
1995 break; | 1995 break; |
1996 } | 1996 } |
1997 case Token::BIT_OR: | 1997 case Token::BIT_OR: |
1998 __ orr(right, left, Operand(right)); | 1998 __ orr(right, left, Operand(right)); |
1999 break; | 1999 break; |
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2673 __ cmp(r2, ip); | 2673 __ cmp(r2, ip); |
2674 __ b(eq, if_false); | 2674 __ b(eq, if_false); |
2675 | 2675 |
2676 // Look for valueOf symbol in the descriptor array, and indicate false if | 2676 // Look for valueOf symbol in the descriptor array, and indicate false if |
2677 // found. Since we omit an enumeration index check, if it is added via a | 2677 // found. Since we omit an enumeration index check, if it is added via a |
2678 // transition that shares its descriptor array, this is a false positive. | 2678 // transition that shares its descriptor array, this is a false positive. |
2679 Label entry, loop, done; | 2679 Label entry, loop, done; |
2680 | 2680 |
2681 // Skip loop if no descriptors are valid. | 2681 // Skip loop if no descriptors are valid. |
2682 __ NumberOfOwnDescriptors(r3, r1); | 2682 __ NumberOfOwnDescriptors(r3, r1); |
2683 __ cmp(r3, Operand(0)); | 2683 __ cmp(r3, Operand::Zero()); |
2684 __ b(eq, &done); | 2684 __ b(eq, &done); |
2685 | 2685 |
2686 __ LoadInstanceDescriptors(r1, r4, r2); | 2686 __ LoadInstanceDescriptors(r1, r4, r2); |
2687 // r4: descriptor array. | 2687 // r4: descriptor array. |
2688 // r3: valid entries in the descriptor array. | 2688 // r3: valid entries in the descriptor array. |
2689 STATIC_ASSERT(kSmiTag == 0); | 2689 STATIC_ASSERT(kSmiTag == 0); |
2690 STATIC_ASSERT(kSmiTagSize == 1); | 2690 STATIC_ASSERT(kSmiTagSize == 1); |
2691 STATIC_ASSERT(kPointerSize == 4); | 2691 STATIC_ASSERT(kPointerSize == 4); |
2692 __ mov(ip, Operand(DescriptorArray::kDescriptorSize)); | 2692 __ mov(ip, Operand(DescriptorArray::kDescriptorSize)); |
2693 __ mul(r3, r3, ip); | 2693 __ mul(r3, r3, ip); |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3004 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1); | 3004 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1); |
3005 | 3005 |
3006 CpuFeatures::Scope scope(VFP2); | 3006 CpuFeatures::Scope scope(VFP2); |
3007 // 0x41300000 is the top half of 1.0 x 2^20 as a double. | 3007 // 0x41300000 is the top half of 1.0 x 2^20 as a double. |
3008 // Create this constant using mov/orr to avoid PC relative load. | 3008 // Create this constant using mov/orr to avoid PC relative load. |
3009 __ mov(r1, Operand(0x41000000)); | 3009 __ mov(r1, Operand(0x41000000)); |
3010 __ orr(r1, r1, Operand(0x300000)); | 3010 __ orr(r1, r1, Operand(0x300000)); |
3011 // Move 0x41300000xxxxxxxx (x = random bits) to VFP. | 3011 // Move 0x41300000xxxxxxxx (x = random bits) to VFP. |
3012 __ vmov(d7, r0, r1); | 3012 __ vmov(d7, r0, r1); |
3013 // Move 0x4130000000000000 to VFP. | 3013 // Move 0x4130000000000000 to VFP. |
3014 __ mov(r0, Operand(0, RelocInfo::NONE)); | 3014 __ mov(r0, Operand::Zero()); |
3015 __ vmov(d8, r0, r1); | 3015 __ vmov(d8, r0, r1); |
3016 // Subtract and store the result in the heap number. | 3016 // Subtract and store the result in the heap number. |
3017 __ vsub(d7, d7, d8); | 3017 __ vsub(d7, d7, d8); |
3018 __ sub(r0, r4, Operand(kHeapObjectTag)); | 3018 __ sub(r0, r4, Operand(kHeapObjectTag)); |
3019 __ vstr(d7, r0, HeapNumber::kValueOffset); | 3019 __ vstr(d7, r0, HeapNumber::kValueOffset); |
3020 __ mov(r0, r4); | 3020 __ mov(r0, r4); |
3021 } else { | 3021 } else { |
3022 __ PrepareCallCFunction(2, r0); | 3022 __ PrepareCallCFunction(2, r0); |
3023 __ ldr(r1, | 3023 __ ldr(r1, |
3024 ContextOperand(context_register(), Context::GLOBAL_OBJECT_INDEX)); | 3024 ContextOperand(context_register(), Context::GLOBAL_OBJECT_INDEX)); |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3587 | 3587 |
3588 __ bind(&non_trivial_array); | 3588 __ bind(&non_trivial_array); |
3589 | 3589 |
3590 // Get the FixedArray containing array's elements. | 3590 // Get the FixedArray containing array's elements. |
3591 elements = array; | 3591 elements = array; |
3592 __ ldr(elements, FieldMemOperand(array, JSArray::kElementsOffset)); | 3592 __ ldr(elements, FieldMemOperand(array, JSArray::kElementsOffset)); |
3593 array = no_reg; // End of array's live range. | 3593 array = no_reg; // End of array's live range. |
3594 | 3594 |
3595 // Check that all array elements are sequential ASCII strings, and | 3595 // Check that all array elements are sequential ASCII strings, and |
3596 // accumulate the sum of their lengths, as a smi-encoded value. | 3596 // accumulate the sum of their lengths, as a smi-encoded value. |
3597 __ mov(string_length, Operand(0)); | 3597 __ mov(string_length, Operand::Zero()); |
3598 __ add(element, | 3598 __ add(element, |
3599 elements, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | 3599 elements, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
3600 __ add(elements_end, element, Operand(array_length, LSL, kPointerSizeLog2)); | 3600 __ add(elements_end, element, Operand(array_length, LSL, kPointerSizeLog2)); |
3601 // Loop condition: while (element < elements_end). | 3601 // Loop condition: while (element < elements_end). |
3602 // Live values in registers: | 3602 // Live values in registers: |
3603 // elements: Fixed array of strings. | 3603 // elements: Fixed array of strings. |
3604 // array_length: Length of the fixed array of strings (not smi) | 3604 // array_length: Length of the fixed array of strings (not smi) |
3605 // separator: Separator string | 3605 // separator: Separator string |
3606 // string_length: Accumulated sum of string lengths (smi). | 3606 // string_length: Accumulated sum of string lengths (smi). |
3607 // element: Current array element. | 3607 // element: Current array element. |
3608 // elements_end: Array end. | 3608 // elements_end: Array end. |
3609 if (generate_debug_code_) { | 3609 if (generate_debug_code_) { |
3610 __ cmp(array_length, Operand(0)); | 3610 __ cmp(array_length, Operand::Zero()); |
3611 __ Assert(gt, "No empty arrays here in EmitFastAsciiArrayJoin"); | 3611 __ Assert(gt, "No empty arrays here in EmitFastAsciiArrayJoin"); |
3612 } | 3612 } |
3613 __ bind(&loop); | 3613 __ bind(&loop); |
3614 __ ldr(string, MemOperand(element, kPointerSize, PostIndex)); | 3614 __ ldr(string, MemOperand(element, kPointerSize, PostIndex)); |
3615 __ JumpIfSmi(string, &bailout); | 3615 __ JumpIfSmi(string, &bailout); |
3616 __ ldr(scratch1, FieldMemOperand(string, HeapObject::kMapOffset)); | 3616 __ ldr(scratch1, FieldMemOperand(string, HeapObject::kMapOffset)); |
3617 __ ldrb(scratch1, FieldMemOperand(scratch1, Map::kInstanceTypeOffset)); | 3617 __ ldrb(scratch1, FieldMemOperand(scratch1, Map::kInstanceTypeOffset)); |
3618 __ JumpIfInstanceTypeIsNotSequentialAscii(scratch1, scratch2, &bailout); | 3618 __ JumpIfInstanceTypeIsNotSequentialAscii(scratch1, scratch2, &bailout); |
3619 __ ldr(scratch1, FieldMemOperand(string, SeqAsciiString::kLengthOffset)); | 3619 __ ldr(scratch1, FieldMemOperand(string, SeqAsciiString::kLengthOffset)); |
3620 __ add(string_length, string_length, Operand(scratch1), SetCC); | 3620 __ add(string_length, string_length, Operand(scratch1), SetCC); |
(...skipping 22 matching lines...) Expand all Loading... |
3643 __ JumpIfInstanceTypeIsNotSequentialAscii(scratch1, scratch2, &bailout); | 3643 __ JumpIfInstanceTypeIsNotSequentialAscii(scratch1, scratch2, &bailout); |
3644 | 3644 |
3645 // Add (separator length times array_length) - separator length to the | 3645 // Add (separator length times array_length) - separator length to the |
3646 // string_length to get the length of the result string. array_length is not | 3646 // string_length to get the length of the result string. array_length is not |
3647 // smi but the other values are, so the result is a smi | 3647 // smi but the other values are, so the result is a smi |
3648 __ ldr(scratch1, FieldMemOperand(separator, SeqAsciiString::kLengthOffset)); | 3648 __ ldr(scratch1, FieldMemOperand(separator, SeqAsciiString::kLengthOffset)); |
3649 __ sub(string_length, string_length, Operand(scratch1)); | 3649 __ sub(string_length, string_length, Operand(scratch1)); |
3650 __ smull(scratch2, ip, array_length, scratch1); | 3650 __ smull(scratch2, ip, array_length, scratch1); |
3651 // Check for smi overflow. No overflow if higher 33 bits of 64-bit result are | 3651 // Check for smi overflow. No overflow if higher 33 bits of 64-bit result are |
3652 // zero. | 3652 // zero. |
3653 __ cmp(ip, Operand(0)); | 3653 __ cmp(ip, Operand::Zero()); |
3654 __ b(ne, &bailout); | 3654 __ b(ne, &bailout); |
3655 __ tst(scratch2, Operand(0x80000000)); | 3655 __ tst(scratch2, Operand(0x80000000)); |
3656 __ b(ne, &bailout); | 3656 __ b(ne, &bailout); |
3657 __ add(string_length, string_length, Operand(scratch2), SetCC); | 3657 __ add(string_length, string_length, Operand(scratch2), SetCC); |
3658 __ b(vs, &bailout); | 3658 __ b(vs, &bailout); |
3659 __ SmiUntag(string_length); | 3659 __ SmiUntag(string_length); |
3660 | 3660 |
3661 // Get first element in the array to free up the elements register to be used | 3661 // Get first element in the array to free up the elements register to be used |
3662 // for the result. | 3662 // for the result. |
3663 __ add(element, | 3663 __ add(element, |
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4325 Split(cond, if_true, if_false, NULL); | 4325 Split(cond, if_true, if_false, NULL); |
4326 __ bind(&slow_case); | 4326 __ bind(&slow_case); |
4327 } | 4327 } |
4328 | 4328 |
4329 // Record position and call the compare IC. | 4329 // Record position and call the compare IC. |
4330 SetSourcePosition(expr->position()); | 4330 SetSourcePosition(expr->position()); |
4331 Handle<Code> ic = CompareIC::GetUninitialized(op); | 4331 Handle<Code> ic = CompareIC::GetUninitialized(op); |
4332 CallIC(ic, RelocInfo::CODE_TARGET, expr->CompareOperationFeedbackId()); | 4332 CallIC(ic, RelocInfo::CODE_TARGET, expr->CompareOperationFeedbackId()); |
4333 patch_site.EmitPatchInfo(); | 4333 patch_site.EmitPatchInfo(); |
4334 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | 4334 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); |
4335 __ cmp(r0, Operand(0)); | 4335 __ cmp(r0, Operand::Zero()); |
4336 Split(cond, if_true, if_false, fall_through); | 4336 Split(cond, if_true, if_false, fall_through); |
4337 } | 4337 } |
4338 } | 4338 } |
4339 | 4339 |
4340 // Convert the result of the comparison into one expected for this | 4340 // Convert the result of the comparison into one expected for this |
4341 // expression's context. | 4341 // expression's context. |
4342 context()->Plug(if_true, if_false); | 4342 context()->Plug(if_true, if_false); |
4343 } | 4343 } |
4344 | 4344 |
4345 | 4345 |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4528 *context_length = 0; | 4528 *context_length = 0; |
4529 return previous_; | 4529 return previous_; |
4530 } | 4530 } |
4531 | 4531 |
4532 | 4532 |
4533 #undef __ | 4533 #undef __ |
4534 | 4534 |
4535 } } // namespace v8::internal | 4535 } } // namespace v8::internal |
4536 | 4536 |
4537 #endif // V8_TARGET_ARCH_ARM | 4537 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |