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

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: Code cleanup 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..aab3c9cd205f05d8c47d7ea8c8242cce52a073dc 100644
--- a/src/ia32/lithium-codegen-ia32.cc
+++ b/src/ia32/lithium-codegen-ia32.cc
@@ -5337,10 +5337,18 @@ void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) {
} else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) {
CallRuntime(Runtime::kCreateArrayLiteralShallow, 3, instr);
} else {
+ // TODO(mvstanton): I'm doing more work than necessary here by running
+ // CLONE_ANY_ELEMENTS instead of the more specific stub, but I'm doing it
+ // just because I want to track allocation info. Alternative approach: quit
+ // baking allocation tracking info into this field, instead just have it on
+ // all the time?
FastCloneShallowArrayStub::Mode mode =
+ FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS_WITH_ALLOCATION_SITE_INFO;
+ /*
boilerplate_elements_kind == FAST_DOUBLE_ELEMENTS
? FastCloneShallowArrayStub::CLONE_DOUBLE_ELEMENTS
: FastCloneShallowArrayStub::CLONE_ELEMENTS;
+ */
FastCloneShallowArrayStub stub(mode, length);
CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
}
@@ -5350,7 +5358,8 @@ void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) {
void LCodeGen::EmitDeepCopy(Handle<JSObject> object,
Register result,
Register source,
- int* offset) {
+ int* offset,
+ bool create_allocation_site_info) {
ASSERT(!source.is(ecx));
ASSERT(!result.is(ecx));
@@ -5377,8 +5386,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);
@@ -5411,6 +5426,14 @@ void LCodeGen::EmitDeepCopy(Handle<JSObject> object,
}
}
+ // Build Allocation Site Info if desired
+ if (create_allocation_site_info) {
danno 2013/01/10 22:58:59 Here and other platforms, only do this if and "cre
mvstanton 2013/01/11 13:43:01 Done.
+ __ 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);
@@ -5493,7 +5516,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()->create_allocation_site_info());
ASSERT_EQ(size, offset);
}

Powered by Google App Engine
This is Rietveld 408576698