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

Unified Diff: src/ia32/lithium-codegen-ia32.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/ia32/lithium-codegen-ia32.cc
diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc
index 761f5164dd81920777368707d8a10c61960fda2a..75f3797f77d4e9ade250e2a54a6c3e5f1e582b1f 100644
--- a/src/ia32/lithium-codegen-ia32.cc
+++ b/src/ia32/lithium-codegen-ia32.cc
@@ -5339,8 +5339,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;
mvstanton 2013/01/11 16:56:06 Please put this in hydrogen-instructions just like
mvstanton 2013/01/15 15:23:15 By stripping the allocation_site_info flag from th
FastCloneShallowArrayStub stub(mode, length);
CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
}
@@ -5350,10 +5351,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(ecx));
ASSERT(!result.is(ecx));
+ bool create_allocation_site_info = mode == TRACK_ALLOCATION_SITE_INFO &&
+ object->map()->CanTrackAllocationSite();
+
if (FLAG_debug_code) {
__ LoadHeapObject(ecx, object);
__ cmp(source, ecx);
@@ -5377,8 +5382,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);
@@ -5402,7 +5413,8 @@ void LCodeGen::EmitDeepCopy(Handle<JSObject> object,
__ lea(ecx, Operand(result, *offset));
__ mov(FieldOperand(result, total_offset), ecx);
__ 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(ecx, Handle<HeapObject>::cast(value));
__ mov(FieldOperand(result, total_offset), ecx);
@@ -5411,6 +5423,14 @@ void LCodeGen::EmitDeepCopy(Handle<JSObject> object,
}
}
+ // Build Allocation Site Info if desired
+ if (create_allocation_site_info) {
+ __ mov(FieldOperand(result, object_size),
+ Immediate(Handle<Map>(isolate()->heap()->
+ allocation_site_info_map())));
+ __ mov(FieldOperand(result, object_size + kPointerSize), source);
+ }
+
if (has_elements) {
// Copy elements backing store header.
__ LoadHeapObject(source, elements);
@@ -5443,7 +5463,8 @@ void LCodeGen::EmitDeepCopy(Handle<JSObject> object,
__ lea(ecx, Operand(result, *offset));
__ mov(FieldOperand(result, total_offset), ecx);
__ 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(ecx, Handle<HeapObject>::cast(value));
__ mov(FieldOperand(result, total_offset), ecx);
@@ -5493,7 +5514,8 @@ void LCodeGen::DoFastLiteral(LFastLiteral* instr) {
__ bind(&allocated);
int offset = 0;
__ LoadHeapObject(ebx, instr->hydrogen()->boilerplate());
- EmitDeepCopy(instr->hydrogen()->boilerplate(), eax, ebx, &offset);
+ EmitDeepCopy(instr->hydrogen()->boilerplate(), eax, ebx, &offset,
+ instr->hydrogen()->allocation_site_info_mode());
ASSERT_EQ(size, offset);
}

Powered by Google App Engine
This is Rietveld 408576698