| 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 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1011 | 1011 |
| 1012 // For use in calls that take two double values, constructed either | 1012 // For use in calls that take two double values, constructed either |
| 1013 // from r0-r3 or d0 and d1. | 1013 // from r0-r3 or d0 and d1. |
| 1014 void Simulator::GetFpArgs(double* x, double* y) { | 1014 void Simulator::GetFpArgs(double* x, double* y) { |
| 1015 if (use_eabi_hardfloat()) { | 1015 if (use_eabi_hardfloat()) { |
| 1016 *x = vfp_register[0]; | 1016 *x = vfp_register[0]; |
| 1017 *y = vfp_register[1]; | 1017 *y = vfp_register[1]; |
| 1018 } else { | 1018 } else { |
| 1019 // We use a char buffer to get around the strict-aliasing rules which | 1019 // We use a char buffer to get around the strict-aliasing rules which |
| 1020 // otherwise allow the compiler to optimize away the copy. | 1020 // otherwise allow the compiler to optimize away the copy. |
| 1021 char buffer[2 * sizeof(registers_[0])]; | 1021 char buffer[sizeof(*x)]; |
| 1022 // Registers 0 and 1 -> x. | 1022 // Registers 0 and 1 -> x. |
| 1023 memcpy(buffer, registers_, sizeof(buffer)); | 1023 memcpy(buffer, registers_, sizeof(*x)); |
| 1024 memcpy(x, buffer, sizeof(buffer)); | 1024 memcpy(x, buffer, sizeof(*x)); |
| 1025 // Registers 2 and 3 -> y. | 1025 // Registers 2 and 3 -> y. |
| 1026 memcpy(buffer, registers_ + 2, sizeof(buffer)); | 1026 memcpy(buffer, registers_ + 2, sizeof(*y)); |
| 1027 memcpy(y, buffer, sizeof(buffer)); | 1027 memcpy(y, buffer, sizeof(*y)); |
| 1028 } | 1028 } |
| 1029 } | 1029 } |
| 1030 | 1030 |
| 1031 // For use in calls that take one double value, constructed either | 1031 // For use in calls that take one double value, constructed either |
| 1032 // from r0 and r1 or d0. | 1032 // from r0 and r1 or d0. |
| 1033 void Simulator::GetFpArgs(double* x) { | 1033 void Simulator::GetFpArgs(double* x) { |
| 1034 if (use_eabi_hardfloat()) { | 1034 if (use_eabi_hardfloat()) { |
| 1035 *x = vfp_register[0]; | 1035 *x = vfp_register[0]; |
| 1036 } else { | 1036 } else { |
| 1037 // We use a char buffer to get around the strict-aliasing rules which | 1037 // We use a char buffer to get around the strict-aliasing rules which |
| 1038 // otherwise allow the compiler to optimize away the copy. | 1038 // otherwise allow the compiler to optimize away the copy. |
| 1039 char buffer[2 * sizeof(registers_[0])]; | 1039 char buffer[sizeof(*x)]; |
| 1040 // Registers 0 and 1 -> x. | 1040 // Registers 0 and 1 -> x. |
| 1041 memcpy(buffer, registers_, sizeof(buffer)); | 1041 memcpy(buffer, registers_, sizeof(*x)); |
| 1042 memcpy(x, buffer, sizeof(buffer)); | 1042 memcpy(x, buffer, sizeof(*x)); |
| 1043 } | 1043 } |
| 1044 } | 1044 } |
| 1045 | 1045 |
| 1046 | 1046 |
| 1047 // For use in calls that take two double values, constructed either | 1047 // For use in calls that take one double value constructed either |
| 1048 // from r0-r3 or d0 and d1. | 1048 // from r0 and r1 or d0 and one integer value. |
| 1049 void Simulator::GetFpArgs(double* x, int32_t* y) { | 1049 void Simulator::GetFpArgs(double* x, int32_t* y) { |
| 1050 if (use_eabi_hardfloat()) { | 1050 if (use_eabi_hardfloat()) { |
| 1051 *x = vfp_register[0]; | 1051 *x = vfp_register[0]; |
| 1052 *y = registers_[1]; | 1052 *y = registers_[1]; |
| 1053 } else { | 1053 } else { |
| 1054 // We use a char buffer to get around the strict-aliasing rules which | 1054 // We use a char buffer to get around the strict-aliasing rules which |
| 1055 // otherwise allow the compiler to optimize away the copy. | 1055 // otherwise allow the compiler to optimize away the copy. |
| 1056 char buffer[2 * sizeof(registers_[0])]; | 1056 char buffer[sizeof(*x)]; |
| 1057 // Registers 0 and 1 -> x. | 1057 // Registers 0 and 1 -> x. |
| 1058 memcpy(buffer, registers_, sizeof(buffer)); | 1058 memcpy(buffer, registers_, sizeof(*x)); |
| 1059 memcpy(x, buffer, sizeof(buffer)); | 1059 memcpy(x, buffer, sizeof(*x)); |
| 1060 // Registers 2 and 3 -> y. | 1060 // Register 2 -> y. |
| 1061 memcpy(buffer, registers_ + 2, sizeof(buffer)); | 1061 memcpy(buffer, registers_ + 2, sizeof(*y)); |
| 1062 memcpy(y, buffer, sizeof(buffer)); | 1062 memcpy(y, buffer, sizeof(*y)); |
| 1063 } | 1063 } |
| 1064 } | 1064 } |
| 1065 | 1065 |
| 1066 | 1066 |
| 1067 // The return value is either in r0/r1 or d0. | 1067 // The return value is either in r0/r1 or d0. |
| 1068 void Simulator::SetFpResult(const double& result) { | 1068 void Simulator::SetFpResult(const double& result) { |
| 1069 if (use_eabi_hardfloat()) { | 1069 if (use_eabi_hardfloat()) { |
| 1070 char buffer[2 * sizeof(vfp_register[0])]; | 1070 char buffer[2 * sizeof(vfp_register[0])]; |
| 1071 memcpy(buffer, &result, sizeof(buffer)); | 1071 memcpy(buffer, &result, sizeof(buffer)); |
| 1072 // Copy result to d0. | 1072 // Copy result to d0. |
| (...skipping 2345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3418 uintptr_t address = *stack_slot; | 3418 uintptr_t address = *stack_slot; |
| 3419 set_register(sp, current_sp + sizeof(uintptr_t)); | 3419 set_register(sp, current_sp + sizeof(uintptr_t)); |
| 3420 return address; | 3420 return address; |
| 3421 } | 3421 } |
| 3422 | 3422 |
| 3423 } } // namespace v8::internal | 3423 } } // namespace v8::internal |
| 3424 | 3424 |
| 3425 #endif // USE_SIMULATOR | 3425 #endif // USE_SIMULATOR |
| 3426 | 3426 |
| 3427 #endif // V8_TARGET_ARCH_ARM | 3427 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |