Revision: 15798
Author: [email protected]
Date: Mon Jul 22 04:07:43 2013
Log: Prefill pre-allocated memory of folded allocation with one
pointer fillers when heap verifier is on.
BUG=
[email protected]
Review URL: https://codereview.chromium.org/19723004
http://code.google.com/p/v8/source/detail?r=15798
Modified:
/branches/bleeding_edge/src/arm/lithium-codegen-arm.cc
/branches/bleeding_edge/src/hydrogen-instructions.cc
/branches/bleeding_edge/src/hydrogen-instructions.h
/branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc
/branches/bleeding_edge/src/x64/lithium-codegen-x64.cc
=======================================
--- /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc Fri Jul 19
06:30:49 2013
+++ /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc Mon Jul 22
04:07:43 2013
@@ -5364,6 +5364,25 @@
}
__ bind(deferred->exit());
+
+ if (instr->hydrogen()->MustPrefillWithFiller()) {
+ if (instr->size()->IsConstantOperand()) {
+ int32_t size = ToInteger32(LConstantOperand::cast(instr->size()));
+ __ mov(scratch, Operand(size));
+ } else {
+ scratch = ToRegister(instr->size());
+ }
+ __ sub(scratch, scratch, Operand(kPointerSize));
+ __ sub(result, result, Operand(kHeapObjectTag));
+ Label loop;
+ __ bind(&loop);
+ __ mov(scratch2,
Operand(isolate()->factory()->one_pointer_filler_map()));
+ __ str(scratch2, MemOperand(result, scratch));
+ __ sub(scratch, scratch, Operand(kPointerSize));
+ __ cmp(scratch, Operand(0));
+ __ b(ge, &loop);
+ __ add(result, result, Operand(kHeapObjectTag));
+ }
}
=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.cc Fri Jul 19
04:29:11 2013
+++ /branches/bleeding_edge/src/hydrogen-instructions.cc Mon Jul 22
04:07:43 2013
@@ -3237,35 +3237,9 @@
dominator_allocate_instr->UpdateSize(new_dominator_size);
#ifdef VERIFY_HEAP
- HInstruction* free_space_instr =
- new(zone) HInnerAllocatedObject(dominator_allocate_instr,
- dominator_size_constant,
- type());
- free_space_instr->InsertAfter(dominator_allocate_instr);
- HConstant* filler_map = new(zone) HConstant(
- isolate()->factory()->free_space_map(),
- UniqueValueId(isolate()->heap()->free_space_map()),
- Representation::Tagged(),
- HType::Tagged(),
- false,
- true,
- false,
- false);
- filler_map->InsertAfter(free_space_instr);
-
- HInstruction* store_map = new(zone) HStoreNamedField(
- free_space_instr, HObjectAccess::ForMap(), filler_map);
- store_map->SetFlag(HValue::kHasNoObservableSideEffects);
- store_map->InsertAfter(filler_map);
-
- HInstruction* free_space_size = new(zone)
HConstant(current_size_constant);
- free_space_size->InsertAfter(store_map);
- HObjectAccess access =
- HObjectAccess::ForJSObjectOffset(FreeSpace::kSizeOffset);
- HInstruction* store_size = new(zone) HStoreNamedField(
- free_space_instr, access, free_space_size);
- store_size->SetFlag(HValue::kHasNoObservableSideEffects);
- store_size->InsertAfter(free_space_size);
+ if (FLAG_verify_heap) {
+ dominator_allocate_instr->SetFlags(HAllocate::PREFILL_WITH_FILLER);
+ }
#endif
// After that replace the dominated allocate instruction.
=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.h Fri Jul 19 06:30:49
2013
+++ /branches/bleeding_edge/src/hydrogen-instructions.h Mon Jul 22 04:07:43
2013
@@ -4964,7 +4964,8 @@
CAN_ALLOCATE_IN_NEW_SPACE = 1 << 0,
CAN_ALLOCATE_IN_OLD_DATA_SPACE = 1 << 1,
CAN_ALLOCATE_IN_OLD_POINTER_SPACE = 1 << 2,
- ALLOCATE_DOUBLE_ALIGNED = 1 << 3
+ ALLOCATE_DOUBLE_ALIGNED = 1 << 3,
+ PREFILL_WITH_FILLER = 1 << 4
};
HAllocate(HValue* context, HValue* size, HType type, Flags flags)
@@ -5040,6 +5041,14 @@
bool MustAllocateDoubleAligned() const {
return (flags_ & ALLOCATE_DOUBLE_ALIGNED) != 0;
}
+
+ bool MustPrefillWithFiller() const {
+ return (flags_ & PREFILL_WITH_FILLER) != 0;
+ }
+
+ void SetFlags(Flags flags) {
+ flags_ = static_cast<HAllocate::Flags>(flags_ | flags);
+ }
void UpdateSize(HValue* size) {
SetOperandAt(1, size);
=======================================
--- /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc Fri Jul 19
06:30:49 2013
+++ /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc Mon Jul 22
04:07:43 2013
@@ -6046,6 +6046,23 @@
}
__ bind(deferred->exit());
+
+ if (instr->hydrogen()->MustPrefillWithFiller()) {
+ if (instr->size()->IsConstantOperand()) {
+ int32_t size = ToInteger32(LConstantOperand::cast(instr->size()));
+ __ mov(temp, (size / kPointerSize) - 1);
+ } else {
+ temp = ToRegister(instr->size());
+ __ shr(temp, kPointerSizeLog2);
+ __ dec(temp);
+ }
+ Label loop;
+ __ bind(&loop);
+ __ mov(FieldOperand(result, temp, times_pointer_size, 0),
+ isolate()->factory()->one_pointer_filler_map());
+ __ dec(temp);
+ __ j(not_zero, &loop);
+ }
}
=======================================
--- /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc Fri Jul 19
06:30:49 2013
+++ /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc Mon Jul 22
04:07:43 2013
@@ -5075,6 +5075,23 @@
}
__ bind(deferred->exit());
+
+ if (instr->hydrogen()->MustPrefillWithFiller()) {
+ if (instr->size()->IsConstantOperand()) {
+ int32_t size = ToInteger32(LConstantOperand::cast(instr->size()));
+ __ movl(temp, Immediate((size / kPointerSize) - 1));
+ } else {
+ temp = ToRegister(instr->size());
+ __ sar(temp, Immediate(kPointerSizeLog2));
+ __ decl(temp);
+ }
+ Label loop;
+ __ bind(&loop);
+ __ Move(FieldOperand(result, temp, times_pointer_size, 0),
+ isolate()->factory()->one_pointer_filler_map());
+ __ decl(temp);
+ __ j(not_zero, &loop);
+ }
}
--
--
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.