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

Unified Diff: src/ia32/code-stubs-ia32.cc

Issue 11663005: Adapt Danno's Track Allocation Info idea to fast literals. When allocating a literal array, (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Ported to other platforms Created 7 years, 12 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/code-stubs-ia32.cc
diff --git a/src/ia32/code-stubs-ia32.cc b/src/ia32/code-stubs-ia32.cc
index 92f55b8049303380244e5b3ccd989dcf02d794ab..e372e20cd5be53d931b30ef35c18b312fab2e6a4 100644
--- a/src/ia32/code-stubs-ia32.cc
+++ b/src/ia32/code-stubs-ia32.cc
@@ -323,6 +323,7 @@ static void GenerateFastCloneShallowArrayCommon(
MacroAssembler* masm,
int length,
FastCloneShallowArrayStub::Mode mode,
+ FastCloneShallowArrayStub::AllocationInfoMode allocation_info_mode,
Label* fail) {
// Registers on entry:
//
@@ -336,7 +337,13 @@ static void GenerateFastCloneShallowArrayCommon(
? FixedDoubleArray::SizeFor(length)
: FixedArray::SizeFor(length);
}
- int size = JSArray::kSize + elements_size;
+ int size = JSArray::kSize;
+ int allocation_info_start = size;
+ if (allocation_info_mode ==
+ FastCloneShallowArrayStub::TRACK_ALLOCATION_INFO) {
+ size += AllocationSiteInfo::kSize;
+ }
+ size += elements_size;
// Allocate both the JS array and the elements array in one big
// allocation. This avoids multiple limit checks.
@@ -346,6 +353,14 @@ static void GenerateFastCloneShallowArrayCommon(
}
__ AllocateInNewSpace(size, eax, ebx, edx, fail, flags);
+ if (allocation_info_mode ==
+ FastCloneShallowArrayStub::TRACK_ALLOCATION_INFO) {
+ __ mov(FieldOperand(eax, allocation_info_start),
+ Immediate(Handle<Map>(masm->isolate()->heap()->
+ allocation_site_info_map())));
+ __ mov(FieldOperand(eax, allocation_info_start + kPointerSize), ecx);
+ }
+
// Copy the JS array part.
for (int i = 0; i < JSArray::kSize; i += kPointerSize) {
if ((i != JSArray::kElementsOffset) || (length == 0)) {
@@ -358,7 +373,12 @@ static void GenerateFastCloneShallowArrayCommon(
// Get hold of the elements array of the boilerplate and setup the
// elements pointer in the resulting object.
__ mov(ecx, FieldOperand(ecx, JSArray::kElementsOffset));
- __ lea(edx, Operand(eax, JSArray::kSize));
+ if (allocation_info_mode ==
+ FastCloneShallowArrayStub::TRACK_ALLOCATION_INFO) {
+ __ lea(edx, Operand(eax, JSArray::kSize + AllocationSiteInfo::kSize));
+ } else {
+ __ lea(edx, Operand(eax, JSArray::kSize));
+ }
__ mov(FieldOperand(eax, JSArray::kElementsOffset), edx);
// Copy the elements array.
@@ -408,20 +428,31 @@ void FastCloneShallowArrayStub::Generate(MacroAssembler* masm) {
FastCloneShallowArrayStub::Mode mode = mode_;
// ecx is boilerplate object.
+ FastCloneShallowArrayStub::AllocationInfoMode allocation_info_mode =
+ DONT_TRACK_ALLOCATION_INFO;
+ if (mode == CLONE_ANY_ELEMENTS_WITH_ALLOCATION_INFO) {
+ mode = CLONE_ANY_ELEMENTS;
+ allocation_info_mode = TRACK_ALLOCATION_INFO;
+ }
+
if (mode == CLONE_ANY_ELEMENTS) {
Label double_elements, check_fast_elements;
__ mov(ebx, FieldOperand(ecx, JSArray::kElementsOffset));
__ CheckMap(ebx, factory->fixed_cow_array_map(),
&check_fast_elements, DONT_DO_SMI_CHECK);
GenerateFastCloneShallowArrayCommon(masm, 0,
- COPY_ON_WRITE_ELEMENTS, &slow_case);
+ COPY_ON_WRITE_ELEMENTS,
+ allocation_info_mode,
+ &slow_case);
__ ret(3 * kPointerSize);
__ bind(&check_fast_elements);
__ CheckMap(ebx, factory->fixed_array_map(),
&double_elements, DONT_DO_SMI_CHECK);
GenerateFastCloneShallowArrayCommon(masm, length_,
- CLONE_ELEMENTS, &slow_case);
+ CLONE_ELEMENTS,
+ allocation_info_mode,
+ &slow_case);
__ ret(3 * kPointerSize);
__ bind(&double_elements);
@@ -450,7 +481,8 @@ void FastCloneShallowArrayStub::Generate(MacroAssembler* masm) {
__ pop(ecx);
}
- GenerateFastCloneShallowArrayCommon(masm, length_, mode, &slow_case);
+ GenerateFastCloneShallowArrayCommon(masm, length_, mode,
+ allocation_info_mode, &slow_case);
// Return and remove the on-stack parameters.
__ ret(3 * kPointerSize);

Powered by Google App Engine
This is Rietveld 408576698