| 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 1327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1338 case Token::MUL: | 1338 case Token::MUL: |
| 1339 __ vmul(left, left, right); | 1339 __ vmul(left, left, right); |
| 1340 break; | 1340 break; |
| 1341 case Token::DIV: | 1341 case Token::DIV: |
| 1342 __ vdiv(left, left, right); | 1342 __ vdiv(left, left, right); |
| 1343 break; | 1343 break; |
| 1344 case Token::MOD: { | 1344 case Token::MOD: { |
| 1345 // Save r0-r3 on the stack. | 1345 // Save r0-r3 on the stack. |
| 1346 __ stm(db_w, sp, r0.bit() | r1.bit() | r2.bit() | r3.bit()); | 1346 __ stm(db_w, sp, r0.bit() | r1.bit() | r2.bit() | r3.bit()); |
| 1347 | 1347 |
| 1348 __ PrepareCallCFunction(4, scratch0()); | 1348 __ PrepareCallCFunction(0, 2, scratch0()); |
| 1349 __ vmov(r0, r1, left); | 1349 __ SetCallCDoubleArguments(left, right); |
| 1350 __ vmov(r2, r3, right); | |
| 1351 __ CallCFunction( | 1350 __ CallCFunction( |
| 1352 ExternalReference::double_fp_operation(Token::MOD, isolate()), 4); | 1351 ExternalReference::double_fp_operation(Token::MOD, isolate()), |
| 1352 0, 2); |
| 1353 // Move the result in the double result register. | 1353 // Move the result in the double result register. |
| 1354 __ GetCFunctionDoubleResult(ToDoubleRegister(instr->result())); | 1354 __ GetCFunctionDoubleResult(ToDoubleRegister(instr->result())); |
| 1355 | 1355 |
| 1356 // Restore r0-r3. | 1356 // Restore r0-r3. |
| 1357 __ ldm(ia_w, sp, r0.bit() | r1.bit() | r2.bit() | r3.bit()); | 1357 __ ldm(ia_w, sp, r0.bit() | r1.bit() | r2.bit() | r3.bit()); |
| 1358 break; | 1358 break; |
| 1359 } | 1359 } |
| 1360 default: | 1360 default: |
| 1361 UNREACHABLE(); | 1361 UNREACHABLE(); |
| 1362 break; | 1362 break; |
| (...skipping 1596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2959 | 2959 |
| 2960 | 2960 |
| 2961 void LCodeGen::DoPower(LPower* instr) { | 2961 void LCodeGen::DoPower(LPower* instr) { |
| 2962 LOperand* left = instr->InputAt(0); | 2962 LOperand* left = instr->InputAt(0); |
| 2963 LOperand* right = instr->InputAt(1); | 2963 LOperand* right = instr->InputAt(1); |
| 2964 Register scratch = scratch0(); | 2964 Register scratch = scratch0(); |
| 2965 DoubleRegister result_reg = ToDoubleRegister(instr->result()); | 2965 DoubleRegister result_reg = ToDoubleRegister(instr->result()); |
| 2966 Representation exponent_type = instr->hydrogen()->right()->representation(); | 2966 Representation exponent_type = instr->hydrogen()->right()->representation(); |
| 2967 if (exponent_type.IsDouble()) { | 2967 if (exponent_type.IsDouble()) { |
| 2968 // Prepare arguments and call C function. | 2968 // Prepare arguments and call C function. |
| 2969 __ PrepareCallCFunction(4, scratch); | 2969 __ PrepareCallCFunction(0, 2, scratch); |
| 2970 __ vmov(r0, r1, ToDoubleRegister(left)); | 2970 __ SetCallCDoubleArguments(ToDoubleRegister(left), |
| 2971 __ vmov(r2, r3, ToDoubleRegister(right)); | 2971 ToDoubleRegister(right)); |
| 2972 __ CallCFunction( | 2972 __ CallCFunction( |
| 2973 ExternalReference::power_double_double_function(isolate()), 4); | 2973 ExternalReference::power_double_double_function(isolate()), 0, 2); |
| 2974 } else if (exponent_type.IsInteger32()) { | 2974 } else if (exponent_type.IsInteger32()) { |
| 2975 ASSERT(ToRegister(right).is(r0)); | 2975 ASSERT(ToRegister(right).is(r0)); |
| 2976 // Prepare arguments and call C function. | 2976 // Prepare arguments and call C function. |
| 2977 __ PrepareCallCFunction(4, scratch); | 2977 __ PrepareCallCFunction(1, 1, scratch); |
| 2978 __ mov(r2, ToRegister(right)); | 2978 __ SetCallCDoubleArguments(ToDoubleRegister(left), ToRegister(right)); |
| 2979 __ vmov(r0, r1, ToDoubleRegister(left)); | |
| 2980 __ CallCFunction( | 2979 __ CallCFunction( |
| 2981 ExternalReference::power_double_int_function(isolate()), 4); | 2980 ExternalReference::power_double_int_function(isolate()), 1, 1); |
| 2982 } else { | 2981 } else { |
| 2983 ASSERT(exponent_type.IsTagged()); | 2982 ASSERT(exponent_type.IsTagged()); |
| 2984 ASSERT(instr->hydrogen()->left()->representation().IsDouble()); | 2983 ASSERT(instr->hydrogen()->left()->representation().IsDouble()); |
| 2985 | 2984 |
| 2986 Register right_reg = ToRegister(right); | 2985 Register right_reg = ToRegister(right); |
| 2987 | 2986 |
| 2988 // Check for smi on the right hand side. | 2987 // Check for smi on the right hand side. |
| 2989 Label non_smi, call; | 2988 Label non_smi, call; |
| 2990 __ JumpIfNotSmi(right_reg, &non_smi); | 2989 __ JumpIfNotSmi(right_reg, &non_smi); |
| 2991 | 2990 |
| 2992 // Untag smi and convert it to a double. | 2991 // Untag smi and convert it to a double. |
| 2993 __ SmiUntag(right_reg); | 2992 __ SmiUntag(right_reg); |
| 2994 SwVfpRegister single_scratch = double_scratch0().low(); | 2993 SwVfpRegister single_scratch = double_scratch0().low(); |
| 2995 __ vmov(single_scratch, right_reg); | 2994 __ vmov(single_scratch, right_reg); |
| 2996 __ vcvt_f64_s32(result_reg, single_scratch); | 2995 __ vcvt_f64_s32(result_reg, single_scratch); |
| 2997 __ jmp(&call); | 2996 __ jmp(&call); |
| 2998 | 2997 |
| 2999 // Heap number map check. | 2998 // Heap number map check. |
| 3000 __ bind(&non_smi); | 2999 __ bind(&non_smi); |
| 3001 __ ldr(scratch, FieldMemOperand(right_reg, HeapObject::kMapOffset)); | 3000 __ ldr(scratch, FieldMemOperand(right_reg, HeapObject::kMapOffset)); |
| 3002 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex); | 3001 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex); |
| 3003 __ cmp(scratch, Operand(ip)); | 3002 __ cmp(scratch, Operand(ip)); |
| 3004 DeoptimizeIf(ne, instr->environment()); | 3003 DeoptimizeIf(ne, instr->environment()); |
| 3005 int32_t value_offset = HeapNumber::kValueOffset - kHeapObjectTag; | 3004 int32_t value_offset = HeapNumber::kValueOffset - kHeapObjectTag; |
| 3006 __ add(scratch, right_reg, Operand(value_offset)); | 3005 __ add(scratch, right_reg, Operand(value_offset)); |
| 3007 __ vldr(result_reg, scratch, 0); | 3006 __ vldr(result_reg, scratch, 0); |
| 3008 | 3007 |
| 3009 // Prepare arguments and call C function. | 3008 // Prepare arguments and call C function. |
| 3010 __ bind(&call); | 3009 __ bind(&call); |
| 3011 __ PrepareCallCFunction(4, scratch); | 3010 __ PrepareCallCFunction(0, 2, scratch); |
| 3012 __ vmov(r0, r1, ToDoubleRegister(left)); | 3011 __ SetCallCDoubleArguments(ToDoubleRegister(left), result_reg); |
| 3013 __ vmov(r2, r3, result_reg); | |
| 3014 __ CallCFunction( | 3012 __ CallCFunction( |
| 3015 ExternalReference::power_double_double_function(isolate()), 4); | 3013 ExternalReference::power_double_double_function(isolate()), 0, 2); |
| 3016 } | 3014 } |
| 3017 // Store the result in the result register. | 3015 // Store the result in the result register. |
| 3018 __ GetCFunctionDoubleResult(result_reg); | 3016 __ GetCFunctionDoubleResult(result_reg); |
| 3019 } | 3017 } |
| 3020 | 3018 |
| 3021 | 3019 |
| 3022 void LCodeGen::DoMathLog(LUnaryMathOperation* instr) { | 3020 void LCodeGen::DoMathLog(LUnaryMathOperation* instr) { |
| 3023 ASSERT(ToDoubleRegister(instr->result()).is(d2)); | 3021 ASSERT(ToDoubleRegister(instr->result()).is(d2)); |
| 3024 TranscendentalCacheStub stub(TranscendentalCache::LOG, | 3022 TranscendentalCacheStub stub(TranscendentalCache::LOG, |
| 3025 TranscendentalCacheStub::UNTAGGED); | 3023 TranscendentalCacheStub::UNTAGGED); |
| (...skipping 1279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4305 ASSERT(osr_pc_offset_ == -1); | 4303 ASSERT(osr_pc_offset_ == -1); |
| 4306 osr_pc_offset_ = masm()->pc_offset(); | 4304 osr_pc_offset_ = masm()->pc_offset(); |
| 4307 } | 4305 } |
| 4308 | 4306 |
| 4309 | 4307 |
| 4310 | 4308 |
| 4311 | 4309 |
| 4312 #undef __ | 4310 #undef __ |
| 4313 | 4311 |
| 4314 } } // namespace v8::internal | 4312 } } // namespace v8::internal |
| OLD | NEW |