OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/x64/assembler-x64.h" | 5 #include "src/x64/assembler-x64.h" |
6 | 6 |
7 #include <cstring> | 7 #include <cstring> |
8 | 8 |
9 #if V8_TARGET_ARCH_X64 | 9 #if V8_TARGET_ARCH_X64 |
10 | 10 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 // caused by ISRs, so we detect that here and disable AVX in that case. | 50 // caused by ISRs, so we detect that here and disable AVX in that case. |
51 char buffer[128]; | 51 char buffer[128]; |
52 size_t buffer_size = arraysize(buffer); | 52 size_t buffer_size = arraysize(buffer); |
53 int ctl_name[] = {CTL_KERN, KERN_OSRELEASE}; | 53 int ctl_name[] = {CTL_KERN, KERN_OSRELEASE}; |
54 if (sysctl(ctl_name, 2, buffer, &buffer_size, nullptr, 0) != 0) { | 54 if (sysctl(ctl_name, 2, buffer, &buffer_size, nullptr, 0) != 0) { |
55 V8_Fatal(__FILE__, __LINE__, "V8 failed to get kernel version"); | 55 V8_Fatal(__FILE__, __LINE__, "V8 failed to get kernel version"); |
56 } | 56 } |
57 // The buffer now contains a string of the form XX.YY.ZZ, where | 57 // The buffer now contains a string of the form XX.YY.ZZ, where |
58 // XX is the major kernel version component. | 58 // XX is the major kernel version component. |
59 char* period_pos = strchr(buffer, '.'); | 59 char* period_pos = strchr(buffer, '.'); |
60 DCHECK_NOT_NULL(period_pos); | 60 DCHECK(period_pos); |
61 *period_pos = '\0'; | 61 *period_pos = '\0'; |
62 long kernel_version_major = strtol(buffer, nullptr, 10); // NOLINT | 62 long kernel_version_major = strtol(buffer, nullptr, 10); // NOLINT |
63 if (kernel_version_major <= 13) return false; | 63 if (kernel_version_major <= 13) return false; |
64 #endif // V8_OS_MACOSX | 64 #endif // V8_OS_MACOSX |
65 // Check whether OS claims to support AVX. | 65 // Check whether OS claims to support AVX. |
66 uint64_t feature_mask = _xgetbv(_XCR_XFEATURE_ENABLED_MASK); | 66 uint64_t feature_mask = _xgetbv(_XCR_XFEATURE_ENABLED_MASK); |
67 return (feature_mask & 0x6) == 0x6; | 67 return (feature_mask & 0x6) == 0x6; |
68 } | 68 } |
69 | 69 |
70 } // namespace | 70 } // namespace |
(...skipping 3344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3415 | 3415 |
3416 | 3416 |
3417 bool RelocInfo::IsInConstantPool() { | 3417 bool RelocInfo::IsInConstantPool() { |
3418 return false; | 3418 return false; |
3419 } | 3419 } |
3420 | 3420 |
3421 | 3421 |
3422 } } // namespace v8::internal | 3422 } } // namespace v8::internal |
3423 | 3423 |
3424 #endif // V8_TARGET_ARCH_X64 | 3424 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |