Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(560)

Side by Side Diff: src/mips/assembler-mips.cc

Issue 10093007: MIPS: Do the qNaN fixup at de-serialization time. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. 1 // Copyright (c) 1994-2006 Sun Microsystems Inc.
2 // All Rights Reserved. 2 // All Rights Reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // - Redistributions of source code must retain the above copyright notice, 8 // - Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer. 9 // this list of conditions and the following disclaimer.
10 // 10 //
(...skipping 2119 matching lines...) Expand 10 before | Expand all | Expand 10 after
2130 return reinterpret_cast<Address>( 2130 return reinterpret_cast<Address>(
2131 (GetImmediate16(instr1) << 16) | GetImmediate16(instr2)); 2131 (GetImmediate16(instr1) << 16) | GetImmediate16(instr2));
2132 } 2132 }
2133 2133
2134 // We should never get here, force a bad address if we do. 2134 // We should never get here, force a bad address if we do.
2135 UNREACHABLE(); 2135 UNREACHABLE();
2136 return (Address)0x0; 2136 return (Address)0x0;
2137 } 2137 }
2138 2138
2139 2139
2140 #define MIPS_QNAN_HI 0x7ff7ffff 2140 // MIPS and ia32 use opposite encoding for qNaN and sNaN, such that ia32
2141 #define MIPS_QNAN_LO 0xffffffff 2141 // qNaN is a MIPS sNaN, and ia32 sNaN is MIPS qNaN. If running from a heap
2142 2142 // snapshot generated on ia32, the resulting MIPS sNaN must be quieted.
2143 2143 // OS::nan_value() returns a qNaN.
2144 void Assembler::QuietNaN(HeapObject* object) { 2144 void Assembler::QuietNaN(HeapObject* object) {
2145 // Mips has a different encoding of qNaN than ia32, so any heap NaN built 2145 HeapNumber::cast(object)->set_value(OS::nan_value());
2146 // with simulator must be re-encoded for the snapshot. Performance hit not
2147 // critical at mksnapshot/build time. We can't use set_value because that
2148 // will put the NaN in an fp register, which changes the bits.
2149 uint64_t mips_qnan_bits =
2150 (static_cast<uint64_t>(MIPS_QNAN_HI) << 32) | MIPS_QNAN_LO;
2151 Address value_ptr = object->address() + HeapNumber::kValueOffset;
2152 memcpy(value_ptr, &mips_qnan_bits, sizeof(mips_qnan_bits));
2153 } 2146 }
2154 2147
2155 2148
2156 // On Mips, a target address is stored in a lui/ori instruction pair, each 2149 // On Mips, a target address is stored in a lui/ori instruction pair, each
2157 // of which load 16 bits of the 32-bit address to a register. 2150 // of which load 16 bits of the 32-bit address to a register.
2158 // Patching the address must replace both instr, and flush the i-cache. 2151 // Patching the address must replace both instr, and flush the i-cache.
2159 // 2152 //
2160 // There is an optimization below, which emits a nop when the address 2153 // There is an optimization below, which emits a nop when the address
2161 // fits in just 16 bits. This is unlikely to help, and should be benchmarked, 2154 // fits in just 16 bits. This is unlikely to help, and should be benchmarked,
2162 // and possibly removed. 2155 // and possibly removed.
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
2286 } 2279 }
2287 2280
2288 if (patched) { 2281 if (patched) {
2289 CPU::FlushICache(pc+2, sizeof(Address)); 2282 CPU::FlushICache(pc+2, sizeof(Address));
2290 } 2283 }
2291 } 2284 }
2292 2285
2293 } } // namespace v8::internal 2286 } } // namespace v8::internal
2294 2287
2295 #endif // V8_TARGET_ARCH_MIPS 2288 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« src/isolate.cc ('K') | « src/isolate.cc ('k') | src/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698