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

Side by Side Diff: src/objects-inl.h

Issue 23803007: Fix wraparound of deoptimization count in shared function info. Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 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/objects.h ('k') | src/runtime-profiler.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 4870 matching lines...) Expand 10 before | Expand all | Expand 10 after
4881 4881
4882 4882
4883 void SharedFunctionInfo::set_deopt_count(int deopt_count) { 4883 void SharedFunctionInfo::set_deopt_count(int deopt_count) {
4884 set_counters(DeoptCountBits::update(counters(), deopt_count)); 4884 set_counters(DeoptCountBits::update(counters(), deopt_count));
4885 } 4885 }
4886 4886
4887 4887
4888 void SharedFunctionInfo::increment_deopt_count() { 4888 void SharedFunctionInfo::increment_deopt_count() {
4889 int value = counters(); 4889 int value = counters();
4890 int deopt_count = DeoptCountBits::decode(value); 4890 int deopt_count = DeoptCountBits::decode(value);
4891 deopt_count = (deopt_count + 1) & DeoptCountBits::kMax; 4891 if (deopt_count < DeoptCountBits::kMax) {
4892 set_counters(DeoptCountBits::update(value, deopt_count)); 4892 deopt_count = (deopt_count + 1) & DeoptCountBits::kMax;
Toon Verwaest 2013/09/05 18:13:57 I guess this mask isn't necessary anymore.
4893 set_counters(DeoptCountBits::update(value, deopt_count));
4894 if (deopt_count == DeoptCountBits::kMax) {
4895 // We hit the limit; temporarily disable optimization.
4896 // The runtime profiler may try to reenable optimization sometime later.
4897 DisableOptimization(kDeoptimizedTooManyTimes);
4898 }
4899 }
4893 } 4900 }
4894 4901
4895 4902
4903 bool SharedFunctionInfo::too_many_deopts() {
4904 return DeoptCountBits::decode(counters()) == DeoptCountBits::kMax;
4905 }
4906
4907
4896 int SharedFunctionInfo::opt_reenable_tries() { 4908 int SharedFunctionInfo::opt_reenable_tries() {
4897 return OptReenableTriesBits::decode(counters()); 4909 return OptReenableTriesBits::decode(counters());
4898 } 4910 }
4899 4911
4900 4912
4901 void SharedFunctionInfo::set_opt_reenable_tries(int tries) { 4913 void SharedFunctionInfo::set_opt_reenable_tries(int tries) {
4902 set_counters(OptReenableTriesBits::update(counters(), tries)); 4914 set_counters(OptReenableTriesBits::update(counters(), tries));
4903 } 4915 }
4904 4916
4905 4917
(...skipping 1374 matching lines...) Expand 10 before | Expand all | Expand 10 after
6280 #undef WRITE_UINT32_FIELD 6292 #undef WRITE_UINT32_FIELD
6281 #undef READ_SHORT_FIELD 6293 #undef READ_SHORT_FIELD
6282 #undef WRITE_SHORT_FIELD 6294 #undef WRITE_SHORT_FIELD
6283 #undef READ_BYTE_FIELD 6295 #undef READ_BYTE_FIELD
6284 #undef WRITE_BYTE_FIELD 6296 #undef WRITE_BYTE_FIELD
6285 6297
6286 6298
6287 } } // namespace v8::internal 6299 } } // namespace v8::internal
6288 6300
6289 #endif // V8_OBJECTS_INL_H_ 6301 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/runtime-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698