| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 __ pop(rax); | 68 __ pop(rax); |
| 69 __ movq(rdx, rax); | 69 __ movq(rdx, rax); |
| 70 __ xor_(rax, Immediate(0x200000)); // Flip bit 21. | 70 __ xor_(rax, Immediate(0x200000)); // Flip bit 21. |
| 71 __ push(rax); | 71 __ push(rax); |
| 72 __ popfq(); | 72 __ popfq(); |
| 73 __ pushfq(); | 73 __ pushfq(); |
| 74 __ pop(rax); | 74 __ pop(rax); |
| 75 __ xor_(rax, rdx); // Different if CPUID is supported. | 75 __ xor_(rax, rdx); // Different if CPUID is supported. |
| 76 __ j(not_zero, &cpuid); | 76 __ j(not_zero, &cpuid); |
| 77 | 77 |
| 78 // CPUID not supported. Clear the supported features in edx:eax. | 78 // CPUID not supported. Clear the supported features in rax. |
| 79 __ xor_(rax, rax); | 79 __ xor_(rax, rax); |
| 80 __ jmp(&done); | 80 __ jmp(&done); |
| 81 | 81 |
| 82 // Invoke CPUID with 1 in eax to get feature information in | 82 // Invoke CPUID with 1 in eax to get feature information in |
| 83 // ecx:edx. Temporarily enable CPUID support because we know it's | 83 // ecx:edx. Temporarily enable CPUID support because we know it's |
| 84 // safe here. | 84 // safe here. |
| 85 __ bind(&cpuid); | 85 __ bind(&cpuid); |
| 86 __ movq(rax, Immediate(1)); | 86 __ movq(rax, Immediate(1)); |
| 87 supported_ = kDefaultCpuFeatures | (1 << CPUID); | 87 supported_ = kDefaultCpuFeatures | (1 << CPUID); |
| 88 { Scope fscope(CPUID); | 88 { Scope fscope(CPUID); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 void RelocInfo::PatchCode(byte* instructions, int instruction_count) { | 180 void RelocInfo::PatchCode(byte* instructions, int instruction_count) { |
| 181 // Patch the code at the current address with the supplied instructions. | 181 // Patch the code at the current address with the supplied instructions. |
| 182 for (int i = 0; i < instruction_count; i++) { | 182 for (int i = 0; i < instruction_count; i++) { |
| 183 *(pc_ + i) = *(instructions + i); | 183 *(pc_ + i) = *(instructions + i); |
| 184 } | 184 } |
| 185 | 185 |
| 186 // Indicate that code has changed. | 186 // Indicate that code has changed. |
| 187 CPU::FlushICache(pc_, instruction_count); | 187 CPU::FlushICache(pc_, instruction_count); |
| 188 } | 188 } |
| 189 | 189 |
| 190 |
| 191 // ----------------------------------------------------------------------------- |
| 192 // Register constants. |
| 193 |
| 194 const int Register::registerCodeByAllocationIndex[kNumAllocatableRegisters] = { |
| 195 // rax, rbx, rdx, rcx, rdi, r8, r9, r11, r14, r12 |
| 196 0, 3, 2, 1, 7, 8, 9, 11, 14, 12 |
| 197 }; |
| 198 |
| 199 const int Register::allocationIndexByRegisterCode[kNumRegisters] = { |
| 200 0, 3, 2, 1, -1, -1, -1, 4, 5, 6, -1, 7, 9, -1, 8, -1 |
| 201 }; |
| 202 |
| 203 |
| 190 // ----------------------------------------------------------------------------- | 204 // ----------------------------------------------------------------------------- |
| 191 // Implementation of Operand | 205 // Implementation of Operand |
| 192 | 206 |
| 193 Operand::Operand(Register base, int32_t disp) : rex_(0) { | 207 Operand::Operand(Register base, int32_t disp) : rex_(0) { |
| 194 len_ = 1; | 208 len_ = 1; |
| 195 if (base.is(rsp) || base.is(r12)) { | 209 if (base.is(rsp) || base.is(r12)) { |
| 196 // SIB byte is needed to encode (rsp + offset) or (r12 + offset). | 210 // SIB byte is needed to encode (rsp + offset) or (r12 + offset). |
| 197 set_sib(times_1, rsp, base); | 211 set_sib(times_1, rsp, base); |
| 198 } | 212 } |
| 199 | 213 |
| (...skipping 2791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2991 // specially coded on x64 means that it is a relative 32 bit address, as used | 3005 // specially coded on x64 means that it is a relative 32 bit address, as used |
| 2992 // by branch instructions. | 3006 // by branch instructions. |
| 2993 return (1 << rmode_) & kApplyMask; | 3007 return (1 << rmode_) & kApplyMask; |
| 2994 } | 3008 } |
| 2995 | 3009 |
| 2996 | 3010 |
| 2997 | 3011 |
| 2998 } } // namespace v8::internal | 3012 } } // namespace v8::internal |
| 2999 | 3013 |
| 3000 #endif // V8_TARGET_ARCH_X64 | 3014 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |