| OLD | NEW |
| 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 | 5 // modification, are permitted provided that the following conditions |
| 6 // are met: | 6 // are 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 namespace internal { | 46 namespace internal { |
| 47 | 47 |
| 48 // ----------------------------------------------------------------------------- | 48 // ----------------------------------------------------------------------------- |
| 49 // Implementation of CpuFeatures | 49 // Implementation of CpuFeatures |
| 50 | 50 |
| 51 #ifdef DEBUG | 51 #ifdef DEBUG |
| 52 bool CpuFeatures::initialized_ = false; | 52 bool CpuFeatures::initialized_ = false; |
| 53 #endif | 53 #endif |
| 54 uint64_t CpuFeatures::supported_ = 0; | 54 uint64_t CpuFeatures::supported_ = 0; |
| 55 uint64_t CpuFeatures::found_by_runtime_probing_only_ = 0; | 55 uint64_t CpuFeatures::found_by_runtime_probing_only_ = 0; |
| 56 uint64_t CpuFeatures::cross_compile_ = 0; |
| 56 | 57 |
| 57 | 58 |
| 58 ExternalReference ExternalReference::cpu_features() { | 59 ExternalReference ExternalReference::cpu_features() { |
| 59 ASSERT(CpuFeatures::initialized_); | 60 ASSERT(CpuFeatures::initialized_); |
| 60 return ExternalReference(&CpuFeatures::supported_); | 61 return ExternalReference(&CpuFeatures::supported_); |
| 61 } | 62 } |
| 62 | 63 |
| 63 | 64 |
| 64 int IntelDoubleRegister::NumAllocatableRegisters() { | 65 int IntelDoubleRegister::NumAllocatableRegisters() { |
| 65 if (CpuFeatures::IsSupported(SSE2)) { | 66 if (CpuFeatures::IsSupported(SSE2)) { |
| (...skipping 1340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1406 int Assembler::CallSize(Handle<Code> code, RelocInfo::Mode rmode) { | 1407 int Assembler::CallSize(Handle<Code> code, RelocInfo::Mode rmode) { |
| 1407 return 1 /* EMIT */ + sizeof(uint32_t) /* emit */; | 1408 return 1 /* EMIT */ + sizeof(uint32_t) /* emit */; |
| 1408 } | 1409 } |
| 1409 | 1410 |
| 1410 | 1411 |
| 1411 void Assembler::call(Handle<Code> code, | 1412 void Assembler::call(Handle<Code> code, |
| 1412 RelocInfo::Mode rmode, | 1413 RelocInfo::Mode rmode, |
| 1413 TypeFeedbackId ast_id) { | 1414 TypeFeedbackId ast_id) { |
| 1414 positions_recorder()->WriteRecordedPositions(); | 1415 positions_recorder()->WriteRecordedPositions(); |
| 1415 EnsureSpace ensure_space(this); | 1416 EnsureSpace ensure_space(this); |
| 1416 ASSERT(RelocInfo::IsCodeTarget(rmode)); | 1417 ASSERT(RelocInfo::IsCodeTarget(rmode) |
| 1418 || rmode == RelocInfo::CODE_AGE_SEQUENCE); |
| 1417 EMIT(0xE8); | 1419 EMIT(0xE8); |
| 1418 emit(code, rmode, ast_id); | 1420 emit(code, rmode, ast_id); |
| 1419 } | 1421 } |
| 1420 | 1422 |
| 1421 | 1423 |
| 1422 void Assembler::jmp(Label* L, Label::Distance distance) { | 1424 void Assembler::jmp(Label* L, Label::Distance distance) { |
| 1423 EnsureSpace ensure_space(this); | 1425 EnsureSpace ensure_space(this); |
| 1424 if (L->is_bound()) { | 1426 if (L->is_bound()) { |
| 1425 const int short_size = 2; | 1427 const int short_size = 2; |
| 1426 const int long_size = 5; | 1428 const int long_size = 5; |
| (...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2059 | 2061 |
| 2060 void Assembler::xorps(XMMRegister dst, XMMRegister src) { | 2062 void Assembler::xorps(XMMRegister dst, XMMRegister src) { |
| 2061 EnsureSpace ensure_space(this); | 2063 EnsureSpace ensure_space(this); |
| 2062 EMIT(0x0F); | 2064 EMIT(0x0F); |
| 2063 EMIT(0x57); | 2065 EMIT(0x57); |
| 2064 emit_sse_operand(dst, src); | 2066 emit_sse_operand(dst, src); |
| 2065 } | 2067 } |
| 2066 | 2068 |
| 2067 | 2069 |
| 2068 void Assembler::sqrtsd(XMMRegister dst, XMMRegister src) { | 2070 void Assembler::sqrtsd(XMMRegister dst, XMMRegister src) { |
| 2071 ASSERT(IsEnabled(SSE2)); |
| 2069 EnsureSpace ensure_space(this); | 2072 EnsureSpace ensure_space(this); |
| 2070 EMIT(0xF2); | 2073 EMIT(0xF2); |
| 2071 EMIT(0x0F); | 2074 EMIT(0x0F); |
| 2072 EMIT(0x51); | 2075 EMIT(0x51); |
| 2073 emit_sse_operand(dst, src); | 2076 emit_sse_operand(dst, src); |
| 2074 } | 2077 } |
| 2075 | 2078 |
| 2076 | 2079 |
| 2077 void Assembler::andpd(XMMRegister dst, XMMRegister src) { | 2080 void Assembler::andpd(XMMRegister dst, XMMRegister src) { |
| 2081 ASSERT(IsEnabled(SSE2)); |
| 2078 EnsureSpace ensure_space(this); | 2082 EnsureSpace ensure_space(this); |
| 2079 EMIT(0x66); | 2083 EMIT(0x66); |
| 2080 EMIT(0x0F); | 2084 EMIT(0x0F); |
| 2081 EMIT(0x54); | 2085 EMIT(0x54); |
| 2082 emit_sse_operand(dst, src); | 2086 emit_sse_operand(dst, src); |
| 2083 } | 2087 } |
| 2084 | 2088 |
| 2085 | 2089 |
| 2086 void Assembler::orpd(XMMRegister dst, XMMRegister src) { | 2090 void Assembler::orpd(XMMRegister dst, XMMRegister src) { |
| 2091 ASSERT(IsEnabled(SSE2)); |
| 2087 EnsureSpace ensure_space(this); | 2092 EnsureSpace ensure_space(this); |
| 2088 EMIT(0x66); | 2093 EMIT(0x66); |
| 2089 EMIT(0x0F); | 2094 EMIT(0x0F); |
| 2090 EMIT(0x56); | 2095 EMIT(0x56); |
| 2091 emit_sse_operand(dst, src); | 2096 emit_sse_operand(dst, src); |
| 2092 } | 2097 } |
| 2093 | 2098 |
| 2094 | 2099 |
| 2095 void Assembler::ucomisd(XMMRegister dst, XMMRegister src) { | 2100 void Assembler::ucomisd(XMMRegister dst, XMMRegister src) { |
| 2096 ASSERT(IsEnabled(SSE2)); | 2101 ASSERT(IsEnabled(SSE2)); |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2239 ASSERT(is_uint2(level)); | 2244 ASSERT(is_uint2(level)); |
| 2240 EnsureSpace ensure_space(this); | 2245 EnsureSpace ensure_space(this); |
| 2241 EMIT(0x0F); | 2246 EMIT(0x0F); |
| 2242 EMIT(0x18); | 2247 EMIT(0x18); |
| 2243 // Emit hint number in Reg position of RegR/M. | 2248 // Emit hint number in Reg position of RegR/M. |
| 2244 XMMRegister code = XMMRegister::from_code(level); | 2249 XMMRegister code = XMMRegister::from_code(level); |
| 2245 emit_sse_operand(code, src); | 2250 emit_sse_operand(code, src); |
| 2246 } | 2251 } |
| 2247 | 2252 |
| 2248 | 2253 |
| 2249 void Assembler::movdbl(XMMRegister dst, const Operand& src) { | |
| 2250 EnsureSpace ensure_space(this); | |
| 2251 movsd(dst, src); | |
| 2252 } | |
| 2253 | |
| 2254 | |
| 2255 void Assembler::movdbl(const Operand& dst, XMMRegister src) { | |
| 2256 EnsureSpace ensure_space(this); | |
| 2257 movsd(dst, src); | |
| 2258 } | |
| 2259 | |
| 2260 | |
| 2261 void Assembler::movsd(const Operand& dst, XMMRegister src ) { | 2254 void Assembler::movsd(const Operand& dst, XMMRegister src ) { |
| 2262 ASSERT(IsEnabled(SSE2)); | 2255 ASSERT(IsEnabled(SSE2)); |
| 2263 EnsureSpace ensure_space(this); | 2256 EnsureSpace ensure_space(this); |
| 2264 EMIT(0xF2); // double | 2257 EMIT(0xF2); // double |
| 2265 EMIT(0x0F); | 2258 EMIT(0x0F); |
| 2266 EMIT(0x11); // store | 2259 EMIT(0x11); // store |
| 2267 emit_sse_operand(src, dst); | 2260 emit_sse_operand(src, dst); |
| 2268 } | 2261 } |
| 2269 | 2262 |
| 2270 | 2263 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2339 | 2332 |
| 2340 | 2333 |
| 2341 void Assembler::extractps(Register dst, XMMRegister src, byte imm8) { | 2334 void Assembler::extractps(Register dst, XMMRegister src, byte imm8) { |
| 2342 ASSERT(IsEnabled(SSE4_1)); | 2335 ASSERT(IsEnabled(SSE4_1)); |
| 2343 ASSERT(is_uint8(imm8)); | 2336 ASSERT(is_uint8(imm8)); |
| 2344 EnsureSpace ensure_space(this); | 2337 EnsureSpace ensure_space(this); |
| 2345 EMIT(0x66); | 2338 EMIT(0x66); |
| 2346 EMIT(0x0F); | 2339 EMIT(0x0F); |
| 2347 EMIT(0x3A); | 2340 EMIT(0x3A); |
| 2348 EMIT(0x17); | 2341 EMIT(0x17); |
| 2342 emit_sse_operand(src, dst); |
| 2343 EMIT(imm8); |
| 2344 } |
| 2345 |
| 2346 |
| 2347 void Assembler::andps(XMMRegister dst, XMMRegister src) { |
| 2348 EnsureSpace ensure_space(this); |
| 2349 EMIT(0x0F); |
| 2350 EMIT(0x54); |
| 2349 emit_sse_operand(dst, src); | 2351 emit_sse_operand(dst, src); |
| 2350 EMIT(imm8); | |
| 2351 } | 2352 } |
| 2352 | 2353 |
| 2353 | 2354 |
| 2354 void Assembler::pand(XMMRegister dst, XMMRegister src) { | 2355 void Assembler::pand(XMMRegister dst, XMMRegister src) { |
| 2355 ASSERT(IsEnabled(SSE2)); | 2356 ASSERT(IsEnabled(SSE2)); |
| 2356 EnsureSpace ensure_space(this); | 2357 EnsureSpace ensure_space(this); |
| 2357 EMIT(0x66); | 2358 EMIT(0x66); |
| 2358 EMIT(0x0F); | 2359 EMIT(0x0F); |
| 2359 EMIT(0xDB); | 2360 EMIT(0xDB); |
| 2360 emit_sse_operand(dst, src); | 2361 emit_sse_operand(dst, src); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2478 void Assembler::emit_sse_operand(XMMRegister dst, XMMRegister src) { | 2479 void Assembler::emit_sse_operand(XMMRegister dst, XMMRegister src) { |
| 2479 EMIT(0xC0 | dst.code() << 3 | src.code()); | 2480 EMIT(0xC0 | dst.code() << 3 | src.code()); |
| 2480 } | 2481 } |
| 2481 | 2482 |
| 2482 | 2483 |
| 2483 void Assembler::emit_sse_operand(Register dst, XMMRegister src) { | 2484 void Assembler::emit_sse_operand(Register dst, XMMRegister src) { |
| 2484 EMIT(0xC0 | dst.code() << 3 | src.code()); | 2485 EMIT(0xC0 | dst.code() << 3 | src.code()); |
| 2485 } | 2486 } |
| 2486 | 2487 |
| 2487 | 2488 |
| 2489 void Assembler::emit_sse_operand(XMMRegister dst, Register src) { |
| 2490 EMIT(0xC0 | (dst.code() << 3) | src.code()); |
| 2491 } |
| 2492 |
| 2493 |
| 2488 void Assembler::Print() { | 2494 void Assembler::Print() { |
| 2489 Disassembler::Decode(isolate(), stdout, buffer_, pc_); | 2495 Disassembler::Decode(isolate(), stdout, buffer_, pc_); |
| 2490 } | 2496 } |
| 2491 | 2497 |
| 2492 | 2498 |
| 2493 void Assembler::RecordJSReturn() { | 2499 void Assembler::RecordJSReturn() { |
| 2494 positions_recorder()->WriteRecordedPositions(); | 2500 positions_recorder()->WriteRecordedPositions(); |
| 2495 EnsureSpace ensure_space(this); | 2501 EnsureSpace ensure_space(this); |
| 2496 RecordRelocInfo(RelocInfo::JS_RETURN); | 2502 RecordRelocInfo(RelocInfo::JS_RETURN); |
| 2497 } | 2503 } |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2683 fprintf(coverage_log, "%s\n", file_line); | 2689 fprintf(coverage_log, "%s\n", file_line); |
| 2684 fflush(coverage_log); | 2690 fflush(coverage_log); |
| 2685 } | 2691 } |
| 2686 } | 2692 } |
| 2687 | 2693 |
| 2688 #endif | 2694 #endif |
| 2689 | 2695 |
| 2690 } } // namespace v8::internal | 2696 } } // namespace v8::internal |
| 2691 | 2697 |
| 2692 #endif // V8_TARGET_ARCH_IA32 | 2698 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |