| 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 20 matching lines...) Expand all Loading... |
| 31 // OF THE POSSIBILITY OF SUCH DAMAGE. | 31 // OF THE POSSIBILITY OF SUCH DAMAGE. |
| 32 | 32 |
| 33 // The original source code covered by the above license above has been modified | 33 // The original source code covered by the above license above has been modified |
| 34 // significantly by Google Inc. | 34 // significantly by Google Inc. |
| 35 // Copyright 2012 the V8 project authors. All rights reserved. | 35 // Copyright 2012 the V8 project authors. All rights reserved. |
| 36 | 36 |
| 37 #include "src/v8.h" | 37 #include "src/v8.h" |
| 38 | 38 |
| 39 #if V8_TARGET_ARCH_IA32 | 39 #if V8_TARGET_ARCH_IA32 |
| 40 | 40 |
| 41 #include "src/base/cpu.h" |
| 41 #include "src/disassembler.h" | 42 #include "src/disassembler.h" |
| 42 #include "src/macro-assembler.h" | 43 #include "src/macro-assembler.h" |
| 43 #include "src/serialize.h" | 44 #include "src/serialize.h" |
| 44 | 45 |
| 45 namespace v8 { | 46 namespace v8 { |
| 46 namespace internal { | 47 namespace internal { |
| 47 | 48 |
| 48 // ----------------------------------------------------------------------------- | 49 // ----------------------------------------------------------------------------- |
| 49 // Implementation of CpuFeatures | 50 // Implementation of CpuFeatures |
| 50 | 51 |
| 51 void CpuFeatures::ProbeImpl(bool cross_compile) { | 52 void CpuFeatures::ProbeImpl(bool cross_compile) { |
| 52 CPU cpu; | 53 base::CPU cpu; |
| 53 CHECK(cpu.has_sse2()); // SSE2 support is mandatory. | 54 CHECK(cpu.has_sse2()); // SSE2 support is mandatory. |
| 54 CHECK(cpu.has_cmov()); // CMOV support is mandatory. | 55 CHECK(cpu.has_cmov()); // CMOV support is mandatory. |
| 55 | 56 |
| 56 // Only use statically determined features for cross compile (snapshot). | 57 // Only use statically determined features for cross compile (snapshot). |
| 57 if (cross_compile) return; | 58 if (cross_compile) return; |
| 58 | 59 |
| 59 if (cpu.has_sse41() && FLAG_enable_sse4_1) supported_ |= 1u << SSE4_1; | 60 if (cpu.has_sse41() && FLAG_enable_sse4_1) supported_ |= 1u << SSE4_1; |
| 60 if (cpu.has_sse3() && FLAG_enable_sse3) supported_ |= 1u << SSE3; | 61 if (cpu.has_sse3() && FLAG_enable_sse3) supported_ |= 1u << SSE3; |
| 61 } | 62 } |
| 62 | 63 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 } | 106 } |
| 106 | 107 |
| 107 | 108 |
| 108 void RelocInfo::PatchCode(byte* instructions, int instruction_count) { | 109 void RelocInfo::PatchCode(byte* instructions, int instruction_count) { |
| 109 // Patch the code at the current address with the supplied instructions. | 110 // Patch the code at the current address with the supplied instructions. |
| 110 for (int i = 0; i < instruction_count; i++) { | 111 for (int i = 0; i < instruction_count; i++) { |
| 111 *(pc_ + i) = *(instructions + i); | 112 *(pc_ + i) = *(instructions + i); |
| 112 } | 113 } |
| 113 | 114 |
| 114 // Indicate that code has changed. | 115 // Indicate that code has changed. |
| 115 CPU::FlushICache(pc_, instruction_count); | 116 CpuFeatures::FlushICache(pc_, instruction_count); |
| 116 } | 117 } |
| 117 | 118 |
| 118 | 119 |
| 119 // Patch the code at the current PC with a call to the target address. | 120 // Patch the code at the current PC with a call to the target address. |
| 120 // Additional guard int3 instructions can be added if required. | 121 // Additional guard int3 instructions can be added if required. |
| 121 void RelocInfo::PatchCodeWithCall(Address target, int guard_bytes) { | 122 void RelocInfo::PatchCodeWithCall(Address target, int guard_bytes) { |
| 122 // Call instruction takes up 5 bytes and int3 takes up one byte. | 123 // Call instruction takes up 5 bytes and int3 takes up one byte. |
| 123 static const int kCallCodeSize = 5; | 124 static const int kCallCodeSize = 5; |
| 124 int code_size = kCallCodeSize + guard_bytes; | 125 int code_size = kCallCodeSize + guard_bytes; |
| 125 | 126 |
| (...skipping 2510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2636 fprintf(coverage_log, "%s\n", file_line); | 2637 fprintf(coverage_log, "%s\n", file_line); |
| 2637 fflush(coverage_log); | 2638 fflush(coverage_log); |
| 2638 } | 2639 } |
| 2639 } | 2640 } |
| 2640 | 2641 |
| 2641 #endif | 2642 #endif |
| 2642 | 2643 |
| 2643 } } // namespace v8::internal | 2644 } } // namespace v8::internal |
| 2644 | 2645 |
| 2645 #endif // V8_TARGET_ARCH_IA32 | 2646 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |