Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1351)

Side by Side Diff: src/x64/assembler-x64.cc

Issue 391051: Allow a platform to indicate that some CPU features are always... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 XMMRegister xmm15 = { 15 }; 73 XMMRegister xmm15 = { 15 };
74 74
75 75
76 // ----------------------------------------------------------------------------- 76 // -----------------------------------------------------------------------------
77 // Implementation of CpuFeatures 77 // Implementation of CpuFeatures
78 78
79 // The required user mode extensions in X64 are (from AMD64 ABI Table A.1): 79 // The required user mode extensions in X64 are (from AMD64 ABI Table A.1):
80 // fpu, tsc, cx8, cmov, mmx, sse, sse2, fxsr, syscall 80 // fpu, tsc, cx8, cmov, mmx, sse, sse2, fxsr, syscall
81 uint64_t CpuFeatures::supported_ = kDefaultCpuFeatures; 81 uint64_t CpuFeatures::supported_ = kDefaultCpuFeatures;
82 uint64_t CpuFeatures::enabled_ = 0; 82 uint64_t CpuFeatures::enabled_ = 0;
83 uint64_t CpuFeatures::found_by_runtime_probing_ = 0;
83 84
84 void CpuFeatures::Probe() { 85 void CpuFeatures::Probe() {
85 ASSERT(Heap::HasBeenSetup()); 86 ASSERT(Heap::HasBeenSetup());
86 ASSERT(supported_ == kDefaultCpuFeatures); 87 ASSERT(supported_ == kDefaultCpuFeatures);
87 if (Serializer::enabled()) return; // No features if we might serialize. 88 if (Serializer::enabled()) {
89 supported_ |= OS::CpuFeaturesImpliedByPlatform();
90 return; // No features if we might serialize.
91 }
88 92
89 Assembler assm(NULL, 0); 93 Assembler assm(NULL, 0);
90 Label cpuid, done; 94 Label cpuid, done;
91 #define __ assm. 95 #define __ assm.
92 // Save old rsp, since we are going to modify the stack. 96 // Save old rsp, since we are going to modify the stack.
93 __ push(rbp); 97 __ push(rbp);
94 __ pushfq(); 98 __ pushfq();
95 __ push(rcx); 99 __ push(rcx);
96 __ push(rbx); 100 __ push(rbx);
97 __ movq(rbp, rsp); 101 __ movq(rbp, rsp);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 CodeDesc desc; 157 CodeDesc desc;
154 assm.GetCode(&desc); 158 assm.GetCode(&desc);
155 Object* code = 159 Object* code =
156 Heap::CreateCode(desc, NULL, Code::ComputeFlags(Code::STUB), NULL); 160 Heap::CreateCode(desc, NULL, Code::ComputeFlags(Code::STUB), NULL);
157 if (!code->IsCode()) return; 161 if (!code->IsCode()) return;
158 LOG(CodeCreateEvent(Logger::BUILTIN_TAG, 162 LOG(CodeCreateEvent(Logger::BUILTIN_TAG,
159 Code::cast(code), "CpuFeatures::Probe")); 163 Code::cast(code), "CpuFeatures::Probe"));
160 typedef uint64_t (*F0)(); 164 typedef uint64_t (*F0)();
161 F0 probe = FUNCTION_CAST<F0>(Code::cast(code)->entry()); 165 F0 probe = FUNCTION_CAST<F0>(Code::cast(code)->entry());
162 supported_ = probe(); 166 supported_ = probe();
167 found_by_runtime_probing_ = supported_;
168 found_by_runtime_probing_ &= ~kDefaultCpuFeatures;
169 uint64_t os_guarantees = OS::CpuFeaturesImpliedByPlatform();
170 supported_ |= os_guarantees;
171 found_by_runtime_probing_ &= ~os_guarantees;
163 // SSE2 and CMOV must be available on an X64 CPU. 172 // SSE2 and CMOV must be available on an X64 CPU.
164 ASSERT(IsSupported(CPUID)); 173 ASSERT(IsSupported(CPUID));
165 ASSERT(IsSupported(SSE2)); 174 ASSERT(IsSupported(SSE2));
166 ASSERT(IsSupported(CMOV)); 175 ASSERT(IsSupported(CMOV));
167 } 176 }
168 177
169 178
170 // ----------------------------------------------------------------------------- 179 // -----------------------------------------------------------------------------
171 // Implementation of RelocInfo 180 // Implementation of RelocInfo
172 181
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 void Assembler::cmpb_al(Immediate imm8) { 891 void Assembler::cmpb_al(Immediate imm8) {
883 ASSERT(is_int8(imm8.value_) || is_uint8(imm8.value_)); 892 ASSERT(is_int8(imm8.value_) || is_uint8(imm8.value_));
884 EnsureSpace ensure_space(this); 893 EnsureSpace ensure_space(this);
885 last_pc_ = pc_; 894 last_pc_ = pc_;
886 emit(0x3c); 895 emit(0x3c);
887 emit(imm8.value_); 896 emit(imm8.value_);
888 } 897 }
889 898
890 899
891 void Assembler::cpuid() { 900 void Assembler::cpuid() {
892 ASSERT(CpuFeatures::IsEnabled(CpuFeatures::CPUID)); 901 ASSERT(CpuFeatures::IsEnabled(CPUID));
893 EnsureSpace ensure_space(this); 902 EnsureSpace ensure_space(this);
894 last_pc_ = pc_; 903 last_pc_ = pc_;
895 emit(0x0F); 904 emit(0x0F);
896 emit(0xA2); 905 emit(0xA2);
897 } 906 }
898 907
899 908
900 void Assembler::cqo() { 909 void Assembler::cqo() {
901 EnsureSpace ensure_space(this); 910 EnsureSpace ensure_space(this);
902 last_pc_ = pc_; 911 last_pc_ = pc_;
(...skipping 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after
2040 void Assembler::fistp_s(const Operand& adr) { 2049 void Assembler::fistp_s(const Operand& adr) {
2041 EnsureSpace ensure_space(this); 2050 EnsureSpace ensure_space(this);
2042 last_pc_ = pc_; 2051 last_pc_ = pc_;
2043 emit_optional_rex_32(adr); 2052 emit_optional_rex_32(adr);
2044 emit(0xDB); 2053 emit(0xDB);
2045 emit_operand(3, adr); 2054 emit_operand(3, adr);
2046 } 2055 }
2047 2056
2048 2057
2049 void Assembler::fisttp_s(const Operand& adr) { 2058 void Assembler::fisttp_s(const Operand& adr) {
2050 ASSERT(CpuFeatures::IsEnabled(CpuFeatures::SSE3)); 2059 ASSERT(CpuFeatures::IsEnabled(SSE3));
2051 EnsureSpace ensure_space(this); 2060 EnsureSpace ensure_space(this);
2052 last_pc_ = pc_; 2061 last_pc_ = pc_;
2053 emit_optional_rex_32(adr); 2062 emit_optional_rex_32(adr);
2054 emit(0xDB); 2063 emit(0xDB);
2055 emit_operand(1, adr); 2064 emit_operand(1, adr);
2056 } 2065 }
2057 2066
2058 2067
2059 void Assembler::fist_s(const Operand& adr) { 2068 void Assembler::fist_s(const Operand& adr) {
2060 EnsureSpace ensure_space(this); 2069 EnsureSpace ensure_space(this);
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
2521 written_position_ = current_position_; 2530 written_position_ = current_position_;
2522 } 2531 }
2523 } 2532 }
2524 2533
2525 2534
2526 const int RelocInfo::kApplyMask = RelocInfo::kCodeTargetMask | 2535 const int RelocInfo::kApplyMask = RelocInfo::kCodeTargetMask |
2527 1 << RelocInfo::INTERNAL_REFERENCE | 2536 1 << RelocInfo::INTERNAL_REFERENCE |
2528 1 << RelocInfo::JS_RETURN; 2537 1 << RelocInfo::JS_RETURN;
2529 2538
2530 } } // namespace v8::internal 2539 } } // namespace v8::internal
OLDNEW
« src/arm/assembler-arm.h ('K') | « src/x64/assembler-x64.h ('k') | src/x64/codegen-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698