 Chromium Code Reviews
 Chromium Code Reviews Issue 8769037:
  Quickfix for DoMathPowHalf.  (Closed) 
  Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
    
  
    Issue 8769037:
  Quickfix for DoMathPowHalf.  (Closed) 
  Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge| OLD | NEW | 
|---|---|
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 2920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2931 XMMRegister input_reg = ToDoubleRegister(instr->value()); | 2931 XMMRegister input_reg = ToDoubleRegister(instr->value()); | 
| 2932 ASSERT(ToDoubleRegister(instr->result()).is(input_reg)); | 2932 ASSERT(ToDoubleRegister(instr->result()).is(input_reg)); | 
| 2933 __ sqrtsd(input_reg, input_reg); | 2933 __ sqrtsd(input_reg, input_reg); | 
| 2934 } | 2934 } | 
| 2935 | 2935 | 
| 2936 | 2936 | 
| 2937 void LCodeGen::DoMathPowHalf(LUnaryMathOperation* instr) { | 2937 void LCodeGen::DoMathPowHalf(LUnaryMathOperation* instr) { | 
| 2938 XMMRegister xmm_scratch = xmm0; | 2938 XMMRegister xmm_scratch = xmm0; | 
| 2939 XMMRegister input_reg = ToDoubleRegister(instr->value()); | 2939 XMMRegister input_reg = ToDoubleRegister(instr->value()); | 
| 2940 ASSERT(ToDoubleRegister(instr->result()).is(input_reg)); | 2940 ASSERT(ToDoubleRegister(instr->result()).is(input_reg)); | 
| 2941 | |
| 2942 Label return_infinity, done; | |
| 2943 // Check base for +/- infinity. | |
| 2944 __ push(ecx); | |
| 
Erik Corry
2011/12/02 13:11:02
This is nasty.  We have support for allocating tem
 | |
| 2945 __ mov(ecx, factory()->infinity_value()); | |
| 2946 __ ucomisd(input_reg, FieldOperand(ecx, HeapNumber::kValueOffset)); | |
| 2947 __ j(equal, &return_infinity, Label::kNear); | |
| 2948 __ xorps(xmm_scratch, xmm_scratch); | |
| 2949 __ subsd(xmm_scratch, input_reg); | |
| 2950 __ ucomisd(xmm_scratch, FieldOperand(ecx, HeapNumber::kValueOffset)); | |
| 2951 __ j(equal, &return_infinity, Label::kNear); | |
| 2952 | |
| 2953 __ pop(ecx); | |
| 2941 __ xorps(xmm_scratch, xmm_scratch); | 2954 __ xorps(xmm_scratch, xmm_scratch); | 
| 2942 __ addsd(input_reg, xmm_scratch); // Convert -0 to +0. | 2955 __ addsd(input_reg, xmm_scratch); // Convert -0 to +0. | 
| 2943 __ sqrtsd(input_reg, input_reg); | 2956 __ sqrtsd(input_reg, input_reg); | 
| 2957 __ jmp(&done, Label::kNear); | |
| 2958 | |
| 2959 __ bind(&return_infinity); | |
| 2960 __ movdbl(input_reg, FieldOperand(ecx, HeapNumber::kValueOffset)); | |
| 2961 __ pop(ecx); | |
| 2962 __ bind(&done); | |
| 2944 } | 2963 } | 
| 2945 | 2964 | 
| 2946 | 2965 | 
| 2947 void LCodeGen::DoPower(LPower* instr) { | 2966 void LCodeGen::DoPower(LPower* instr) { | 
| 2948 Representation exponent_type = instr->hydrogen()->right()->representation(); | 2967 Representation exponent_type = instr->hydrogen()->right()->representation(); | 
| 2949 // Having marked this as a call, we can use any registers. | 2968 // Having marked this as a call, we can use any registers. | 
| 2950 // Just make sure that the input registers are the expected ones. | 2969 // Just make sure that the input registers are the expected ones. | 
| 2951 ASSERT(!instr->InputAt(1)->IsDoubleRegister() || | 2970 ASSERT(!instr->InputAt(1)->IsDoubleRegister() || | 
| 2952 ToDoubleRegister(instr->InputAt(1)).is(xmm2)); | 2971 ToDoubleRegister(instr->InputAt(1)).is(xmm2)); | 
| 2953 ASSERT(!instr->InputAt(1)->IsRegister() || | 2972 ASSERT(!instr->InputAt(1)->IsRegister() || | 
| (...skipping 1646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4600 this, pointers, Safepoint::kLazyDeopt); | 4619 this, pointers, Safepoint::kLazyDeopt); | 
| 4601 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); | 4620 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); | 
| 4602 } | 4621 } | 
| 4603 | 4622 | 
| 4604 | 4623 | 
| 4605 #undef __ | 4624 #undef __ | 
| 4606 | 4625 | 
| 4607 } } // namespace v8::internal | 4626 } } // namespace v8::internal | 
| 4608 | 4627 | 
| 4609 #endif // V8_TARGET_ARCH_IA32 | 4628 #endif // V8_TARGET_ARCH_IA32 | 
| OLD | NEW |