OLD | NEW |
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. | 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. |
2 // All Rights Reserved. | 2 // All Rights Reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // met: |
7 // | 7 // |
8 // - Redistributions of source code must retain the above copyright notice, | 8 // - Redistributions of source code must retain the above copyright notice, |
9 // this list of conditions and the following disclaimer. | 9 // this list of conditions and the following disclaimer. |
10 // | 10 // |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 friend class Assembler; | 418 friend class Assembler; |
419 }; | 419 }; |
420 | 420 |
421 | 421 |
422 // CpuFeatures keeps track of which features are supported by the target CPU. | 422 // CpuFeatures keeps track of which features are supported by the target CPU. |
423 // Supported features must be enabled by a CpuFeatureScope before use. | 423 // Supported features must be enabled by a CpuFeatureScope before use. |
424 class CpuFeatures : public AllStatic { | 424 class CpuFeatures : public AllStatic { |
425 public: | 425 public: |
426 // Detect features of the target CPU. Set safe defaults if the serializer | 426 // Detect features of the target CPU. Set safe defaults if the serializer |
427 // is enabled (snapshots must be portable). | 427 // is enabled (snapshots must be portable). |
428 static void Probe(); | 428 static void Probe(bool serializer_enabled); |
429 | 429 |
430 // A special case for printing target and features, which we want to do | 430 // A special case for printing target and features, which we want to do |
431 // before initializing the isolate | 431 // before initializing the isolate |
432 static void SetHintCreatingSnapshot(); | |
433 static void ProbeWithoutIsolate(); | |
434 | 432 |
435 // Check whether a feature is supported by the target CPU. | 433 // Check whether a feature is supported by the target CPU. |
436 static bool IsSupported(CpuFeature f) { | 434 static bool IsSupported(CpuFeature f) { |
437 ASSERT(initialized_); | 435 ASSERT(initialized_); |
438 return Check(f, supported_); | 436 return Check(f, supported_); |
439 } | 437 } |
440 | 438 |
441 static bool IsFoundByRuntimeProbingOnly(CpuFeature f) { | 439 static bool IsFoundByRuntimeProbingOnly(CpuFeature f) { |
442 ASSERT(initialized_); | 440 ASSERT(initialized_); |
443 return Check(f, found_by_runtime_probing_only_); | 441 return Check(f, found_by_runtime_probing_only_); |
444 } | 442 } |
445 | 443 |
446 static bool IsSafeForSnapshot(CpuFeature f) { | 444 static bool IsSafeForSnapshot(CpuFeature f) { |
447 return Check(f, cross_compile_) || | 445 return Check(f, cross_compile_) || |
448 (IsSupported(f) && | 446 (IsSupported(f) && |
449 (!Serializer::enabled() || !IsFoundByRuntimeProbingOnly(f))); | 447 (!Serializer::enabled() || !IsFoundByRuntimeProbingOnly(f))); |
450 } | 448 } |
451 | 449 |
452 static bool VerifyCrossCompiling() { | 450 static bool VerifyCrossCompiling() { |
453 return cross_compile_ == 0; | 451 return cross_compile_ == 0; |
454 } | 452 } |
455 | 453 |
456 static bool VerifyCrossCompiling(CpuFeature f) { | 454 static bool VerifyCrossCompiling(CpuFeature f) { |
457 unsigned mask = flag2set(f); | 455 unsigned mask = flag2set(f); |
458 return cross_compile_ == 0 || | 456 return cross_compile_ == 0 || |
459 (cross_compile_ & mask) == mask; | 457 (cross_compile_ & mask) == mask; |
460 } | 458 } |
461 | 459 |
| 460 static bool SupportsCrankshaft() { return CpuFeatures::IsSupported(FPU); } |
| 461 |
462 private: | 462 private: |
463 static void Probe(bool serializer_enabled); | |
464 static bool hint_creating_snapshot_; | |
465 | |
466 static bool Check(CpuFeature f, unsigned set) { | 463 static bool Check(CpuFeature f, unsigned set) { |
467 return (set & flag2set(f)) != 0; | 464 return (set & flag2set(f)) != 0; |
468 } | 465 } |
469 | 466 |
470 static unsigned flag2set(CpuFeature f) { | 467 static unsigned flag2set(CpuFeature f) { |
471 return 1u << f; | 468 return 1u << f; |
472 } | 469 } |
473 | 470 |
474 #ifdef DEBUG | 471 #ifdef DEBUG |
475 static bool initialized_; | 472 static bool initialized_; |
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1293 class EnsureSpace BASE_EMBEDDED { | 1290 class EnsureSpace BASE_EMBEDDED { |
1294 public: | 1291 public: |
1295 explicit EnsureSpace(Assembler* assembler) { | 1292 explicit EnsureSpace(Assembler* assembler) { |
1296 assembler->CheckBuffer(); | 1293 assembler->CheckBuffer(); |
1297 } | 1294 } |
1298 }; | 1295 }; |
1299 | 1296 |
1300 } } // namespace v8::internal | 1297 } } // namespace v8::internal |
1301 | 1298 |
1302 #endif // V8_ARM_ASSEMBLER_MIPS_H_ | 1299 #endif // V8_ARM_ASSEMBLER_MIPS_H_ |
OLD | NEW |