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 |
11 // with the distribution. | 11 // with the distribution. |
12 // * Neither the name of Google Inc. nor the names of its | 12 // * Neither the name of Google Inc. nor the names of its |
13 // contributors may be used to endorse or promote products derived | 13 // contributors may be used to endorse or promote products derived |
14 // from this software without specific prior written permission. | 14 // from this software without specific prior written permission. |
15 // | 15 // |
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #include <stdlib.h> | 28 #include <stdlib.h> |
29 #include <math.h> | 29 #include <cmath> |
30 #include <cstdarg> | 30 #include <cstdarg> |
31 #include "v8.h" | 31 #include "v8.h" |
32 | 32 |
33 #if defined(V8_TARGET_ARCH_ARM) | 33 #if defined(V8_TARGET_ARCH_ARM) |
34 | 34 |
35 #include "disasm.h" | 35 #include "disasm.h" |
36 #include "assembler.h" | 36 #include "assembler.h" |
37 #include "codegen.h" | 37 #include "codegen.h" |
38 #include "arm/constants-arm.h" | 38 #include "arm/constants-arm.h" |
39 #include "arm/simulator-arm.h" | 39 #include "arm/simulator-arm.h" |
(...skipping 1250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1290 overflow = ((left < 0 && right >= 0) || (left >= 0 && right < 0)) | 1290 overflow = ((left < 0 && right >= 0) || (left >= 0 && right < 0)) |
1291 // and first operand and result have different signs | 1291 // and first operand and result have different signs |
1292 && ((left < 0 && alu_out >= 0) || (left >= 0 && alu_out < 0)); | 1292 && ((left < 0 && alu_out >= 0) || (left >= 0 && alu_out < 0)); |
1293 } | 1293 } |
1294 return overflow; | 1294 return overflow; |
1295 } | 1295 } |
1296 | 1296 |
1297 | 1297 |
1298 // Support for VFP comparisons. | 1298 // Support for VFP comparisons. |
1299 void Simulator::Compute_FPSCR_Flags(double val1, double val2) { | 1299 void Simulator::Compute_FPSCR_Flags(double val1, double val2) { |
1300 if (isnan(val1) || isnan(val2)) { | 1300 if (std::isnan(val1) || std::isnan(val2)) { |
1301 n_flag_FPSCR_ = false; | 1301 n_flag_FPSCR_ = false; |
1302 z_flag_FPSCR_ = false; | 1302 z_flag_FPSCR_ = false; |
1303 c_flag_FPSCR_ = true; | 1303 c_flag_FPSCR_ = true; |
1304 v_flag_FPSCR_ = true; | 1304 v_flag_FPSCR_ = true; |
1305 // All non-NaN cases. | 1305 // All non-NaN cases. |
1306 } else if (val1 == val2) { | 1306 } else if (val1 == val2) { |
1307 n_flag_FPSCR_ = false; | 1307 n_flag_FPSCR_ = false; |
1308 z_flag_FPSCR_ = true; | 1308 z_flag_FPSCR_ = true; |
1309 c_flag_FPSCR_ = true; | 1309 c_flag_FPSCR_ = true; |
1310 v_flag_FPSCR_ = false; | 1310 v_flag_FPSCR_ = false; |
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1859 // This is not a valid svc code. | 1859 // This is not a valid svc code. |
1860 UNREACHABLE(); | 1860 UNREACHABLE(); |
1861 break; | 1861 break; |
1862 } | 1862 } |
1863 } | 1863 } |
1864 } | 1864 } |
1865 } | 1865 } |
1866 | 1866 |
1867 | 1867 |
1868 double Simulator::canonicalizeNaN(double value) { | 1868 double Simulator::canonicalizeNaN(double value) { |
1869 return (FPSCR_default_NaN_mode_ && isnan(value)) ? | 1869 return (FPSCR_default_NaN_mode_ && std::isnan(value)) ? |
1870 FixedDoubleArray::canonical_not_the_hole_nan_as_double() : value; | 1870 FixedDoubleArray::canonical_not_the_hole_nan_as_double() : value; |
1871 } | 1871 } |
1872 | 1872 |
1873 // Stop helper functions. | 1873 // Stop helper functions. |
1874 bool Simulator::isStopInstruction(Instruction* instr) { | 1874 bool Simulator::isStopInstruction(Instruction* instr) { |
1875 return (instr->Bits(27, 24) == 0xF) && (instr->SvcValue() >= kStopCode); | 1875 return (instr->Bits(27, 24) == 0xF) && (instr->SvcValue() >= kStopCode); |
1876 } | 1876 } |
1877 | 1877 |
1878 | 1878 |
1879 bool Simulator::isWatchedStop(uint32_t code) { | 1879 bool Simulator::isWatchedStop(uint32_t code) { |
(...skipping 1060 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2940 | 2940 |
2941 if (precision == kDoublePrecision) { | 2941 if (precision == kDoublePrecision) { |
2942 double dd_value = get_double_from_d_register(d); | 2942 double dd_value = get_double_from_d_register(d); |
2943 double dm_value = 0.0; | 2943 double dm_value = 0.0; |
2944 if (instr->Opc2Value() == 0x4) { | 2944 if (instr->Opc2Value() == 0x4) { |
2945 dm_value = get_double_from_d_register(m); | 2945 dm_value = get_double_from_d_register(m); |
2946 } | 2946 } |
2947 | 2947 |
2948 // Raise exceptions for quiet NaNs if necessary. | 2948 // Raise exceptions for quiet NaNs if necessary. |
2949 if (instr->Bit(7) == 1) { | 2949 if (instr->Bit(7) == 1) { |
2950 if (isnan(dd_value)) { | 2950 if (std::isnan(dd_value)) { |
2951 inv_op_vfp_flag_ = true; | 2951 inv_op_vfp_flag_ = true; |
2952 } | 2952 } |
2953 } | 2953 } |
2954 | 2954 |
2955 Compute_FPSCR_Flags(dd_value, dm_value); | 2955 Compute_FPSCR_Flags(dd_value, dm_value); |
2956 } else { | 2956 } else { |
2957 UNIMPLEMENTED(); // Not used by V8. | 2957 UNIMPLEMENTED(); // Not used by V8. |
2958 } | 2958 } |
2959 } | 2959 } |
2960 | 2960 |
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3485 uintptr_t address = *stack_slot; | 3485 uintptr_t address = *stack_slot; |
3486 set_register(sp, current_sp + sizeof(uintptr_t)); | 3486 set_register(sp, current_sp + sizeof(uintptr_t)); |
3487 return address; | 3487 return address; |
3488 } | 3488 } |
3489 | 3489 |
3490 } } // namespace v8::internal | 3490 } } // namespace v8::internal |
3491 | 3491 |
3492 #endif // USE_SIMULATOR | 3492 #endif // USE_SIMULATOR |
3493 | 3493 |
3494 #endif // V8_TARGET_ARCH_ARM | 3494 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |