| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 Safepoint::DeoptMode deopt_mode_; | 58 Safepoint::DeoptMode deopt_mode_; |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 | 61 |
| 62 #define __ masm()-> | 62 #define __ masm()-> |
| 63 | 63 |
| 64 bool LCodeGen::GenerateCode() { | 64 bool LCodeGen::GenerateCode() { |
| 65 HPhase phase("Z_Code generation", chunk()); | 65 HPhase phase("Z_Code generation", chunk()); |
| 66 ASSERT(is_unused()); | 66 ASSERT(is_unused()); |
| 67 status_ = GENERATING; | 67 status_ = GENERATING; |
| 68 CpuFeatures::Scope scope1(VFP3); | 68 CpuFeatures::Scope scope1(VFP2); |
| 69 CpuFeatures::Scope scope2(ARMv7); | 69 CpuFeatures::Scope scope2(ARMv7); |
| 70 | 70 |
| 71 CodeStub::GenerateFPStubs(); | 71 CodeStub::GenerateFPStubs(); |
| 72 | 72 |
| 73 // Open a frame scope to indicate that there is a frame on the stack. The | 73 // Open a frame scope to indicate that there is a frame on the stack. The |
| 74 // NONE indicates that the scope shouldn't actually generate code to set up | 74 // NONE indicates that the scope shouldn't actually generate code to set up |
| 75 // the frame (that is done in GeneratePrologue). | 75 // the frame (that is done in GeneratePrologue). |
| 76 FrameScope frame_scope(masm_, StackFrame::NONE); | 76 FrameScope frame_scope(masm_, StackFrame::NONE); |
| 77 | 77 |
| 78 return GeneratePrologue() && | 78 return GeneratePrologue() && |
| (...skipping 2823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2902 } else { | 2902 } else { |
| 2903 key = ToRegister(instr->key()); | 2903 key = ToRegister(instr->key()); |
| 2904 } | 2904 } |
| 2905 int element_size_shift = ElementsKindToShiftSize(elements_kind); | 2905 int element_size_shift = ElementsKindToShiftSize(elements_kind); |
| 2906 int shift_size = (instr->hydrogen()->key()->representation().IsTagged()) | 2906 int shift_size = (instr->hydrogen()->key()->representation().IsTagged()) |
| 2907 ? (element_size_shift - kSmiTagSize) : element_size_shift; | 2907 ? (element_size_shift - kSmiTagSize) : element_size_shift; |
| 2908 int additional_offset = instr->additional_index() << element_size_shift; | 2908 int additional_offset = instr->additional_index() << element_size_shift; |
| 2909 | 2909 |
| 2910 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS || | 2910 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS || |
| 2911 elements_kind == EXTERNAL_DOUBLE_ELEMENTS) { | 2911 elements_kind == EXTERNAL_DOUBLE_ELEMENTS) { |
| 2912 CpuFeatures::Scope scope(VFP3); | 2912 CpuFeatures::Scope scope(VFP2); |
| 2913 DwVfpRegister result = ToDoubleRegister(instr->result()); | 2913 DwVfpRegister result = ToDoubleRegister(instr->result()); |
| 2914 Operand operand = key_is_constant | 2914 Operand operand = key_is_constant |
| 2915 ? Operand(constant_key << element_size_shift) | 2915 ? Operand(constant_key << element_size_shift) |
| 2916 : Operand(key, LSL, shift_size); | 2916 : Operand(key, LSL, shift_size); |
| 2917 __ add(scratch0(), external_pointer, operand); | 2917 __ add(scratch0(), external_pointer, operand); |
| 2918 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS) { | 2918 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS) { |
| 2919 __ vldr(result.low(), scratch0(), additional_offset); | 2919 __ vldr(result.low(), scratch0(), additional_offset); |
| 2920 __ vcvt_f64_f32(result, result.low()); | 2920 __ vcvt_f64_f32(result, result.low()); |
| 2921 } else { // i.e. elements_kind == EXTERNAL_DOUBLE_ELEMENTS | 2921 } else { // i.e. elements_kind == EXTERNAL_DOUBLE_ELEMENTS |
| 2922 __ vldr(result, scratch0(), additional_offset); | 2922 __ vldr(result, scratch0(), additional_offset); |
| (...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3456 | 3456 |
| 3457 void LCodeGen::DoMathPowHalf(LUnaryMathOperation* instr) { | 3457 void LCodeGen::DoMathPowHalf(LUnaryMathOperation* instr) { |
| 3458 DoubleRegister input = ToDoubleRegister(instr->InputAt(0)); | 3458 DoubleRegister input = ToDoubleRegister(instr->InputAt(0)); |
| 3459 DoubleRegister result = ToDoubleRegister(instr->result()); | 3459 DoubleRegister result = ToDoubleRegister(instr->result()); |
| 3460 DoubleRegister temp = ToDoubleRegister(instr->TempAt(0)); | 3460 DoubleRegister temp = ToDoubleRegister(instr->TempAt(0)); |
| 3461 | 3461 |
| 3462 // Note that according to ECMA-262 15.8.2.13: | 3462 // Note that according to ECMA-262 15.8.2.13: |
| 3463 // Math.pow(-Infinity, 0.5) == Infinity | 3463 // Math.pow(-Infinity, 0.5) == Infinity |
| 3464 // Math.sqrt(-Infinity) == NaN | 3464 // Math.sqrt(-Infinity) == NaN |
| 3465 Label done; | 3465 Label done; |
| 3466 __ vmov(temp, -V8_INFINITY); | 3466 __ Vmov(temp, -V8_INFINITY); |
| 3467 __ VFPCompareAndSetFlags(input, temp); | 3467 __ VFPCompareAndSetFlags(input, temp); |
| 3468 __ vneg(result, temp, eq); | 3468 __ vneg(result, temp, eq); |
| 3469 __ b(&done, eq); | 3469 __ b(&done, eq); |
| 3470 | 3470 |
| 3471 // Add +0 to convert -0 to +0. | 3471 // Add +0 to convert -0 to +0. |
| 3472 __ vadd(result, input, kDoubleRegZero); | 3472 __ vadd(result, input, kDoubleRegZero); |
| 3473 __ vsqrt(result, result); | 3473 __ vsqrt(result, result); |
| 3474 __ bind(&done); | 3474 __ bind(&done); |
| 3475 } | 3475 } |
| 3476 | 3476 |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3935 } else { | 3935 } else { |
| 3936 key = ToRegister(instr->key()); | 3936 key = ToRegister(instr->key()); |
| 3937 } | 3937 } |
| 3938 int element_size_shift = ElementsKindToShiftSize(elements_kind); | 3938 int element_size_shift = ElementsKindToShiftSize(elements_kind); |
| 3939 int shift_size = (instr->hydrogen()->key()->representation().IsTagged()) | 3939 int shift_size = (instr->hydrogen()->key()->representation().IsTagged()) |
| 3940 ? (element_size_shift - kSmiTagSize) : element_size_shift; | 3940 ? (element_size_shift - kSmiTagSize) : element_size_shift; |
| 3941 int additional_offset = instr->additional_index() << element_size_shift; | 3941 int additional_offset = instr->additional_index() << element_size_shift; |
| 3942 | 3942 |
| 3943 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS || | 3943 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS || |
| 3944 elements_kind == EXTERNAL_DOUBLE_ELEMENTS) { | 3944 elements_kind == EXTERNAL_DOUBLE_ELEMENTS) { |
| 3945 CpuFeatures::Scope scope(VFP3); | 3945 CpuFeatures::Scope scope(VFP2); |
| 3946 DwVfpRegister value(ToDoubleRegister(instr->value())); | 3946 DwVfpRegister value(ToDoubleRegister(instr->value())); |
| 3947 Operand operand(key_is_constant | 3947 Operand operand(key_is_constant |
| 3948 ? Operand(constant_key << element_size_shift) | 3948 ? Operand(constant_key << element_size_shift) |
| 3949 : Operand(key, LSL, shift_size)); | 3949 : Operand(key, LSL, shift_size)); |
| 3950 __ add(scratch0(), external_pointer, operand); | 3950 __ add(scratch0(), external_pointer, operand); |
| 3951 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS) { | 3951 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS) { |
| 3952 __ vcvt_f32_f64(double_scratch0().low(), value); | 3952 __ vcvt_f32_f64(double_scratch0().low(), value); |
| 3953 __ vstr(double_scratch0().low(), scratch0(), additional_offset); | 3953 __ vstr(double_scratch0().low(), scratch0(), additional_offset); |
| 3954 } else { // i.e. elements_kind == EXTERNAL_DOUBLE_ELEMENTS | 3954 } else { // i.e. elements_kind == EXTERNAL_DOUBLE_ELEMENTS |
| 3955 __ vstr(value, scratch0(), additional_offset); | 3955 __ vstr(value, scratch0(), additional_offset); |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4417 __ vldr(double_scratch2, scratch1, HeapNumber::kValueOffset); | 4417 __ vldr(double_scratch2, scratch1, HeapNumber::kValueOffset); |
| 4418 | 4418 |
| 4419 __ EmitECMATruncate(input_reg, | 4419 __ EmitECMATruncate(input_reg, |
| 4420 double_scratch2, | 4420 double_scratch2, |
| 4421 single_scratch, | 4421 single_scratch, |
| 4422 scratch1, | 4422 scratch1, |
| 4423 scratch2, | 4423 scratch2, |
| 4424 scratch3); | 4424 scratch3); |
| 4425 | 4425 |
| 4426 } else { | 4426 } else { |
| 4427 CpuFeatures::Scope scope(VFP3); | 4427 CpuFeatures::Scope scope(VFP2); |
| 4428 // Deoptimize if we don't have a heap number. | 4428 // Deoptimize if we don't have a heap number. |
| 4429 DeoptimizeIf(ne, instr->environment()); | 4429 DeoptimizeIf(ne, instr->environment()); |
| 4430 | 4430 |
| 4431 __ sub(ip, input_reg, Operand(kHeapObjectTag)); | 4431 __ sub(ip, input_reg, Operand(kHeapObjectTag)); |
| 4432 __ vldr(double_scratch, ip, HeapNumber::kValueOffset); | 4432 __ vldr(double_scratch, ip, HeapNumber::kValueOffset); |
| 4433 __ EmitVFPTruncate(kRoundToZero, | 4433 __ EmitVFPTruncate(kRoundToZero, |
| 4434 single_scratch, | 4434 single_scratch, |
| 4435 double_scratch, | 4435 double_scratch, |
| 4436 scratch1, | 4436 scratch1, |
| 4437 scratch2, | 4437 scratch2, |
| (...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5447 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); | 5447 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); |
| 5448 __ ldr(result, FieldMemOperand(scratch, | 5448 __ ldr(result, FieldMemOperand(scratch, |
| 5449 FixedArray::kHeaderSize - kPointerSize)); | 5449 FixedArray::kHeaderSize - kPointerSize)); |
| 5450 __ bind(&done); | 5450 __ bind(&done); |
| 5451 } | 5451 } |
| 5452 | 5452 |
| 5453 | 5453 |
| 5454 #undef __ | 5454 #undef __ |
| 5455 | 5455 |
| 5456 } } // namespace v8::internal | 5456 } } // namespace v8::internal |
| OLD | NEW |