Reviewers: Michael Starzinger,
Description:
Move global pretenuring flag check to ShouldGloballyPretenure().
BUG=
Please review this at https://codereview.chromium.org/15734007/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/code-stubs-hydrogen.cc
M src/heap.h
M src/heap.cc
M src/hydrogen.cc
M test/cctest/test-heap.cc
Index: src/code-stubs-hydrogen.cc
diff --git a/src/code-stubs-hydrogen.cc b/src/code-stubs-hydrogen.cc
index
6e837ddb956c09c0fb56bd687185d7d75f176c25..fdfd0595786d588441b7c11a160d522068b64db6
100644
--- a/src/code-stubs-hydrogen.cc
+++ b/src/code-stubs-hydrogen.cc
@@ -383,7 +383,7 @@ HValue*
CodeStubGraphBuilder<FastCloneShallowObjectStub>::BuildCodeStub() {
HValue* size_in_bytes =
AddInstruction(new(zone) HConstant(size,
Representation::Integer32()));
HAllocate::Flags flags = HAllocate::CAN_ALLOCATE_IN_NEW_SPACE;
- if (FLAG_pretenure_literals) {
+ if (isolate()->heap()->ShouldGloballyPretenure()) {
flags = static_cast<HAllocate::Flags>(
flags | HAllocate::CAN_ALLOCATE_IN_OLD_POINTER_SPACE);
}
Index: src/heap.cc
diff --git a/src/heap.cc b/src/heap.cc
index
98844f05e91deb508b77e4e554dbea4bc6394802..231649e85e4f593f494181c8bf10c1d096e871fe
100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -938,7 +938,7 @@ bool Heap::PerformGarbageCollection(GarbageCollector
collector,
// maximum capacity indicates that most objects will be promoted.
// To decrease scavenger pauses and final mark-sweep pauses, we
// have to limit maximal capacity of the young generation.
- new_space_high_promotion_mode_active_ = true;
+ SetNewSpaceHighPromotionModeActive(true);
if (FLAG_trace_gc) {
PrintPID("Limited new space size due to high promotion rate: %d
MB\n",
new_space_.InitialCapacity() / MB);
@@ -956,7 +956,7 @@ bool Heap::PerformGarbageCollection(GarbageCollector
collector,
// Decreasing low survival rates might indicate that the above high
// promotion mode is over and we should allow the young generation
// to grow again.
- new_space_high_promotion_mode_active_ = false;
+ SetNewSpaceHighPromotionModeActive(false);
if (FLAG_trace_gc) {
PrintPID("Unlimited new space size due to low promotion rate: %d
MB\n",
new_space_.MaximumCapacity() / MB);
Index: src/heap.h
diff --git a/src/heap.h b/src/heap.h
index
b24b0b3608344ffba6177e42df6edf3c02f217e2..335c5a8feab68f527d5d4a96b4da1c3fe7366813
100644
--- a/src/heap.h
+++ b/src/heap.h
@@ -1546,7 +1546,11 @@ class Heap {
// Predicate that governs global pre-tenuring decisions based on observed
// promotion rates of previous collections.
inline bool ShouldGloballyPretenure() {
- return new_space_high_promotion_mode_active_;
+ return FLAG_pretenure_literals &&
new_space_high_promotion_mode_active_;
+ }
+
+ void SetNewSpaceHighPromotionModeActive(bool mode) {
+ new_space_high_promotion_mode_active_ = mode;
}
inline PretenureFlag GetPretenureMode() {
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index
b53e9b514e78ab19fe140422a23c1fb303809fa1..1ba3581b5569834484e72d0351f4757c7b6c6e4a
100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -1391,7 +1391,7 @@ HValue* HGraphBuilder::BuildAllocateElements(HValue*
context,
total_size->ClearFlag(HValue::kCanOverflow);
HAllocate::Flags flags = HAllocate::DefaultFlags(kind);
- if (FLAG_pretenure_literals) {
+ if (isolate()->heap()->ShouldGloballyPretenure()) {
// TODO(hpayer): When pretenuring can be internalized, flags can become
// private to HAllocate.
if (IsFastDoubleElementsKind(kind)) {
@@ -10867,8 +10867,7 @@ HInstruction*
HOptimizedGraphBuilder::BuildFastLiteral(
HAllocate::Flags flags = HAllocate::CAN_ALLOCATE_IN_NEW_SPACE;
// TODO(hpayer): add support for old data space
- if (FLAG_pretenure_literals &&
- isolate()->heap()->ShouldGloballyPretenure() &&
+ if (isolate()->heap()->ShouldGloballyPretenure() &&
data_size == 0) {
flags = static_cast<HAllocate::Flags>(
flags | HAllocate::CAN_ALLOCATE_IN_OLD_POINTER_SPACE);
Index: test/cctest/test-heap.cc
diff --git a/test/cctest/test-heap.cc b/test/cctest/test-heap.cc
index
ca173c25a56b131bb8c871e9ed40903562e77099..9379f75a0a82142468df1452204e73567ffef3dc
100644
--- a/test/cctest/test-heap.cc
+++ b/test/cctest/test-heap.cc
@@ -2078,11 +2078,11 @@ TEST(OptimizedAllocationAlwaysInNewSpace) {
// Test pretenuring of array literals allocated with HAllocate.
TEST(OptimizedPretenuringArrayLiterals) {
i::FLAG_allow_natives_syntax = true;
- i::FLAG_pretenure_literals = true;
CcTest::InitializeVM();
if (!i::V8::UseCrankshaft() || i::FLAG_always_opt) return;
if (i::FLAG_gc_global || i::FLAG_stress_compaction) return;
v8::HandleScope scope(CcTest::isolate());
+ HEAP->SetNewSpaceHighPromotionModeActive(true);
AlwaysAllocateScope always_allocate;
v8::Local<v8::Value> res = CompileRun(
--
--
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/groups/opt_out.