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

Side by Side Diff: src/flags.cc

Issue 1011703003: Serializer: Cache FlagList::Hash result. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix test case Created 5 years, 9 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
« no previous file with comments | « src/flags.h ('k') | test/cctest/test-serialize.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 <cctype> 5 #include <cctype>
6 #include <cstdlib> 6 #include <cstdlib>
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "src/v8.h" 9 #include "src/v8.h"
10 10
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 << "Options:\n"; 536 << "Options:\n";
537 for (size_t i = 0; i < num_flags; ++i) { 537 for (size_t i = 0; i < num_flags; ++i) {
538 Flag* f = &flags[i]; 538 Flag* f = &flags[i];
539 os << " --" << f->name() << " (" << f->comment() << ")\n" 539 os << " --" << f->name() << " (" << f->comment() << ")\n"
540 << " type: " << Type2String(f->type()) << " default: " << *f 540 << " type: " << Type2String(f->type()) << " default: " << *f
541 << "\n"; 541 << "\n";
542 } 542 }
543 } 543 }
544 544
545 545
546 // static 546 static uint32_t flag_hash = 0;
547 void FlagList::EnforceFlagImplications() {
548 #define FLAG_MODE_DEFINE_IMPLICATIONS
549 #include "src/flag-definitions.h"
550 #undef FLAG_MODE_DEFINE_IMPLICATIONS
551 }
552 547
553 548
554 uint32_t FlagList::Hash() { 549 void ComputeFlagListHash() {
555 std::ostringstream modified_args_as_string; 550 std::ostringstream modified_args_as_string;
556 #ifdef DEBUG 551 #ifdef DEBUG
557 modified_args_as_string << "debug"; 552 modified_args_as_string << "debug";
558 #endif // DEBUG 553 #endif // DEBUG
559 for (size_t i = 0; i < num_flags; ++i) { 554 for (size_t i = 0; i < num_flags; ++i) {
560 Flag* current = &flags[i]; 555 Flag* current = &flags[i];
561 if (!current->IsDefault()) { 556 if (!current->IsDefault()) {
562 modified_args_as_string << i; 557 modified_args_as_string << i;
563 modified_args_as_string << *current; 558 modified_args_as_string << *current;
564 } 559 }
565 } 560 }
566 std::string args(modified_args_as_string.str()); 561 std::string args(modified_args_as_string.str());
567 return static_cast<uint32_t>( 562 flag_hash = static_cast<uint32_t>(
568 base::hash_range(args.c_str(), args.c_str() + args.length())); 563 base::hash_range(args.c_str(), args.c_str() + args.length()));
569 } 564 }
565
566
567 // static
568 void FlagList::EnforceFlagImplications() {
569 #define FLAG_MODE_DEFINE_IMPLICATIONS
570 #include "src/flag-definitions.h"
571 #undef FLAG_MODE_DEFINE_IMPLICATIONS
572 ComputeFlagListHash();
573 }
574
575
576 uint32_t FlagList::Hash() { return flag_hash; }
570 } } // namespace v8::internal 577 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/flags.h ('k') | test/cctest/test-serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698