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

Side by Side Diff: src/arm/code-stubs-arm.cc

Issue 12254036: Minor cleanup of CompareIC state (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Actually address all comments Created 7 years, 10 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/code-stubs-arm.h ('k') | src/code-stubs.h » ('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 1723 matching lines...) Expand 10 before | Expand all | Expand 10 after
1734 1734
1735 1735
1736 static void ICCompareStub_CheckInputType(MacroAssembler* masm, 1736 static void ICCompareStub_CheckInputType(MacroAssembler* masm,
1737 Register input, 1737 Register input,
1738 Register scratch, 1738 Register scratch,
1739 CompareIC::State expected, 1739 CompareIC::State expected,
1740 Label* fail) { 1740 Label* fail) {
1741 Label ok; 1741 Label ok;
1742 if (expected == CompareIC::SMI) { 1742 if (expected == CompareIC::SMI) {
1743 __ JumpIfNotSmi(input, fail); 1743 __ JumpIfNotSmi(input, fail);
1744 } else if (expected == CompareIC::HEAP_NUMBER) { 1744 } else if (expected == CompareIC::NUMBER) {
1745 __ JumpIfSmi(input, &ok); 1745 __ JumpIfSmi(input, &ok);
1746 __ CheckMap(input, scratch, Heap::kHeapNumberMapRootIndex, fail, 1746 __ CheckMap(input, scratch, Heap::kHeapNumberMapRootIndex, fail,
1747 DONT_DO_SMI_CHECK); 1747 DONT_DO_SMI_CHECK);
1748 } 1748 }
1749 // We could be strict about symbol/string here, but as long as 1749 // We could be strict about symbol/string here, but as long as
1750 // hydrogen doesn't care, the stub doesn't have to care either. 1750 // hydrogen doesn't care, the stub doesn't have to care either.
1751 __ bind(&ok); 1751 __ bind(&ok);
1752 } 1752 }
1753 1753
1754 1754
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
2134 2134
2135 // TODO(svenpanne): Use virtual functions instead of switch. 2135 // TODO(svenpanne): Use virtual functions instead of switch.
2136 void UnaryOpStub::Generate(MacroAssembler* masm) { 2136 void UnaryOpStub::Generate(MacroAssembler* masm) {
2137 switch (operand_type_) { 2137 switch (operand_type_) {
2138 case UnaryOpIC::UNINITIALIZED: 2138 case UnaryOpIC::UNINITIALIZED:
2139 GenerateTypeTransition(masm); 2139 GenerateTypeTransition(masm);
2140 break; 2140 break;
2141 case UnaryOpIC::SMI: 2141 case UnaryOpIC::SMI:
2142 GenerateSmiStub(masm); 2142 GenerateSmiStub(masm);
2143 break; 2143 break;
2144 case UnaryOpIC::HEAP_NUMBER: 2144 case UnaryOpIC::NUMBER:
2145 GenerateHeapNumberStub(masm); 2145 GenerateNumberStub(masm);
2146 break; 2146 break;
2147 case UnaryOpIC::GENERIC: 2147 case UnaryOpIC::GENERIC:
2148 GenerateGenericStub(masm); 2148 GenerateGenericStub(masm);
2149 break; 2149 break;
2150 } 2150 }
2151 } 2151 }
2152 2152
2153 2153
2154 void UnaryOpStub::GenerateTypeTransition(MacroAssembler* masm) { 2154 void UnaryOpStub::GenerateTypeTransition(MacroAssembler* masm) {
2155 __ mov(r3, Operand(r0)); // the operand 2155 __ mov(r3, Operand(r0)); // the operand
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
2215 __ JumpIfNotSmi(r0, non_smi); 2215 __ JumpIfNotSmi(r0, non_smi);
2216 2216
2217 // Flip bits and revert inverted smi-tag. 2217 // Flip bits and revert inverted smi-tag.
2218 __ mvn(r0, Operand(r0)); 2218 __ mvn(r0, Operand(r0));
2219 __ bic(r0, r0, Operand(kSmiTagMask)); 2219 __ bic(r0, r0, Operand(kSmiTagMask));
2220 __ Ret(); 2220 __ Ret();
2221 } 2221 }
2222 2222
2223 2223
2224 // TODO(svenpanne): Use virtual functions instead of switch. 2224 // TODO(svenpanne): Use virtual functions instead of switch.
2225 void UnaryOpStub::GenerateHeapNumberStub(MacroAssembler* masm) { 2225 void UnaryOpStub::GenerateNumberStub(MacroAssembler* masm) {
2226 switch (op_) { 2226 switch (op_) {
2227 case Token::SUB: 2227 case Token::SUB:
2228 GenerateHeapNumberStubSub(masm); 2228 GenerateNumberStubSub(masm);
2229 break; 2229 break;
2230 case Token::BIT_NOT: 2230 case Token::BIT_NOT:
2231 GenerateHeapNumberStubBitNot(masm); 2231 GenerateNumberStubBitNot(masm);
2232 break; 2232 break;
2233 default: 2233 default:
2234 UNREACHABLE(); 2234 UNREACHABLE();
2235 } 2235 }
2236 } 2236 }
2237 2237
2238 2238
2239 void UnaryOpStub::GenerateHeapNumberStubSub(MacroAssembler* masm) { 2239 void UnaryOpStub::GenerateNumberStubSub(MacroAssembler* masm) {
2240 Label non_smi, slow, call_builtin; 2240 Label non_smi, slow, call_builtin;
2241 GenerateSmiCodeSub(masm, &non_smi, &call_builtin); 2241 GenerateSmiCodeSub(masm, &non_smi, &call_builtin);
2242 __ bind(&non_smi); 2242 __ bind(&non_smi);
2243 GenerateHeapNumberCodeSub(masm, &slow); 2243 GenerateHeapNumberCodeSub(masm, &slow);
2244 __ bind(&slow); 2244 __ bind(&slow);
2245 GenerateTypeTransition(masm); 2245 GenerateTypeTransition(masm);
2246 __ bind(&call_builtin); 2246 __ bind(&call_builtin);
2247 GenerateGenericCodeFallback(masm); 2247 GenerateGenericCodeFallback(masm);
2248 } 2248 }
2249 2249
2250 2250
2251 void UnaryOpStub::GenerateHeapNumberStubBitNot(MacroAssembler* masm) { 2251 void UnaryOpStub::GenerateNumberStubBitNot(MacroAssembler* masm) {
2252 Label non_smi, slow; 2252 Label non_smi, slow;
2253 GenerateSmiCodeBitNot(masm, &non_smi); 2253 GenerateSmiCodeBitNot(masm, &non_smi);
2254 __ bind(&non_smi); 2254 __ bind(&non_smi);
2255 GenerateHeapNumberCodeBitNot(masm, &slow); 2255 GenerateHeapNumberCodeBitNot(masm, &slow);
2256 __ bind(&slow); 2256 __ bind(&slow);
2257 GenerateTypeTransition(masm); 2257 GenerateTypeTransition(masm);
2258 } 2258 }
2259 2259
2260 void UnaryOpStub::GenerateHeapNumberCodeSub(MacroAssembler* masm, 2260 void UnaryOpStub::GenerateHeapNumberCodeSub(MacroAssembler* masm,
2261 Label* slow) { 2261 Label* slow) {
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
2703 // Load the operands. 2703 // Load the operands.
2704 if (smi_operands) { 2704 if (smi_operands) {
2705 FloatingPointHelper::LoadSmis(masm, destination, scratch1, scratch2); 2705 FloatingPointHelper::LoadSmis(masm, destination, scratch1, scratch2);
2706 } else { 2706 } else {
2707 // Load right operand to d7 or r2/r3. 2707 // Load right operand to d7 or r2/r3.
2708 if (right_type == BinaryOpIC::INT32) { 2708 if (right_type == BinaryOpIC::INT32) {
2709 FloatingPointHelper::LoadNumberAsInt32Double( 2709 FloatingPointHelper::LoadNumberAsInt32Double(
2710 masm, right, destination, d7, d8, r2, r3, heap_number_map, 2710 masm, right, destination, d7, d8, r2, r3, heap_number_map,
2711 scratch1, scratch2, s0, miss); 2711 scratch1, scratch2, s0, miss);
2712 } else { 2712 } else {
2713 Label* fail = (right_type == BinaryOpIC::HEAP_NUMBER) ? miss 2713 Label* fail = (right_type == BinaryOpIC::NUMBER) ? miss : not_numbers;
2714 : not_numbers;
2715 FloatingPointHelper::LoadNumber( 2714 FloatingPointHelper::LoadNumber(
2716 masm, destination, right, d7, r2, r3, heap_number_map, 2715 masm, destination, right, d7, r2, r3, heap_number_map,
2717 scratch1, scratch2, fail); 2716 scratch1, scratch2, fail);
2718 } 2717 }
2719 // Load left operand to d6 or r0/r1. This keeps r0/r1 intact if it 2718 // Load left operand to d6 or r0/r1. This keeps r0/r1 intact if it
2720 // jumps to |miss|. 2719 // jumps to |miss|.
2721 if (left_type == BinaryOpIC::INT32) { 2720 if (left_type == BinaryOpIC::INT32) {
2722 FloatingPointHelper::LoadNumberAsInt32Double( 2721 FloatingPointHelper::LoadNumberAsInt32Double(
2723 masm, left, destination, d6, d8, r0, r1, heap_number_map, 2722 masm, left, destination, d6, d8, r0, r1, heap_number_map,
2724 scratch1, scratch2, s0, miss); 2723 scratch1, scratch2, s0, miss);
2725 } else { 2724 } else {
2726 Label* fail = (left_type == BinaryOpIC::HEAP_NUMBER) ? miss 2725 Label* fail = (left_type == BinaryOpIC::NUMBER) ? miss : not_numbers;
2727 : not_numbers;
2728 FloatingPointHelper::LoadNumber( 2726 FloatingPointHelper::LoadNumber(
2729 masm, destination, left, d6, r0, r1, heap_number_map, 2727 masm, destination, left, d6, r0, r1, heap_number_map,
2730 scratch1, scratch2, fail); 2728 scratch1, scratch2, fail);
2731 } 2729 }
2732 } 2730 }
2733 2731
2734 // Calculate the result. 2732 // Calculate the result.
2735 if (destination == FloatingPointHelper::kVFPRegisters) { 2733 if (destination == FloatingPointHelper::kVFPRegisters) {
2736 // Using VFP registers: 2734 // Using VFP registers:
2737 // d6: Left value 2735 // d6: Left value
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
3113 // Tag the result and return. 3111 // Tag the result and return.
3114 __ SmiTag(r0, scratch1); 3112 __ SmiTag(r0, scratch1);
3115 __ Ret(); 3113 __ Ret();
3116 } else { 3114 } else {
3117 // DIV just falls through to allocating a heap number. 3115 // DIV just falls through to allocating a heap number.
3118 } 3116 }
3119 3117
3120 __ bind(&return_heap_number); 3118 __ bind(&return_heap_number);
3121 // Return a heap number, or fall through to type transition or runtime 3119 // Return a heap number, or fall through to type transition or runtime
3122 // call if we can't. 3120 // call if we can't.
3123 if (result_type_ >= ((op_ == Token::DIV) ? BinaryOpIC::HEAP_NUMBER 3121 if (result_type_ >= ((op_ == Token::DIV) ? BinaryOpIC::NUMBER
3124 : BinaryOpIC::INT32)) { 3122 : BinaryOpIC::INT32)) {
3125 // We are using vfp registers so r5 is available. 3123 // We are using vfp registers so r5 is available.
3126 heap_number_result = r5; 3124 heap_number_result = r5;
3127 BinaryOpStub_GenerateHeapResultAllocation(masm, 3125 BinaryOpStub_GenerateHeapResultAllocation(masm,
3128 heap_number_result, 3126 heap_number_result,
3129 heap_number_map, 3127 heap_number_map,
3130 scratch1, 3128 scratch1,
3131 scratch2, 3129 scratch2,
3132 &call_runtime, 3130 &call_runtime,
3133 mode_); 3131 mode_);
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
3337 __ bind(&check); 3335 __ bind(&check);
3338 __ CompareRoot(r0, Heap::kUndefinedValueRootIndex); 3336 __ CompareRoot(r0, Heap::kUndefinedValueRootIndex);
3339 __ b(ne, &done); 3337 __ b(ne, &done);
3340 if (Token::IsBitOp(op_)) { 3338 if (Token::IsBitOp(op_)) {
3341 __ mov(r0, Operand(Smi::FromInt(0))); 3339 __ mov(r0, Operand(Smi::FromInt(0)));
3342 } else { 3340 } else {
3343 __ LoadRoot(r0, Heap::kNanValueRootIndex); 3341 __ LoadRoot(r0, Heap::kNanValueRootIndex);
3344 } 3342 }
3345 __ bind(&done); 3343 __ bind(&done);
3346 3344
3347 GenerateHeapNumberStub(masm); 3345 GenerateNumberStub(masm);
3348 } 3346 }
3349 3347
3350 3348
3351 void BinaryOpStub::GenerateHeapNumberStub(MacroAssembler* masm) { 3349 void BinaryOpStub::GenerateNumberStub(MacroAssembler* masm) {
3352 Label call_runtime, transition; 3350 Label call_runtime, transition;
3353 BinaryOpStub_GenerateFPOperation( 3351 BinaryOpStub_GenerateFPOperation(
3354 masm, left_type_, right_type_, false, 3352 masm, left_type_, right_type_, false,
3355 &transition, &call_runtime, &transition, op_, mode_); 3353 &transition, &call_runtime, &transition, op_, mode_);
3356 3354
3357 __ bind(&transition); 3355 __ bind(&transition);
3358 GenerateTypeTransition(masm); 3356 GenerateTypeTransition(masm);
3359 3357
3360 __ bind(&call_runtime); 3358 __ bind(&call_runtime);
3361 GenerateRegisterArgsPush(masm); 3359 GenerateRegisterArgsPush(masm);
(...skipping 3602 matching lines...) Expand 10 before | Expand all | Expand 10 after
6964 __ SmiUntag(r1); 6962 __ SmiUntag(r1);
6965 __ sub(r0, r1, SmiUntagOperand(r0)); 6963 __ sub(r0, r1, SmiUntagOperand(r0));
6966 } 6964 }
6967 __ Ret(); 6965 __ Ret();
6968 6966
6969 __ bind(&miss); 6967 __ bind(&miss);
6970 GenerateMiss(masm); 6968 GenerateMiss(masm);
6971 } 6969 }
6972 6970
6973 6971
6974 void ICCompareStub::GenerateHeapNumbers(MacroAssembler* masm) { 6972 void ICCompareStub::GenerateNumbers(MacroAssembler* masm) {
6975 ASSERT(state_ == CompareIC::HEAP_NUMBER); 6973 ASSERT(state_ == CompareIC::NUMBER);
6976 6974
6977 Label generic_stub; 6975 Label generic_stub;
6978 Label unordered, maybe_undefined1, maybe_undefined2; 6976 Label unordered, maybe_undefined1, maybe_undefined2;
6979 Label miss; 6977 Label miss;
6980 6978
6981 if (left_ == CompareIC::SMI) { 6979 if (left_ == CompareIC::SMI) {
6982 __ JumpIfNotSmi(r1, &miss); 6980 __ JumpIfNotSmi(r1, &miss);
6983 } 6981 }
6984 if (right_ == CompareIC::SMI) { 6982 if (right_ == CompareIC::SMI) {
6985 __ JumpIfNotSmi(r0, &miss); 6983 __ JumpIfNotSmi(r0, &miss);
(...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after
7946 7944
7947 __ Pop(lr, r5, r1); 7945 __ Pop(lr, r5, r1);
7948 __ Ret(); 7946 __ Ret();
7949 } 7947 }
7950 7948
7951 #undef __ 7949 #undef __
7952 7950
7953 } } // namespace v8::internal 7951 } } // namespace v8::internal
7954 7952
7955 #endif // V8_TARGET_ARCH_ARM 7953 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/code-stubs-arm.h ('k') | src/code-stubs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698