From acc4568affe9e6879e2e834f7c75767ff6589096 Mon Sep 17 00:00:00 2001 From: "hpayer@chromium.org" Date: Fri, 12 Apr 2013 09:45:46 +0000 Subject: [PATCH] Enable pretenuring of fast literals in high promotion mode. BUG= Review URL: https://codereview.chromium.org/13952008 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14248 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/arm/lithium-codegen-arm.cc | 8 +++++++- src/flag-definitions.h | 2 +- src/hydrogen.cc | 11 ++++++++++- src/ia32/lithium-codegen-ia32.cc | 9 +++++++-- src/x64/lithium-codegen-x64.cc | 8 +++++++- 5 files changed, 32 insertions(+), 6 deletions(-) diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc index 19cef6b..5d02613 100644 --- a/src/arm/lithium-codegen-arm.cc +++ b/src/arm/lithium-codegen-arm.cc @@ -5472,7 +5472,13 @@ void LCodeGen::DoDeferredAllocate(LAllocate* instr) { PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters); __ SmiTag(size, size); __ push(size); - CallRuntimeFromDeferred(Runtime::kAllocateInNewSpace, 1, instr); + if (instr->hydrogen()->CanAllocateInOldPointerSpace()) { + CallRuntimeFromDeferred( + Runtime::kAllocateInOldPointerSpace, 1, instr); + } else { + CallRuntimeFromDeferred( + Runtime::kAllocateInNewSpace, 1, instr); + } __ StoreToSafepointRegisterSlot(r0, result); } diff --git a/src/flag-definitions.h b/src/flag-definitions.h index 8ac0613..8e92017 100644 --- a/src/flag-definitions.h +++ b/src/flag-definitions.h @@ -173,7 +173,7 @@ DEFINE_bool(compiled_keyed_stores, true, "use optimizing compiler to " DEFINE_bool(clever_optimizations, true, "Optimize object size, Array shift, DOM strings and string +") -DEFINE_bool(pretenure_literals, false, "allocate literals in old space") +DEFINE_bool(pretenure_literals, true, "allocate literals in old space") // Flags for data representation optimizations DEFINE_bool(unbox_double_arrays, true, "automatically unbox arrays of doubles") diff --git a/src/hydrogen.cc b/src/hydrogen.cc index fcc49a4..a2ddc04 100644 --- a/src/hydrogen.cc +++ b/src/hydrogen.cc @@ -10101,6 +10101,15 @@ HInstruction* HOptimizedGraphBuilder::BuildFastLiteral( NoObservableSideEffectsScope no_effects(this); + HAllocate::Flags flags = HAllocate::CAN_ALLOCATE_IN_NEW_SPACE; + // TODO(hpayer): add support for old data space + if (FLAG_pretenure_literals && + isolate()->heap()->ShouldGloballyPretenure() && + data_size == 0) { + flags = static_cast( + flags | HAllocate::CAN_ALLOCATE_IN_OLD_POINTER_SPACE); + } + HValue* size_in_bytes = AddInstruction(new(zone) HConstant(total_size, Representation::Integer32())); @@ -10108,7 +10117,7 @@ HInstruction* HOptimizedGraphBuilder::BuildFastLiteral( AddInstruction(new(zone) HAllocate(context, size_in_bytes, HType::JSObject(), - HAllocate::CAN_ALLOCATE_IN_NEW_SPACE)); + flags)); int offset = 0; BuildEmitDeepCopy(boilerplate_object, original_boilerplate_object, result, &offset, mode); diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc index bbea4d9..bc1173b 100644 --- a/src/ia32/lithium-codegen-ia32.cc +++ b/src/ia32/lithium-codegen-ia32.cc @@ -6001,8 +6001,13 @@ void LCodeGen::DoDeferredAllocate(LAllocate* instr) { __ StoreToSafepointRegisterSlot(result, size); } __ push(size); - CallRuntimeFromDeferred( - Runtime::kAllocateInNewSpace, 1, instr, instr->context()); + if (instr->hydrogen()->CanAllocateInOldPointerSpace()) { + CallRuntimeFromDeferred( + Runtime::kAllocateInOldPointerSpace, 1, instr, instr->context()); + } else { + CallRuntimeFromDeferred( + Runtime::kAllocateInNewSpace, 1, instr, instr->context()); + } __ StoreToSafepointRegisterSlot(result, eax); } diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc index 9b648a3..d2325b8 100644 --- a/src/x64/lithium-codegen-x64.cc +++ b/src/x64/lithium-codegen-x64.cc @@ -5104,7 +5104,13 @@ void LCodeGen::DoDeferredAllocate(LAllocate* instr) { PushSafepointRegistersScope scope(this); __ Integer32ToSmi(size, size); __ push(size); - CallRuntimeFromDeferred(Runtime::kAllocateInNewSpace, 1, instr); + if (instr->hydrogen()->CanAllocateInOldPointerSpace()) { + CallRuntimeFromDeferred( + Runtime::kAllocateInOldPointerSpace, 1, instr); + } else { + CallRuntimeFromDeferred( + Runtime::kAllocateInNewSpace, 1, instr); + } __ StoreToSafepointRegisterSlot(result, rax); } -- 2.7.4