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 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
931 } | 931 } |
932 | 932 |
933 | 933 |
934 void Simulator::set_d_register_from_double(int dreg, const double& dbl) { | 934 void Simulator::set_d_register_from_double(int dreg, const double& dbl) { |
935 ASSERT((dreg >= 0) && (dreg < num_d_registers)); | 935 ASSERT((dreg >= 0) && (dreg < num_d_registers)); |
936 // Read the bits from the double precision floating point value into the two | 936 // Read the bits from the double precision floating point value into the two |
937 // consecutive unsigned integer elements of vfp_register[] given by index | 937 // consecutive unsigned integer elements of vfp_register[] given by index |
938 // 2*sreg and 2*sreg+1. | 938 // 2*sreg and 2*sreg+1. |
939 char buffer[2 * sizeof(vfp_register[0])]; | 939 char buffer[2 * sizeof(vfp_register[0])]; |
940 memcpy(buffer, &dbl, 2 * sizeof(vfp_register[0])); | 940 memcpy(buffer, &dbl, 2 * sizeof(vfp_register[0])); |
941 #ifndef BIG_ENDIAN_FLOATING_POINT | |
942 memcpy(&vfp_register[dreg * 2], buffer, 2 * sizeof(vfp_register[0])); | 941 memcpy(&vfp_register[dreg * 2], buffer, 2 * sizeof(vfp_register[0])); |
943 #else | |
944 memcpy(&vfp_register[dreg * 2], &buffer[4], sizeof(vfp_register[0])); | |
945 memcpy(&vfp_register[dreg * 2 + 1], &buffer[0], sizeof(vfp_register[0])); | |
946 #endif | |
947 } | 942 } |
948 | 943 |
949 | 944 |
950 float Simulator::get_float_from_s_register(int sreg) { | 945 float Simulator::get_float_from_s_register(int sreg) { |
951 ASSERT((sreg >= 0) && (sreg < num_s_registers)); | 946 ASSERT((sreg >= 0) && (sreg < num_s_registers)); |
952 | 947 |
953 float sm_val = 0.0; | 948 float sm_val = 0.0; |
954 // Read the bits from the unsigned integer vfp_register[] array | 949 // Read the bits from the unsigned integer vfp_register[] array |
955 // into the single precision floating point value and return it. | 950 // into the single precision floating point value and return it. |
956 char buffer[sizeof(vfp_register[0])]; | 951 char buffer[sizeof(vfp_register[0])]; |
(...skipping 16 matching lines...) Expand all Loading... |
973 } | 968 } |
974 | 969 |
975 | 970 |
976 double Simulator::get_double_from_d_register(int dreg) { | 971 double Simulator::get_double_from_d_register(int dreg) { |
977 ASSERT((dreg >= 0) && (dreg < num_d_registers)); | 972 ASSERT((dreg >= 0) && (dreg < num_d_registers)); |
978 | 973 |
979 double dm_val = 0.0; | 974 double dm_val = 0.0; |
980 // Read the bits from the unsigned integer vfp_register[] array | 975 // Read the bits from the unsigned integer vfp_register[] array |
981 // into the double precision floating point value and return it. | 976 // into the double precision floating point value and return it. |
982 char buffer[2 * sizeof(vfp_register[0])]; | 977 char buffer[2 * sizeof(vfp_register[0])]; |
983 #ifdef BIG_ENDIAN_FLOATING_POINT | |
984 memcpy(&buffer[0], &vfp_register[2 * dreg + 1], sizeof(vfp_register[0])); | |
985 memcpy(&buffer[4], &vfp_register[2 * dreg], sizeof(vfp_register[0])); | |
986 #else | |
987 memcpy(buffer, &vfp_register[2 * dreg], 2 * sizeof(vfp_register[0])); | 978 memcpy(buffer, &vfp_register[2 * dreg], 2 * sizeof(vfp_register[0])); |
988 #endif | |
989 memcpy(&dm_val, buffer, 2 * sizeof(vfp_register[0])); | 979 memcpy(&dm_val, buffer, 2 * sizeof(vfp_register[0])); |
990 return(dm_val); | 980 return(dm_val); |
991 } | 981 } |
992 | 982 |
993 | 983 |
994 // For use in calls that take two double values, constructed from r0, r1, r2 | 984 // For use in calls that take two double values, constructed from r0, r1, r2 |
995 // and r3. | 985 // and r3. |
996 void Simulator::GetFpArgs(double* x, double* y) { | 986 void Simulator::GetFpArgs(double* x, double* y) { |
997 // We use a char buffer to get around the strict-aliasing rules which | 987 // We use a char buffer to get around the strict-aliasing rules which |
998 // otherwise allow the compiler to optimize away the copy. | 988 // otherwise allow the compiler to optimize away the copy. |
(...skipping 2280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3279 uintptr_t address = *stack_slot; | 3269 uintptr_t address = *stack_slot; |
3280 set_register(sp, current_sp + sizeof(uintptr_t)); | 3270 set_register(sp, current_sp + sizeof(uintptr_t)); |
3281 return address; | 3271 return address; |
3282 } | 3272 } |
3283 | 3273 |
3284 } } // namespace v8::internal | 3274 } } // namespace v8::internal |
3285 | 3275 |
3286 #endif // USE_SIMULATOR | 3276 #endif // USE_SIMULATOR |
3287 | 3277 |
3288 #endif // V8_TARGET_ARCH_ARM | 3278 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |