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 2258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2269 __ fmul_i(1); | 2269 __ fmul_i(1); |
2270 break; | 2270 break; |
2271 case Token::DIV: | 2271 case Token::DIV: |
2272 __ fdiv_i(1); | 2272 __ fdiv_i(1); |
2273 break; | 2273 break; |
2274 case Token::MOD: { | 2274 case Token::MOD: { |
2275 // Pass two doubles as arguments on the stack. | 2275 // Pass two doubles as arguments on the stack. |
2276 __ PrepareCallCFunction(4, eax); | 2276 __ PrepareCallCFunction(4, eax); |
2277 X87Mov(Operand(esp, 1 * kDoubleSize), right); | 2277 X87Mov(Operand(esp, 1 * kDoubleSize), right); |
2278 X87Mov(Operand(esp, 0), left); | 2278 X87Mov(Operand(esp, 0), left); |
| 2279 X87Free(right); |
| 2280 ASSERT(left.is(result)); |
2279 X87PrepareToWrite(result); | 2281 X87PrepareToWrite(result); |
2280 __ CallCFunction( | 2282 __ CallCFunction( |
2281 ExternalReference::double_fp_operation(Token::MOD, isolate()), | 2283 ExternalReference::double_fp_operation(Token::MOD, isolate()), |
2282 4); | 2284 4); |
2283 | 2285 |
2284 // Return value is in st(0) on ia32. | 2286 // Return value is in st(0) on ia32. |
2285 X87CommitWrite(result); | 2287 X87CommitWrite(result); |
2286 break; | 2288 break; |
2287 } | 2289 } |
2288 default: | 2290 default: |
(...skipping 2720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5009 Register input = ToRegister(instr->value()); | 5011 Register input = ToRegister(instr->value()); |
5010 __ SmiTag(input); | 5012 __ SmiTag(input); |
5011 if (!instr->hydrogen()->value()->HasRange() || | 5013 if (!instr->hydrogen()->value()->HasRange() || |
5012 !instr->hydrogen()->value()->range()->IsInSmiRange()) { | 5014 !instr->hydrogen()->value()->range()->IsInSmiRange()) { |
5013 DeoptimizeIf(overflow, instr->environment()); | 5015 DeoptimizeIf(overflow, instr->environment()); |
5014 } | 5016 } |
5015 } | 5017 } |
5016 | 5018 |
5017 | 5019 |
5018 void LCodeGen::DoUint32ToDouble(LUint32ToDouble* instr) { | 5020 void LCodeGen::DoUint32ToDouble(LUint32ToDouble* instr) { |
5019 CpuFeatureScope scope(masm(), SSE2); | |
5020 LOperand* input = instr->value(); | 5021 LOperand* input = instr->value(); |
5021 LOperand* output = instr->result(); | 5022 LOperand* output = instr->result(); |
5022 LOperand* temp = instr->temp(); | 5023 if (CpuFeatures::IsSupported(SSE2)) { |
| 5024 CpuFeatureScope scope(masm(), SSE2); |
| 5025 LOperand* temp = instr->temp(); |
5023 | 5026 |
5024 __ LoadUint32(ToDoubleRegister(output), | 5027 __ LoadUint32(ToDoubleRegister(output), |
5025 ToRegister(input), | 5028 ToRegister(input), |
5026 ToDoubleRegister(temp)); | 5029 ToDoubleRegister(temp)); |
| 5030 } else { |
| 5031 X87Register res = ToX87Register(output); |
| 5032 X87PrepareToWrite(res); |
| 5033 __ LoadUint32NoSSE2(ToRegister(input)); |
| 5034 X87CommitWrite(res); |
| 5035 } |
5027 } | 5036 } |
5028 | 5037 |
5029 | 5038 |
5030 void LCodeGen::DoNumberTagI(LNumberTagI* instr) { | 5039 void LCodeGen::DoNumberTagI(LNumberTagI* instr) { |
5031 class DeferredNumberTagI V8_FINAL : public LDeferredCode { | 5040 class DeferredNumberTagI V8_FINAL : public LDeferredCode { |
5032 public: | 5041 public: |
5033 DeferredNumberTagI(LCodeGen* codegen, | 5042 DeferredNumberTagI(LCodeGen* codegen, |
5034 LNumberTagI* instr, | 5043 LNumberTagI* instr, |
5035 const X87Stack& x87_stack) | 5044 const X87Stack& x87_stack) |
5036 : LDeferredCode(codegen, x87_stack), instr_(instr) { } | 5045 : LDeferredCode(codegen, x87_stack), instr_(instr) { } |
(...skipping 1345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6382 FixedArray::kHeaderSize - kPointerSize)); | 6391 FixedArray::kHeaderSize - kPointerSize)); |
6383 __ bind(&done); | 6392 __ bind(&done); |
6384 } | 6393 } |
6385 | 6394 |
6386 | 6395 |
6387 #undef __ | 6396 #undef __ |
6388 | 6397 |
6389 } } // namespace v8::internal | 6398 } } // namespace v8::internal |
6390 | 6399 |
6391 #endif // V8_TARGET_ARCH_IA32 | 6400 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |