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