MIPS: NaNs in the snapshot should be quiet according
to the MIPS FPU even when cross-building the snapshot. This is based on code from Daniel Kalmar from http://codereview.chromium.org/9910029/ Review URL: https://chromiumcodereview.appspot.com/10068006 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11283 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
71702e1da3
commit
e9e291c331
@ -62,6 +62,10 @@ class AssemblerBase: public Malloced {
|
||||
Isolate* isolate() const { return isolate_; }
|
||||
int jit_cookie() { return jit_cookie_; }
|
||||
|
||||
// Overwrite a host NaN with a quiet target NaN. Used by mksnapshot for
|
||||
// cross-snapshotting.
|
||||
static void QuietNaN(HeapObject* nan) { }
|
||||
|
||||
private:
|
||||
Isolate* isolate_;
|
||||
int jit_cookie_;
|
||||
|
@ -2137,6 +2137,22 @@ Address Assembler::target_address_at(Address pc) {
|
||||
}
|
||||
|
||||
|
||||
#define MIPS_QNAN_HI 0x7ff7ffff
|
||||
#define MIPS_QNAN_LO 0xffffffff
|
||||
|
||||
|
||||
void Assembler::QuietNaN(HeapObject* object) {
|
||||
// Mips has a different encoding of qNaN than ia32, so any heap NaN built
|
||||
// with simulator must be re-encoded for the snapshot. Performance hit not
|
||||
// critical at mksnapshot/build time. We can't use set_value because that
|
||||
// will put the NaN in an fp register, which changes the bits.
|
||||
uint64_t mips_qnan_bits =
|
||||
(static_cast<uint64_t>(MIPS_QNAN_HI) << 32) | MIPS_QNAN_LO;
|
||||
Address value_ptr = object->address() + HeapNumber::kValueOffset;
|
||||
memcpy(value_ptr, &mips_qnan_bits, sizeof(mips_qnan_bits));
|
||||
}
|
||||
|
||||
|
||||
// On Mips, a target address is stored in a lui/ori instruction pair, each
|
||||
// of which load 16 bits of the 32-bit address to a register.
|
||||
// Patching the address must replace both instr, and flush the i-cache.
|
||||
|
@ -570,6 +570,8 @@ class Assembler : public AssemblerBase {
|
||||
|
||||
static void JumpLabelToJumpRegister(Address pc);
|
||||
|
||||
static void QuietNaN(HeapObject* nan);
|
||||
|
||||
// This sets the branch destination (which gets loaded at the call address).
|
||||
// This is for calls and branches within generated code. The serializer
|
||||
// has already deserialized the lui/ori instructions etc.
|
||||
|
@ -1444,6 +1444,8 @@ void Serializer::ObjectSerializer::Serialize() {
|
||||
sink_->PutSection(space, "NewPageSpace");
|
||||
}
|
||||
|
||||
if (object_->IsNaN()) Assembler::QuietNaN(object_);
|
||||
|
||||
// Serialize the map (first word of the object).
|
||||
serializer_->SerializeObject(object_->map(), kPlain, kStartOfObject);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user