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

Side by Side Diff: src/arm/full-codegen-arm.cc

Issue 11745030: ARM: generate integer zero in a uniform manner. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 11 months 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 | Annotate | Revision Log
« no previous file with comments | « src/arm/deoptimizer-arm.cc ('k') | src/arm/lithium-codegen-arm.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 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
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 869 matching lines...) Expand 10 before | Expand all | Expand 10 after
1032 __ b(clause->body_target()); 1032 __ b(clause->body_target());
1033 __ bind(&slow_case); 1033 __ bind(&slow_case);
1034 } 1034 }
1035 1035
1036 // Record position before stub call for type feedback. 1036 // Record position before stub call for type feedback.
1037 SetSourcePosition(clause->position()); 1037 SetSourcePosition(clause->position());
1038 Handle<Code> ic = CompareIC::GetUninitialized(Token::EQ_STRICT); 1038 Handle<Code> ic = CompareIC::GetUninitialized(Token::EQ_STRICT);
1039 CallIC(ic, RelocInfo::CODE_TARGET, clause->CompareId()); 1039 CallIC(ic, RelocInfo::CODE_TARGET, clause->CompareId());
1040 patch_site.EmitPatchInfo(); 1040 patch_site.EmitPatchInfo();
1041 1041
1042 __ cmp(r0, Operand(0)); 1042 __ cmp(r0, Operand::Zero());
1043 __ b(ne, &next_test); 1043 __ b(ne, &next_test);
1044 __ Drop(1); // Switch value is no longer needed. 1044 __ Drop(1); // Switch value is no longer needed.
1045 __ b(clause->body_target()); 1045 __ b(clause->body_target());
1046 } 1046 }
1047 1047
1048 // Discard the test value and jump to the default if present, otherwise to 1048 // Discard the test value and jump to the default if present, otherwise to
1049 // the end of the statement. 1049 // the end of the statement.
1050 __ bind(&next_test); 1050 __ bind(&next_test);
1051 __ Drop(1); // Switch value is no longer needed. 1051 __ Drop(1); // Switch value is no longer needed.
1052 if (default_clause == NULL) { 1052 if (default_clause == NULL) {
(...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after
1984 __ sub(scratch1, left, Operand(right), SetCC); 1984 __ sub(scratch1, left, Operand(right), SetCC);
1985 __ b(vs, &stub_call); 1985 __ b(vs, &stub_call);
1986 __ mov(right, scratch1); 1986 __ mov(right, scratch1);
1987 break; 1987 break;
1988 case Token::MUL: { 1988 case Token::MUL: {
1989 __ SmiUntag(ip, right); 1989 __ SmiUntag(ip, right);
1990 __ smull(scratch1, scratch2, left, ip); 1990 __ smull(scratch1, scratch2, left, ip);
1991 __ mov(ip, Operand(scratch1, ASR, 31)); 1991 __ mov(ip, Operand(scratch1, ASR, 31));
1992 __ cmp(ip, Operand(scratch2)); 1992 __ cmp(ip, Operand(scratch2));
1993 __ b(ne, &stub_call); 1993 __ b(ne, &stub_call);
1994 __ cmp(scratch1, Operand(0)); 1994 __ cmp(scratch1, Operand::Zero());
1995 __ mov(right, Operand(scratch1), LeaveCC, ne); 1995 __ mov(right, Operand(scratch1), LeaveCC, ne);
1996 __ b(ne, &done); 1996 __ b(ne, &done);
1997 __ add(scratch2, right, Operand(left), SetCC); 1997 __ add(scratch2, right, Operand(left), SetCC);
1998 __ mov(right, Operand(Smi::FromInt(0)), LeaveCC, pl); 1998 __ mov(right, Operand(Smi::FromInt(0)), LeaveCC, pl);
1999 __ b(mi, &stub_call); 1999 __ b(mi, &stub_call);
2000 break; 2000 break;
2001 } 2001 }
2002 case Token::BIT_OR: 2002 case Token::BIT_OR:
2003 __ orr(right, left, Operand(right)); 2003 __ orr(right, left, Operand(right));
2004 break; 2004 break;
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after
2680 __ cmp(r2, ip); 2680 __ cmp(r2, ip);
2681 __ b(eq, if_false); 2681 __ b(eq, if_false);
2682 2682
2683 // Look for valueOf symbol in the descriptor array, and indicate false if 2683 // Look for valueOf symbol in the descriptor array, and indicate false if
2684 // found. Since we omit an enumeration index check, if it is added via a 2684 // found. Since we omit an enumeration index check, if it is added via a
2685 // transition that shares its descriptor array, this is a false positive. 2685 // transition that shares its descriptor array, this is a false positive.
2686 Label entry, loop, done; 2686 Label entry, loop, done;
2687 2687
2688 // Skip loop if no descriptors are valid. 2688 // Skip loop if no descriptors are valid.
2689 __ NumberOfOwnDescriptors(r3, r1); 2689 __ NumberOfOwnDescriptors(r3, r1);
2690 __ cmp(r3, Operand(0)); 2690 __ cmp(r3, Operand::Zero());
2691 __ b(eq, &done); 2691 __ b(eq, &done);
2692 2692
2693 __ LoadInstanceDescriptors(r1, r4); 2693 __ LoadInstanceDescriptors(r1, r4);
2694 // r4: descriptor array. 2694 // r4: descriptor array.
2695 // r3: valid entries in the descriptor array. 2695 // r3: valid entries in the descriptor array.
2696 STATIC_ASSERT(kSmiTag == 0); 2696 STATIC_ASSERT(kSmiTag == 0);
2697 STATIC_ASSERT(kSmiTagSize == 1); 2697 STATIC_ASSERT(kSmiTagSize == 1);
2698 STATIC_ASSERT(kPointerSize == 4); 2698 STATIC_ASSERT(kPointerSize == 4);
2699 __ mov(ip, Operand(DescriptorArray::kDescriptorSize)); 2699 __ mov(ip, Operand(DescriptorArray::kDescriptorSize));
2700 __ mul(r3, r3, ip); 2700 __ mul(r3, r3, ip);
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
3011 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1); 3011 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1);
3012 3012
3013 CpuFeatures::Scope scope(VFP2); 3013 CpuFeatures::Scope scope(VFP2);
3014 // 0x41300000 is the top half of 1.0 x 2^20 as a double. 3014 // 0x41300000 is the top half of 1.0 x 2^20 as a double.
3015 // Create this constant using mov/orr to avoid PC relative load. 3015 // Create this constant using mov/orr to avoid PC relative load.
3016 __ mov(r1, Operand(0x41000000)); 3016 __ mov(r1, Operand(0x41000000));
3017 __ orr(r1, r1, Operand(0x300000)); 3017 __ orr(r1, r1, Operand(0x300000));
3018 // Move 0x41300000xxxxxxxx (x = random bits) to VFP. 3018 // Move 0x41300000xxxxxxxx (x = random bits) to VFP.
3019 __ vmov(d7, r0, r1); 3019 __ vmov(d7, r0, r1);
3020 // Move 0x4130000000000000 to VFP. 3020 // Move 0x4130000000000000 to VFP.
3021 __ mov(r0, Operand(0, RelocInfo::NONE32)); 3021 __ mov(r0, Operand::Zero());
3022 __ vmov(d8, r0, r1); 3022 __ vmov(d8, r0, r1);
3023 // Subtract and store the result in the heap number. 3023 // Subtract and store the result in the heap number.
3024 __ vsub(d7, d7, d8); 3024 __ vsub(d7, d7, d8);
3025 __ sub(r0, r4, Operand(kHeapObjectTag)); 3025 __ sub(r0, r4, Operand(kHeapObjectTag));
3026 __ vstr(d7, r0, HeapNumber::kValueOffset); 3026 __ vstr(d7, r0, HeapNumber::kValueOffset);
3027 __ mov(r0, r4); 3027 __ mov(r0, r4);
3028 } else { 3028 } else {
3029 __ PrepareCallCFunction(2, r0); 3029 __ PrepareCallCFunction(2, r0);
3030 __ ldr(r1, 3030 __ ldr(r1,
3031 ContextOperand(context_register(), Context::GLOBAL_OBJECT_INDEX)); 3031 ContextOperand(context_register(), Context::GLOBAL_OBJECT_INDEX));
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after
3627 3627
3628 __ bind(&non_trivial_array); 3628 __ bind(&non_trivial_array);
3629 3629
3630 // Get the FixedArray containing array's elements. 3630 // Get the FixedArray containing array's elements.
3631 elements = array; 3631 elements = array;
3632 __ ldr(elements, FieldMemOperand(array, JSArray::kElementsOffset)); 3632 __ ldr(elements, FieldMemOperand(array, JSArray::kElementsOffset));
3633 array = no_reg; // End of array's live range. 3633 array = no_reg; // End of array's live range.
3634 3634
3635 // Check that all array elements are sequential ASCII strings, and 3635 // Check that all array elements are sequential ASCII strings, and
3636 // accumulate the sum of their lengths, as a smi-encoded value. 3636 // accumulate the sum of their lengths, as a smi-encoded value.
3637 __ mov(string_length, Operand(0)); 3637 __ mov(string_length, Operand::Zero());
3638 __ add(element, 3638 __ add(element,
3639 elements, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); 3639 elements, Operand(FixedArray::kHeaderSize - kHeapObjectTag));
3640 __ add(elements_end, element, Operand(array_length, LSL, kPointerSizeLog2)); 3640 __ add(elements_end, element, Operand(array_length, LSL, kPointerSizeLog2));
3641 // Loop condition: while (element < elements_end). 3641 // Loop condition: while (element < elements_end).
3642 // Live values in registers: 3642 // Live values in registers:
3643 // elements: Fixed array of strings. 3643 // elements: Fixed array of strings.
3644 // array_length: Length of the fixed array of strings (not smi) 3644 // array_length: Length of the fixed array of strings (not smi)
3645 // separator: Separator string 3645 // separator: Separator string
3646 // string_length: Accumulated sum of string lengths (smi). 3646 // string_length: Accumulated sum of string lengths (smi).
3647 // element: Current array element. 3647 // element: Current array element.
3648 // elements_end: Array end. 3648 // elements_end: Array end.
3649 if (generate_debug_code_) { 3649 if (generate_debug_code_) {
3650 __ cmp(array_length, Operand(0)); 3650 __ cmp(array_length, Operand::Zero());
3651 __ Assert(gt, "No empty arrays here in EmitFastAsciiArrayJoin"); 3651 __ Assert(gt, "No empty arrays here in EmitFastAsciiArrayJoin");
3652 } 3652 }
3653 __ bind(&loop); 3653 __ bind(&loop);
3654 __ ldr(string, MemOperand(element, kPointerSize, PostIndex)); 3654 __ ldr(string, MemOperand(element, kPointerSize, PostIndex));
3655 __ JumpIfSmi(string, &bailout); 3655 __ JumpIfSmi(string, &bailout);
3656 __ ldr(scratch1, FieldMemOperand(string, HeapObject::kMapOffset)); 3656 __ ldr(scratch1, FieldMemOperand(string, HeapObject::kMapOffset));
3657 __ ldrb(scratch1, FieldMemOperand(scratch1, Map::kInstanceTypeOffset)); 3657 __ ldrb(scratch1, FieldMemOperand(scratch1, Map::kInstanceTypeOffset));
3658 __ JumpIfInstanceTypeIsNotSequentialAscii(scratch1, scratch2, &bailout); 3658 __ JumpIfInstanceTypeIsNotSequentialAscii(scratch1, scratch2, &bailout);
3659 __ ldr(scratch1, FieldMemOperand(string, SeqOneByteString::kLengthOffset)); 3659 __ ldr(scratch1, FieldMemOperand(string, SeqOneByteString::kLengthOffset));
3660 __ add(string_length, string_length, Operand(scratch1), SetCC); 3660 __ add(string_length, string_length, Operand(scratch1), SetCC);
(...skipping 22 matching lines...) Expand all
3683 __ JumpIfInstanceTypeIsNotSequentialAscii(scratch1, scratch2, &bailout); 3683 __ JumpIfInstanceTypeIsNotSequentialAscii(scratch1, scratch2, &bailout);
3684 3684
3685 // Add (separator length times array_length) - separator length to the 3685 // Add (separator length times array_length) - separator length to the
3686 // string_length to get the length of the result string. array_length is not 3686 // string_length to get the length of the result string. array_length is not
3687 // smi but the other values are, so the result is a smi 3687 // smi but the other values are, so the result is a smi
3688 __ ldr(scratch1, FieldMemOperand(separator, SeqOneByteString::kLengthOffset)); 3688 __ ldr(scratch1, FieldMemOperand(separator, SeqOneByteString::kLengthOffset));
3689 __ sub(string_length, string_length, Operand(scratch1)); 3689 __ sub(string_length, string_length, Operand(scratch1));
3690 __ smull(scratch2, ip, array_length, scratch1); 3690 __ smull(scratch2, ip, array_length, scratch1);
3691 // Check for smi overflow. No overflow if higher 33 bits of 64-bit result are 3691 // Check for smi overflow. No overflow if higher 33 bits of 64-bit result are
3692 // zero. 3692 // zero.
3693 __ cmp(ip, Operand(0)); 3693 __ cmp(ip, Operand::Zero());
3694 __ b(ne, &bailout); 3694 __ b(ne, &bailout);
3695 __ tst(scratch2, Operand(0x80000000)); 3695 __ tst(scratch2, Operand(0x80000000));
3696 __ b(ne, &bailout); 3696 __ b(ne, &bailout);
3697 __ add(string_length, string_length, Operand(scratch2), SetCC); 3697 __ add(string_length, string_length, Operand(scratch2), SetCC);
3698 __ b(vs, &bailout); 3698 __ b(vs, &bailout);
3699 __ SmiUntag(string_length); 3699 __ SmiUntag(string_length);
3700 3700
3701 // Get first element in the array to free up the elements register to be used 3701 // Get first element in the array to free up the elements register to be used
3702 // for the result. 3702 // for the result.
3703 __ add(element, 3703 __ add(element,
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
4350 Split(cond, if_true, if_false, NULL); 4350 Split(cond, if_true, if_false, NULL);
4351 __ bind(&slow_case); 4351 __ bind(&slow_case);
4352 } 4352 }
4353 4353
4354 // Record position and call the compare IC. 4354 // Record position and call the compare IC.
4355 SetSourcePosition(expr->position()); 4355 SetSourcePosition(expr->position());
4356 Handle<Code> ic = CompareIC::GetUninitialized(op); 4356 Handle<Code> ic = CompareIC::GetUninitialized(op);
4357 CallIC(ic, RelocInfo::CODE_TARGET, expr->CompareOperationFeedbackId()); 4357 CallIC(ic, RelocInfo::CODE_TARGET, expr->CompareOperationFeedbackId());
4358 patch_site.EmitPatchInfo(); 4358 patch_site.EmitPatchInfo();
4359 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); 4359 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false);
4360 __ cmp(r0, Operand(0)); 4360 __ cmp(r0, Operand::Zero());
4361 Split(cond, if_true, if_false, fall_through); 4361 Split(cond, if_true, if_false, fall_through);
4362 } 4362 }
4363 } 4363 }
4364 4364
4365 // Convert the result of the comparison into one expected for this 4365 // Convert the result of the comparison into one expected for this
4366 // expression's context. 4366 // expression's context.
4367 context()->Plug(if_true, if_false); 4367 context()->Plug(if_true, if_false);
4368 } 4368 }
4369 4369
4370 4370
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
4553 *context_length = 0; 4553 *context_length = 0;
4554 return previous_; 4554 return previous_;
4555 } 4555 }
4556 4556
4557 4557
4558 #undef __ 4558 #undef __
4559 4559
4560 } } // namespace v8::internal 4560 } } // namespace v8::internal
4561 4561
4562 #endif // V8_TARGET_ARCH_ARM 4562 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/deoptimizer-arm.cc ('k') | src/arm/lithium-codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698