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

Side by Side Diff: src/mips/assembler-mips.h

Issue 26680002: Ensure only whitelisted stubs have sse2 versions in the snapshot. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: string add is unsafe since it has a double saving centry stub Created 7 years, 2 months 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
« no previous file with comments | « src/ia32/assembler-ia32.cc ('k') | src/mips/assembler-mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 // Supported features must be enabled by a CpuFeatureScope before use. 404 // Supported features must be enabled by a CpuFeatureScope before use.
405 class CpuFeatures : public AllStatic { 405 class CpuFeatures : public AllStatic {
406 public: 406 public:
407 // Detect features of the target CPU. Set safe defaults if the serializer 407 // Detect features of the target CPU. Set safe defaults if the serializer
408 // is enabled (snapshots must be portable). 408 // is enabled (snapshots must be portable).
409 static void Probe(); 409 static void Probe();
410 410
411 // Check whether a feature is supported by the target CPU. 411 // Check whether a feature is supported by the target CPU.
412 static bool IsSupported(CpuFeature f) { 412 static bool IsSupported(CpuFeature f) {
413 ASSERT(initialized_); 413 ASSERT(initialized_);
414 return (supported_ & (1u << f)) != 0; 414 return Check(f, supported_);
415 } 415 }
416 416
417 static bool IsFoundByRuntimeProbingOnly(CpuFeature f) { 417 static bool IsFoundByRuntimeProbingOnly(CpuFeature f) {
418 ASSERT(initialized_); 418 ASSERT(initialized_);
419 return (found_by_runtime_probing_only_ & 419 return Check(f, found_by_runtime_probing_only_);
420 (static_cast<uint64_t>(1) << f)) != 0;
421 } 420 }
422 421
423 static bool IsSafeForSnapshot(CpuFeature f) { 422 static bool IsSafeForSnapshot(CpuFeature f) {
424 return (IsSupported(f) && 423 return Check(f, cross_compile_) ||
424 (IsSupported(f) &&
425 (!Serializer::enabled() || !IsFoundByRuntimeProbingOnly(f))); 425 (!Serializer::enabled() || !IsFoundByRuntimeProbingOnly(f)));
426 } 426 }
427 427
428 static bool VerifyCrossCompiling() {
429 return cross_compile_ == 0;
430 }
431
432 static bool VerifyCrossCompiling(CpuFeature f) {
433 unsigned mask = flag2set(f);
434 return cross_compile_ == 0 ||
435 (cross_compile_ & mask) == mask;
436 }
437
428 private: 438 private:
439 static bool Check(CpuFeature f, unsigned set) {
440 return (set & flag2set(f)) != 0;
441 }
442
443 static unsigned flag2set(CpuFeature f) {
444 return 1u << f;
445 }
446
429 #ifdef DEBUG 447 #ifdef DEBUG
430 static bool initialized_; 448 static bool initialized_;
431 #endif 449 #endif
432 static unsigned supported_; 450 static unsigned supported_;
433 static unsigned found_by_runtime_probing_only_; 451 static unsigned found_by_runtime_probing_only_;
434 452
453 static unsigned cross_compile_;
454
435 friend class ExternalReference; 455 friend class ExternalReference;
436 friend class PlatformFeatureScope; 456 friend class PlatformFeatureScope;
437 DISALLOW_COPY_AND_ASSIGN(CpuFeatures); 457 DISALLOW_COPY_AND_ASSIGN(CpuFeatures);
438 }; 458 };
439 459
440 460
441 class Assembler : public AssemblerBase { 461 class Assembler : public AssemblerBase {
442 public: 462 public:
443 // Create an assembler. Instructions and relocation information are emitted 463 // Create an assembler. Instructions and relocation information are emitted
444 // into a buffer, with the instructions starting from the beginning and the 464 // into a buffer, with the instructions starting from the beginning and the
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after
1218 class EnsureSpace BASE_EMBEDDED { 1238 class EnsureSpace BASE_EMBEDDED {
1219 public: 1239 public:
1220 explicit EnsureSpace(Assembler* assembler) { 1240 explicit EnsureSpace(Assembler* assembler) {
1221 assembler->CheckBuffer(); 1241 assembler->CheckBuffer();
1222 } 1242 }
1223 }; 1243 };
1224 1244
1225 } } // namespace v8::internal 1245 } } // namespace v8::internal
1226 1246
1227 #endif // V8_ARM_ASSEMBLER_MIPS_H_ 1247 #endif // V8_ARM_ASSEMBLER_MIPS_H_
OLDNEW
« no previous file with comments | « src/ia32/assembler-ia32.cc ('k') | src/mips/assembler-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698