Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Unified Diff: src/arm/lithium-codegen-arm.cc

Issue 11817017: Additional work to get array literal allocation tracking working, even with --always-opt (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Removed MIPs changes, and found a bug. COPY_ON_WRITE shallow array stub didn't track allocation inf… Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/arm/lithium-codegen-arm.cc
diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc
index 9a830733feaafb5307493e3943a6ec6d5d47f7a2..95d4286a5e308e61f5a3fcaccd802ce58e0baefe 100644
--- a/src/arm/lithium-codegen-arm.cc
+++ b/src/arm/lithium-codegen-arm.cc
@@ -5471,8 +5471,9 @@ void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) {
} else {
FastCloneShallowArrayStub::Mode mode =
boilerplate_elements_kind == FAST_DOUBLE_ELEMENTS
- ? FastCloneShallowArrayStub::CLONE_DOUBLE_ELEMENTS
- : FastCloneShallowArrayStub::CLONE_ELEMENTS;
+ ? FastCloneShallowArrayStub::
+ CLONE_DOUBLE_ELEMENTS_WITH_ALLOCATION_SITE_INFO
+ : FastCloneShallowArrayStub::CLONE_ELEMENTS_WITH_ALLOCATION_SITE_INFO;
FastCloneShallowArrayStub stub(mode, length);
CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
}
@@ -5482,10 +5483,14 @@ void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) {
void LCodeGen::EmitDeepCopy(Handle<JSObject> object,
Register result,
Register source,
- int* offset) {
+ int* offset,
+ AllocationSiteInfoMode mode) {
ASSERT(!source.is(r2));
ASSERT(!result.is(r2));
+ bool create_allocation_site_info = mode == TRACK_ALLOCATION_SITE_INFO &&
+ object->map()->CanTrackAllocationSite();
+
// Only elements backing stores for non-COW arrays need to be copied.
Handle<FixedArrayBase> elements(object->elements());
bool has_elements = elements->length() > 0 &&
@@ -5496,8 +5501,14 @@ void LCodeGen::EmitDeepCopy(Handle<JSObject> object,
int object_offset = *offset;
int object_size = object->map()->instance_size();
int elements_offset = *offset + object_size;
+ if (create_allocation_site_info) {
+ elements_offset += AllocationSiteInfo::kSize;
+ }
int elements_size = has_elements ? elements->Size() : 0;
*offset += object_size + elements_size;
+ if (create_allocation_site_info) {
+ *offset += AllocationSiteInfo::kSize;
+ }
// Copy object header.
ASSERT(object->properties()->length() == 0);
@@ -5521,7 +5532,8 @@ void LCodeGen::EmitDeepCopy(Handle<JSObject> object,
__ add(r2, result, Operand(*offset));
__ str(r2, FieldMemOperand(result, total_offset));
__ LoadHeapObject(source, value_object);
- EmitDeepCopy(value_object, result, source, offset);
+ EmitDeepCopy(value_object, result, source, offset,
+ DONT_TRACK_ALLOCATION_SITE_INFO);
} else if (value->IsHeapObject()) {
__ LoadHeapObject(r2, Handle<HeapObject>::cast(value));
__ str(r2, FieldMemOperand(result, total_offset));
@@ -5531,6 +5543,14 @@ void LCodeGen::EmitDeepCopy(Handle<JSObject> object,
}
}
+ // Build Allocation Site Info if desired
+ if (create_allocation_site_info) {
+ __ mov(r2, Operand(Handle<Map>(isolate()->heap()->
+ allocation_site_info_map())));
+ __ str(r2, FieldMemOperand(result, object_size));
+ __ str(source, FieldMemOperand(result, object_size + kPointerSize));
+ }
+
if (has_elements) {
// Copy elements backing store header.
__ LoadHeapObject(source, elements);
@@ -5566,7 +5586,8 @@ void LCodeGen::EmitDeepCopy(Handle<JSObject> object,
__ add(r2, result, Operand(*offset));
__ str(r2, FieldMemOperand(result, total_offset));
__ LoadHeapObject(source, value_object);
- EmitDeepCopy(value_object, result, source, offset);
+ EmitDeepCopy(value_object, result, source, offset,
+ DONT_TRACK_ALLOCATION_SITE_INFO);
} else if (value->IsHeapObject()) {
__ LoadHeapObject(r2, Handle<HeapObject>::cast(value));
__ str(r2, FieldMemOperand(result, total_offset));
@@ -5617,7 +5638,8 @@ void LCodeGen::DoFastLiteral(LFastLiteral* instr) {
__ bind(&allocated);
int offset = 0;
__ LoadHeapObject(r1, instr->hydrogen()->boilerplate());
- EmitDeepCopy(instr->hydrogen()->boilerplate(), r0, r1, &offset);
+ EmitDeepCopy(instr->hydrogen()->boilerplate(), r0, r1, &offset,
+ instr->hydrogen()->allocation_site_info_mode());
ASSERT_EQ(size, offset);
}

Powered by Google App Engine
This is Rietveld 408576698