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

Side by Side Diff: src/base/cpu.cc

Issue 797233002: Make FlushICache NOP for Nvidia Denver CPU's. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years 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
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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/base/cpu.h" 5 #include "src/base/cpu.h"
6 6
7 #if V8_LIBC_MSVCRT 7 #if V8_LIBC_MSVCRT
8 #include <intrin.h> // __cpuid() 8 #include <intrin.h> // __cpuid()
9 #endif 9 #endif
10 #if V8_OS_LINUX 10 #if V8_OS_LINUX
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 293
294 CPU::CPU() 294 CPU::CPU()
295 : stepping_(0), 295 : stepping_(0),
296 model_(0), 296 model_(0),
297 ext_model_(0), 297 ext_model_(0),
298 family_(0), 298 family_(0),
299 ext_family_(0), 299 ext_family_(0),
300 type_(0), 300 type_(0),
301 implementer_(0), 301 implementer_(0),
302 architecture_(0), 302 architecture_(0),
303 variant_(-1),
Benedikt Meurer 2014/12/15 05:33:36 Can we default to 0 here instead?
arajp 2014/12/18 13:25:05 Done.
303 part_(0), 304 part_(0),
304 has_fpu_(false), 305 has_fpu_(false),
305 has_cmov_(false), 306 has_cmov_(false),
306 has_sahf_(false), 307 has_sahf_(false),
307 has_mmx_(false), 308 has_mmx_(false),
308 has_sse_(false), 309 has_sse_(false),
309 has_sse2_(false), 310 has_sse2_(false),
310 has_sse3_(false), 311 has_sse3_(false),
311 has_ssse3_(false), 312 has_ssse3_(false),
312 has_sse41_(false), 313 has_sse41_(false),
(...skipping 20 matching lines...) Expand all
333 // the other three array elements. The CPU identification string is 334 // the other three array elements. The CPU identification string is
334 // not in linear order. The code below arranges the information 335 // not in linear order. The code below arranges the information
335 // in a human readable form. The human readable order is CPUInfo[1] | 336 // in a human readable form. The human readable order is CPUInfo[1] |
336 // CPUInfo[3] | CPUInfo[2]. CPUInfo[2] and CPUInfo[3] are swapped 337 // CPUInfo[3] | CPUInfo[2]. CPUInfo[2] and CPUInfo[3] are swapped
337 // before using memcpy to copy these three array elements to cpu_string. 338 // before using memcpy to copy these three array elements to cpu_string.
338 __cpuid(cpu_info, 0); 339 __cpuid(cpu_info, 0);
339 unsigned num_ids = cpu_info[0]; 340 unsigned num_ids = cpu_info[0];
340 std::swap(cpu_info[2], cpu_info[3]); 341 std::swap(cpu_info[2], cpu_info[3]);
341 memcpy(vendor_, cpu_info + 1, 12); 342 memcpy(vendor_, cpu_info + 1, 12);
342 vendor_[12] = '\0'; 343 vendor_[12] = '\0';
343 344
JF 2014/12/15 16:23:24 You can call CPUID again with 1 in EAX and get the
344 // Interpret CPU feature information. 345 // Interpret CPU feature information.
345 if (num_ids > 0) { 346 if (num_ids > 0) {
346 __cpuid(cpu_info, 1); 347 __cpuid(cpu_info, 1);
347 stepping_ = cpu_info[0] & 0xf; 348 stepping_ = cpu_info[0] & 0xf;
348 model_ = ((cpu_info[0] >> 4) & 0xf) + ((cpu_info[0] >> 12) & 0xf0); 349 model_ = ((cpu_info[0] >> 4) & 0xf) + ((cpu_info[0] >> 12) & 0xf0);
349 family_ = (cpu_info[0] >> 8) & 0xf; 350 family_ = (cpu_info[0] >> 8) & 0xf;
350 type_ = (cpu_info[0] >> 12) & 0x3; 351 type_ = (cpu_info[0] >> 12) & 0x3;
351 ext_model_ = (cpu_info[0] >> 16) & 0xf; 352 ext_model_ = (cpu_info[0] >> 16) & 0xf;
352 ext_family_ = (cpu_info[0] >> 20) & 0xff; 353 ext_family_ = (cpu_info[0] >> 20) & 0xff;
353 has_fpu_ = (cpu_info[3] & 0x00000001) != 0; 354 has_fpu_ = (cpu_info[3] & 0x00000001) != 0;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 char* implementer = cpu_info.ExtractField("CPU implementer"); 390 char* implementer = cpu_info.ExtractField("CPU implementer");
390 if (implementer != NULL) { 391 if (implementer != NULL) {
391 char* end ; 392 char* end ;
392 implementer_ = strtol(implementer, &end, 0); 393 implementer_ = strtol(implementer, &end, 0);
393 if (end == implementer) { 394 if (end == implementer) {
394 implementer_ = 0; 395 implementer_ = 0;
395 } 396 }
396 delete[] implementer; 397 delete[] implementer;
397 } 398 }
398 399
400 char* variant = cpu_info.ExtractField("CPU variant");
401 if (variant != NULL) {
402 char* end ;
403 variant_ = strtol(variant, &end, 0);
404 if (end == variant) {
405 variant_ = 0;
JF 2014/12/15 16:23:24 The failure value here is 0, and as Benedikt point
arajp 2014/12/18 13:25:05 Yes. Denver is identified as 0 in variant. Recent
406 }
407 delete[] variant;
408 }
409
399 // Extract part number from the "CPU part" field. 410 // Extract part number from the "CPU part" field.
400 char* part = cpu_info.ExtractField("CPU part"); 411 char* part = cpu_info.ExtractField("CPU part");
401 if (part != NULL) { 412 if (part != NULL) {
402 char* end ; 413 char* end ;
403 part_ = strtol(part, &end, 0); 414 part_ = strtol(part, &end, 0);
404 if (end == part) { 415 if (end == part) {
405 part_ = 0; 416 part_ = 0;
406 } 417 }
407 delete[] part; 418 delete[] part;
408 } 419 }
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 char* implementer = cpu_info.ExtractField("CPU implementer"); 552 char* implementer = cpu_info.ExtractField("CPU implementer");
542 if (implementer != NULL) { 553 if (implementer != NULL) {
543 char* end ; 554 char* end ;
544 implementer_ = strtol(implementer, &end, 0); 555 implementer_ = strtol(implementer, &end, 0);
545 if (end == implementer) { 556 if (end == implementer) {
546 implementer_ = 0; 557 implementer_ = 0;
547 } 558 }
548 delete[] implementer; 559 delete[] implementer;
549 } 560 }
550 561
562 char* variant = cpu_info.ExtractField("CPU variant");
563 if (variant != NULL) {
564 char* end ;
565 variant_ = strtol(variant, &end, 0);
566 if (end == variant) {
567 variant_ = 0;
568 }
569 delete[] variant;
570 }
571
551 // Extract part number from the "CPU part" field. 572 // Extract part number from the "CPU part" field.
552 char* part = cpu_info.ExtractField("CPU part"); 573 char* part = cpu_info.ExtractField("CPU part");
553 if (part != NULL) { 574 if (part != NULL) {
554 char* end ; 575 char* end ;
555 part_ = strtol(part, &end, 0); 576 part_ = strtol(part, &end, 0);
556 if (end == part) { 577 if (end == part) {
557 part_ = 0; 578 part_ = 0;
558 } 579 }
559 delete[] part; 580 delete[] part;
560 } 581 }
561 582
562 #endif 583 #endif
563 } 584 }
564 585
565 } } // namespace v8::base 586 } } // namespace v8::base
OLDNEW
« src/arm64/assembler-arm64.cc ('K') | « src/base/cpu.h ('k') | src/globals.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698