| Index: src/mips/simulator-mips.cc
|
| diff --git a/src/mips/simulator-mips.cc b/src/mips/simulator-mips.cc
|
| index ea8b65948afe4732a4867024ac93c075d8220cff..1cb330a804115914711e7d88dbcd93f207d2a544 100644
|
| --- a/src/mips/simulator-mips.cc
|
| +++ b/src/mips/simulator-mips.cc
|
| @@ -27,6 +27,7 @@
|
|
|
| #include <stdlib.h>
|
| #include <limits.h>
|
| +#include <fpu_control.h>
|
| #include <cmath>
|
| #include <cstdarg>
|
| #include "v8.h"
|
| @@ -882,6 +883,8 @@ void Simulator::Initialize(Isolate* isolate) {
|
|
|
|
|
| Simulator::Simulator(Isolate* isolate) : isolate_(isolate) {
|
| + set_host_fp_precision();
|
| +
|
| i_cache_ = isolate_->simulator_i_cache();
|
| if (i_cache_ == NULL) {
|
| i_cache_ = new v8::internal::HashMap(&ICacheMatch);
|
| @@ -2917,6 +2920,20 @@ uintptr_t Simulator::PopAddress() {
|
| }
|
|
|
|
|
| +void Simulator::set_host_fp_precision() {
|
| +#if !V8_HOST_ARCH_MIPS
|
| + // Set Intel x87 FPU mode to 64-bit double.
|
| + // The default FPU mode is extended (80-bit),
|
| + // which can lead to unexpected precision failures.
|
| + fpu_control_t cw;
|
| + _FPU_GETCW(cw);
|
| + cw &= ~_FPU_EXTENDED;
|
| + cw |= _FPU_DOUBLE;
|
| + _FPU_SETCW(cw);
|
| +#endif
|
| +}
|
| +
|
| +
|
| #undef UNSUPPORTED
|
|
|
| } } // namespace v8::internal
|
|
|