Enable pretenuring of fast literals in high promotion mode.
authorhpayer@chromium.org <hpayer@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Fri, 12 Apr 2013 09:45:46 +0000 (09:45 +0000)
committerhpayer@chromium.org <hpayer@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Fri, 12 Apr 2013 09:45:46 +0000 (09:45 +0000)
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
src/flag-definitions.h
src/hydrogen.cc
src/ia32/lithium-codegen-ia32.cc
src/x64/lithium-codegen-x64.cc

index 19cef6b..5d02613 100644 (file)
@@ -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);
 }
 
index 8ac0613..8e92017 100644 (file)
@@ -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")
index fcc49a4..a2ddc04 100644 (file)
@@ -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<HAllocate::Flags>(
+        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);
index bbea4d9..bc1173b 100644 (file)
@@ -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);
 }
 
index 9b648a3..d2325b8 100644 (file)
@@ -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);
 }