OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 21 matching lines...) Expand all Loading... |
32 | 32 |
33 #ifdef __mips | 33 #ifdef __mips |
34 #include <asm/cachectl.h> | 34 #include <asm/cachectl.h> |
35 #endif // #ifdef __mips | 35 #endif // #ifdef __mips |
36 | 36 |
37 #include "v8.h" | 37 #include "v8.h" |
38 | 38 |
39 #if defined(V8_TARGET_ARCH_MIPS) | 39 #if defined(V8_TARGET_ARCH_MIPS) |
40 | 40 |
41 #include "cpu.h" | 41 #include "cpu.h" |
| 42 #include "macro-assembler.h" |
| 43 |
| 44 #include "simulator.h" // For cache flushing. |
42 | 45 |
43 namespace v8 { | 46 namespace v8 { |
44 namespace internal { | 47 namespace internal { |
45 | 48 |
| 49 |
46 void CPU::Setup() { | 50 void CPU::Setup() { |
47 // Nothing to do. | 51 CpuFeatures* cpu_features = Isolate::Current()->cpu_features(); |
| 52 cpu_features->Probe(true); |
| 53 if (!cpu_features->IsSupported(FPU) || Serializer::enabled()) { |
| 54 V8::DisableCrankshaft(); |
| 55 } |
48 } | 56 } |
49 | 57 |
| 58 |
50 void CPU::FlushICache(void* start, size_t size) { | 59 void CPU::FlushICache(void* start, size_t size) { |
51 #ifdef __mips | 60 #if !defined (USE_SIMULATOR) |
52 int res; | 61 int res; |
53 | 62 |
54 // See http://www.linux-mips.org/wiki/Cacheflush_Syscall | 63 // See http://www.linux-mips.org/wiki/Cacheflush_Syscall |
55 res = syscall(__NR_cacheflush, start, size, ICACHE); | 64 res = syscall(__NR_cacheflush, start, size, ICACHE); |
56 | 65 |
57 if (res) { | 66 if (res) { |
58 V8_Fatal(__FILE__, __LINE__, "Failed to flush the instruction cache"); | 67 V8_Fatal(__FILE__, __LINE__, "Failed to flush the instruction cache"); |
59 } | 68 } |
60 | 69 |
61 #endif // #ifdef __mips | 70 #else // USE_SIMULATOR. |
| 71 // Not generating mips instructions for C-code. This means that we are |
| 72 // building a mips emulator based target. We should notify the simulator |
| 73 // that the Icache was flushed. |
| 74 // None of this code ends up in the snapshot so there are no issues |
| 75 // around whether or not to generate the code when building snapshots. |
| 76 Simulator::FlushICache(Isolate::Current()->simulator_i_cache(), start, size); |
| 77 #endif // USE_SIMULATOR. |
62 } | 78 } |
63 | 79 |
64 | 80 |
65 void CPU::DebugBreak() { | 81 void CPU::DebugBreak() { |
66 #ifdef __mips | 82 #ifdef __mips |
67 asm volatile("break"); | 83 asm volatile("break"); |
68 #endif // #ifdef __mips | 84 #endif // #ifdef __mips |
69 } | 85 } |
70 | 86 |
| 87 |
71 } } // namespace v8::internal | 88 } } // namespace v8::internal |
72 | 89 |
73 #endif // V8_TARGET_ARCH_MIPS | 90 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |