OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 23 matching lines...) Expand all Loading... |
34 #include "v8.h" | 34 #include "v8.h" |
35 | 35 |
36 #if V8_TARGET_ARCH_IA32 | 36 #if V8_TARGET_ARCH_IA32 |
37 | 37 |
38 #include "cpu.h" | 38 #include "cpu.h" |
39 #include "macro-assembler.h" | 39 #include "macro-assembler.h" |
40 | 40 |
41 namespace v8 { | 41 namespace v8 { |
42 namespace internal { | 42 namespace internal { |
43 | 43 |
44 void CPU::SetUp() { | |
45 CpuFeatures::Probe(); | |
46 } | |
47 | |
48 | |
49 bool CPU::SupportsCrankshaft() { | |
50 return CpuFeatures::IsSupported(SSE2); | |
51 } | |
52 | |
53 | |
54 void CPU::FlushICache(void* start, size_t size) { | 44 void CPU::FlushICache(void* start, size_t size) { |
55 // No need to flush the instruction cache on Intel. On Intel instruction | 45 // No need to flush the instruction cache on Intel. On Intel instruction |
56 // cache flushing is only necessary when multiple cores running the same | 46 // cache flushing is only necessary when multiple cores running the same |
57 // code simultaneously. V8 (and JavaScript) is single threaded and when code | 47 // code simultaneously. V8 (and JavaScript) is single threaded and when code |
58 // is patched on an intel CPU the core performing the patching will have its | 48 // is patched on an intel CPU the core performing the patching will have its |
59 // own instruction cache updated automatically. | 49 // own instruction cache updated automatically. |
60 | 50 |
61 // If flushing of the instruction cache becomes necessary Windows has the | 51 // If flushing of the instruction cache becomes necessary Windows has the |
62 // API function FlushInstructionCache. | 52 // API function FlushInstructionCache. |
63 | 53 |
64 // By default, valgrind only checks the stack for writes that might need to | 54 // By default, valgrind only checks the stack for writes that might need to |
65 // invalidate already cached translated code. This leads to random | 55 // invalidate already cached translated code. This leads to random |
66 // instability when code patches or moves are sometimes unnoticed. One | 56 // instability when code patches or moves are sometimes unnoticed. One |
67 // solution is to run valgrind with --smc-check=all, but this comes at a big | 57 // solution is to run valgrind with --smc-check=all, but this comes at a big |
68 // performance cost. We can notify valgrind to invalidate its cache. | 58 // performance cost. We can notify valgrind to invalidate its cache. |
69 #ifdef VALGRIND_DISCARD_TRANSLATIONS | 59 #ifdef VALGRIND_DISCARD_TRANSLATIONS |
70 unsigned res = VALGRIND_DISCARD_TRANSLATIONS(start, size); | 60 unsigned res = VALGRIND_DISCARD_TRANSLATIONS(start, size); |
71 USE(res); | 61 USE(res); |
72 #endif | 62 #endif |
73 } | 63 } |
74 | 64 |
75 } } // namespace v8::internal | 65 } } // namespace v8::internal |
76 | 66 |
77 #endif // V8_TARGET_ARCH_IA32 | 67 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |