Reviewers: jarin,
Description:
[osr] Increase Code::profiler_ticks to 28 bits.
Up until now we were unable to have profiler ticks beyong 255, which
basically disabled OSR for moderately large functions.
BUG=chromium:508741
LOG=n
[email protected]
Please review this at https://codereview.chromium.org/1224173003/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+12, -9 lines):
M src/objects.h
M src/objects-inl.h
M src/runtime-profiler.cc
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index
6b1cfb3c330f1d22c31793d0b4b807d2f0b537e4..95c64fcf6ffaafa6e56e60b813066cf231e93797
100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -4602,14 +4602,16 @@ void Code::set_allow_osr_at_loop_nesting_level(int
level) {
int Code::profiler_ticks() {
DCHECK_EQ(FUNCTION, kind());
- return READ_BYTE_FIELD(this, kProfilerTicksOffset);
+ return ProfilerTicksField::decode(
+ READ_UINT32_FIELD(this, kKindSpecificFlags1Offset));
}
void Code::set_profiler_ticks(int ticks) {
- DCHECK(ticks < 256);
if (kind() == FUNCTION) {
- WRITE_BYTE_FIELD(this, kProfilerTicksOffset, ticks);
+ unsigned previous = READ_UINT32_FIELD(this, kKindSpecificFlags1Offset);
+ unsigned updated = ProfilerTicksField::update(previous, ticks);
+ WRITE_UINT32_FIELD(this, kKindSpecificFlags1Offset, updated);
}
}
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index
16938972ba28f1a2af618a731cb2314502adf6d2..fc25ba2485fcb557f28bd61d0a70baa673ed4b44
100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -5333,8 +5333,7 @@ class Code: public HeapObject {
class FullCodeFlagsIsCompiledOptimizable: public BitField<bool, 2, 1> {};
class FullCodeFlagsHasRelocInfoForSerialization
: public BitField<bool, 3, 1> {};
-
- static const int kProfilerTicksOffset = kFullCodeFlags + 1;
+ class ProfilerTicksField : public BitField<int, 4, 28> {};
// Flags layout. BitField<type, shift, size>.
class ICStateField : public BitField<InlineCacheState, 0, 4> {};
Index: src/runtime-profiler.cc
diff --git a/src/runtime-profiler.cc b/src/runtime-profiler.cc
index
351bca7b6aa08d534f3a9e633fff8fadcf9dcc38..184007835b8579a1241e9777c3beece4af0882ca
100644
--- a/src/runtime-profiler.cc
+++ b/src/runtime-profiler.cc
@@ -181,10 +181,12 @@ void RuntimeProfiler::OptimizeNow() {
// Attempt OSR if we are still running unoptimized code even though
the
// the function has long been marked or even already been optimized.
int ticks = shared_code->profiler_ticks();
- int allowance = kOSRCodeSizeAllowanceBase +
- ticks * kOSRCodeSizeAllowancePerTick;
- if (shared_code->CodeSize() > allowance) {
- if (ticks < 255) shared_code->set_profiler_ticks(ticks + 1);
+ int64_t allowance =
+ kOSRCodeSizeAllowanceBase +
+ static_cast<int64_t>(ticks) * kOSRCodeSizeAllowancePerTick;
+ if (shared_code->CodeSize() > allowance &&
+ ticks < Code::ProfilerTicksField::kMax) {
+ shared_code->set_profiler_ticks(ticks + 1);
} else {
AttemptOnStackReplacement(function);
}
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.