| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
| 8 | 8 |
| 9 #include "src/macro-assembler.h" | 9 #include "src/macro-assembler.h" |
| 10 #include "src/serialize.h" | 10 #include "src/serialize.h" |
| 11 | 11 |
| 12 namespace v8 { | 12 namespace v8 { |
| 13 namespace internal { | 13 namespace internal { |
| 14 | 14 |
| 15 // ----------------------------------------------------------------------------- | 15 // ----------------------------------------------------------------------------- |
| 16 // Implementation of CpuFeatures | 16 // Implementation of CpuFeatures |
| 17 | 17 |
| 18 void CpuFeatures::ProbeImpl(bool cross_compile) { | 18 void CpuFeatures::ProbeImpl(bool cross_compile) { |
| 19 CPU cpu; | 19 base::CPU cpu; |
| 20 CHECK(cpu.has_sse2()); // SSE2 support is mandatory. | 20 CHECK(cpu.has_sse2()); // SSE2 support is mandatory. |
| 21 CHECK(cpu.has_cmov()); // CMOV support is mandatory. | 21 CHECK(cpu.has_cmov()); // CMOV support is mandatory. |
| 22 | 22 |
| 23 // Only use statically determined features for cross compile (snapshot). | 23 // Only use statically determined features for cross compile (snapshot). |
| 24 if (cross_compile) return; | 24 if (cross_compile) return; |
| 25 | 25 |
| 26 if (cpu.has_sse41() && FLAG_enable_sse4_1) supported_ |= 1u << SSE4_1; | 26 if (cpu.has_sse41() && FLAG_enable_sse4_1) supported_ |= 1u << SSE4_1; |
| 27 if (cpu.has_sse3() && FLAG_enable_sse3) supported_ |= 1u << SSE3; | 27 if (cpu.has_sse3() && FLAG_enable_sse3) supported_ |= 1u << SSE3; |
| 28 // SAHF is not generally available in long mode. | 28 // SAHF is not generally available in long mode. |
| 29 if (cpu.has_sahf() && FLAG_enable_sahf) supported_|= 1u << SAHF; | 29 if (cpu.has_sahf() && FLAG_enable_sahf) supported_|= 1u << SAHF; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 } | 67 } |
| 68 | 68 |
| 69 | 69 |
| 70 void RelocInfo::PatchCode(byte* instructions, int instruction_count) { | 70 void RelocInfo::PatchCode(byte* instructions, int instruction_count) { |
| 71 // Patch the code at the current address with the supplied instructions. | 71 // Patch the code at the current address with the supplied instructions. |
| 72 for (int i = 0; i < instruction_count; i++) { | 72 for (int i = 0; i < instruction_count; i++) { |
| 73 *(pc_ + i) = *(instructions + i); | 73 *(pc_ + i) = *(instructions + i); |
| 74 } | 74 } |
| 75 | 75 |
| 76 // Indicate that code has changed. | 76 // Indicate that code has changed. |
| 77 CPU::FlushICache(pc_, instruction_count); | 77 CpuFeatures::FlushICache(pc_, instruction_count); |
| 78 } | 78 } |
| 79 | 79 |
| 80 | 80 |
| 81 // ----------------------------------------------------------------------------- | 81 // ----------------------------------------------------------------------------- |
| 82 // Register constants. | 82 // Register constants. |
| 83 | 83 |
| 84 const int | 84 const int |
| 85 Register::kRegisterCodeByAllocationIndex[kMaxNumAllocatableRegisters] = { | 85 Register::kRegisterCodeByAllocationIndex[kMaxNumAllocatableRegisters] = { |
| 86 // rax, rbx, rdx, rcx, rsi, rdi, r8, r9, r11, r14, r15 | 86 // rax, rbx, rdx, rcx, rsi, rdi, r8, r9, r11, r14, r15 |
| 87 0, 3, 2, 1, 6, 7, 8, 9, 11, 14, 15 | 87 0, 3, 2, 1, 6, 7, 8, 9, 11, 14, 15 |
| (...skipping 2880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2968 | 2968 |
| 2969 | 2969 |
| 2970 bool RelocInfo::IsInConstantPool() { | 2970 bool RelocInfo::IsInConstantPool() { |
| 2971 return false; | 2971 return false; |
| 2972 } | 2972 } |
| 2973 | 2973 |
| 2974 | 2974 |
| 2975 } } // namespace v8::internal | 2975 } } // namespace v8::internal |
| 2976 | 2976 |
| 2977 #endif // V8_TARGET_ARCH_X64 | 2977 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |