| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 __ jmp(&done); | 113 __ jmp(&done); |
| 114 | 114 |
| 115 // Invoke CPUID with 1 in eax to get feature information in | 115 // Invoke CPUID with 1 in eax to get feature information in |
| 116 // ecx:edx. Temporarily enable CPUID support because we know it's | 116 // ecx:edx. Temporarily enable CPUID support because we know it's |
| 117 // safe here. | 117 // safe here. |
| 118 __ bind(&cpuid); | 118 __ bind(&cpuid); |
| 119 __ movq(rax, Immediate(1)); | 119 __ movq(rax, Immediate(1)); |
| 120 supported_ = kDefaultCpuFeatures | (1 << CPUID); | 120 supported_ = kDefaultCpuFeatures | (1 << CPUID); |
| 121 { Scope fscope(CPUID); | 121 { Scope fscope(CPUID); |
| 122 __ cpuid(); | 122 __ cpuid(); |
| 123 // Move the result from ecx:edx to rdi. |
| 124 __ movl(rdi, rdx); // Zero-extended to 64 bits. |
| 125 __ shl(rcx, Immediate(32)); |
| 126 __ or_(rdi, rcx); |
| 127 |
| 128 // Get the sahf supported flag, from CPUID(0x80000001) |
| 129 __ movq(rax, 0x80000001, RelocInfo::NONE); |
| 130 __ cpuid(); |
| 123 } | 131 } |
| 124 supported_ = kDefaultCpuFeatures; | 132 supported_ = kDefaultCpuFeatures; |
| 125 | 133 |
| 126 // Move the result from ecx:edx to rax and make sure to mark the | 134 // Put the CPU flags in rax. |
| 127 // CPUID feature as supported. | 135 // rax = (rcx & 1) | (rdi & ~1) | (1 << CPUID). |
| 128 __ movl(rax, rdx); // Zero-extended to 64 bits. | 136 __ movl(rax, Immediate(1)); |
| 129 __ shl(rcx, Immediate(32)); | 137 __ and_(rcx, rax); // Bit 0 is set if SAHF instruction supported. |
| 138 __ not_(rax); |
| 139 __ and_(rax, rdi); |
| 130 __ or_(rax, rcx); | 140 __ or_(rax, rcx); |
| 131 __ or_(rax, Immediate(1 << CPUID)); | 141 __ or_(rax, Immediate(1 << CPUID)); |
| 132 | 142 |
| 133 // Done. | 143 // Done. |
| 134 __ bind(&done); | 144 __ bind(&done); |
| 135 __ movq(rsp, rbp); | 145 __ movq(rsp, rbp); |
| 136 __ pop(rbx); | 146 __ pop(rbx); |
| 137 __ pop(rcx); | 147 __ pop(rcx); |
| 138 __ popfq(); | 148 __ popfq(); |
| 139 __ pop(rbp); | 149 __ pop(rbp); |
| (...skipping 2208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2348 RecordRelocInfo(RelocInfo::POSITION, current_position_); | 2358 RecordRelocInfo(RelocInfo::POSITION, current_position_); |
| 2349 written_position_ = current_position_; | 2359 written_position_ = current_position_; |
| 2350 } | 2360 } |
| 2351 } | 2361 } |
| 2352 | 2362 |
| 2353 | 2363 |
| 2354 const int RelocInfo::kApplyMask = 1 << RelocInfo::INTERNAL_REFERENCE; | 2364 const int RelocInfo::kApplyMask = 1 << RelocInfo::INTERNAL_REFERENCE; |
| 2355 | 2365 |
| 2356 | 2366 |
| 2357 } } // namespace v8::internal | 2367 } } // namespace v8::internal |
| OLD | NEW |