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

Side by Side Diff: src/ia32/lithium-codegen-ia32.cc

Issue 12314155: Allow direct allocation in old pointer space. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 5405 matching lines...) Expand 10 before | Expand all | Expand 10 after
5416 Handle<Map> initial_map(constructor->initial_map()); 5416 Handle<Map> initial_map(constructor->initial_map());
5417 int instance_size = initial_map->instance_size(); 5417 int instance_size = initial_map->instance_size();
5418 ASSERT(initial_map->pre_allocated_property_fields() + 5418 ASSERT(initial_map->pre_allocated_property_fields() +
5419 initial_map->unused_property_fields() - 5419 initial_map->unused_property_fields() -
5420 initial_map->inobject_properties() == 0); 5420 initial_map->inobject_properties() == 0);
5421 5421
5422 // Allocate memory for the object. The initial map might change when 5422 // Allocate memory for the object. The initial map might change when
5423 // the constructor's prototype changes, but instance size and property 5423 // the constructor's prototype changes, but instance size and property
5424 // counts remain unchanged (if slack tracking finished). 5424 // counts remain unchanged (if slack tracking finished).
5425 ASSERT(!constructor->shared()->IsInobjectSlackTrackingInProgress()); 5425 ASSERT(!constructor->shared()->IsInobjectSlackTrackingInProgress());
5426 __ AllocateInNewSpace(instance_size, 5426 __ Allocate(instance_size, result, no_reg, scratch, deferred->entry(),
5427 result, 5427 TAG_OBJECT, MacroAssembler::NEW_SPACE);
5428 no_reg,
5429 scratch,
5430 deferred->entry(),
5431 TAG_OBJECT);
5432 5428
5433 __ bind(deferred->exit()); 5429 __ bind(deferred->exit());
5434 if (FLAG_debug_code) { 5430 if (FLAG_debug_code) {
5435 Label is_in_new_space; 5431 Label is_in_new_space;
5436 __ JumpIfInNewSpace(result, scratch, &is_in_new_space); 5432 __ JumpIfInNewSpace(result, scratch, &is_in_new_space);
5437 __ Abort("Allocated object is not in new-space"); 5433 __ Abort("Allocated object is not in new-space");
5438 __ bind(&is_in_new_space); 5434 __ bind(&is_in_new_space);
5439 } 5435 }
5440 5436
5441 // Load the initial map. 5437 // Load the initial map.
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
5511 Register result = ToRegister(instr->result()); 5507 Register result = ToRegister(instr->result());
5512 Register temp = ToRegister(instr->temp()); 5508 Register temp = ToRegister(instr->temp());
5513 5509
5514 // Allocate memory for the object. 5510 // Allocate memory for the object.
5515 AllocationFlags flags = TAG_OBJECT; 5511 AllocationFlags flags = TAG_OBJECT;
5516 if (instr->hydrogen()->MustAllocateDoubleAligned()) { 5512 if (instr->hydrogen()->MustAllocateDoubleAligned()) {
5517 flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT); 5513 flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT);
5518 } 5514 }
5519 if (instr->size()->IsConstantOperand()) { 5515 if (instr->size()->IsConstantOperand()) {
5520 int32_t size = ToInteger32(LConstantOperand::cast(instr->size())); 5516 int32_t size = ToInteger32(LConstantOperand::cast(instr->size()));
5521 __ AllocateInNewSpace(size, result, temp, no_reg, deferred->entry(), flags); 5517 if (instr->hydrogen()->CanAllocateInOldPointerSpace()) {
5518 __ Allocate(size, result, temp, no_reg, deferred->entry(), flags,
5519 MacroAssembler::OLD_POINTER_SPACE);
mvstanton 2013/03/05 09:35:57 Maybe it's nice to have a variable for the space t
danno 2013/03/05 12:18:18 +1 On 2013/03/05 09:35:57, mvstanton wrote:
Hannes Payer (out of office) 2013/03/11 17:16:31 after re-factoring not needed anymore.
Hannes Payer (out of office) 2013/03/11 17:16:31 Done.
5520 } else {
5521 __ Allocate(size, result, temp, no_reg, deferred->entry(), flags,
5522 MacroAssembler::NEW_SPACE);
5523 }
5522 } else { 5524 } else {
5523 Register size = ToRegister(instr->size()); 5525 Register size = ToRegister(instr->size());
5524 __ AllocateInNewSpace(size, result, temp, no_reg, deferred->entry(), flags); 5526 __ AllocateInNewSpace(size, result, temp, no_reg, deferred->entry(), flags);
5525 } 5527 }
5526 5528
5527 __ bind(deferred->exit()); 5529 __ bind(deferred->exit());
5528 } 5530 }
5529 5531
5530 5532
5531 void LCodeGen::DoDeferredAllocate(LAllocate* instr) { 5533 void LCodeGen::DoDeferredAllocate(LAllocate* instr) {
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
5750 __ mov(ecx, FieldOperand(ecx, Map::kBitField2Offset)); 5752 __ mov(ecx, FieldOperand(ecx, Map::kBitField2Offset));
5751 // Retrieve elements_kind from bit field 2. 5753 // Retrieve elements_kind from bit field 2.
5752 __ and_(ecx, Map::kElementsKindMask); 5754 __ and_(ecx, Map::kElementsKindMask);
5753 __ cmp(ecx, boilerplate_elements_kind << Map::kElementsKindShift); 5755 __ cmp(ecx, boilerplate_elements_kind << Map::kElementsKindShift);
5754 DeoptimizeIf(not_equal, instr->environment()); 5756 DeoptimizeIf(not_equal, instr->environment());
5755 } 5757 }
5756 5758
5757 // Allocate all objects that are part of the literal in one big 5759 // Allocate all objects that are part of the literal in one big
5758 // allocation. This avoids multiple limit checks. 5760 // allocation. This avoids multiple limit checks.
5759 Label allocated, runtime_allocate; 5761 Label allocated, runtime_allocate;
5760 __ AllocateInNewSpace(size, eax, ecx, edx, &runtime_allocate, TAG_OBJECT); 5762 __ Allocate(size, eax, ecx, edx, &runtime_allocate, TAG_OBJECT,
5763 MacroAssembler::NEW_SPACE);
5761 __ jmp(&allocated); 5764 __ jmp(&allocated);
5762 5765
5763 __ bind(&runtime_allocate); 5766 __ bind(&runtime_allocate);
5764 __ push(Immediate(Smi::FromInt(size))); 5767 __ push(Immediate(Smi::FromInt(size)));
5765 CallRuntime(Runtime::kAllocateInNewSpace, 1, instr); 5768 CallRuntime(Runtime::kAllocateInNewSpace, 1, instr);
5766 5769
5767 __ bind(&allocated); 5770 __ bind(&allocated);
5768 int offset = 0; 5771 int offset = 0;
5769 __ LoadHeapObject(ebx, instr->hydrogen()->boilerplate()); 5772 __ LoadHeapObject(ebx, instr->hydrogen()->boilerplate());
5770 EmitDeepCopy(instr->hydrogen()->boilerplate(), eax, ebx, &offset, 5773 EmitDeepCopy(instr->hydrogen()->boilerplate(), eax, ebx, &offset,
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
5840 __ push(ecx); 5843 __ push(ecx);
5841 __ push(Immediate(Smi::FromInt(instr->hydrogen()->literal_index()))); 5844 __ push(Immediate(Smi::FromInt(instr->hydrogen()->literal_index())));
5842 __ push(Immediate(instr->hydrogen()->pattern())); 5845 __ push(Immediate(instr->hydrogen()->pattern()));
5843 __ push(Immediate(instr->hydrogen()->flags())); 5846 __ push(Immediate(instr->hydrogen()->flags()));
5844 CallRuntime(Runtime::kMaterializeRegExpLiteral, 4, instr); 5847 CallRuntime(Runtime::kMaterializeRegExpLiteral, 4, instr);
5845 __ mov(ebx, eax); 5848 __ mov(ebx, eax);
5846 5849
5847 __ bind(&materialized); 5850 __ bind(&materialized);
5848 int size = JSRegExp::kSize + JSRegExp::kInObjectFieldCount * kPointerSize; 5851 int size = JSRegExp::kSize + JSRegExp::kInObjectFieldCount * kPointerSize;
5849 Label allocated, runtime_allocate; 5852 Label allocated, runtime_allocate;
5850 __ AllocateInNewSpace(size, eax, ecx, edx, &runtime_allocate, TAG_OBJECT); 5853 __ Allocate(size, eax, ecx, edx, &runtime_allocate, TAG_OBJECT,
5854 MacroAssembler::NEW_SPACE);
5851 __ jmp(&allocated); 5855 __ jmp(&allocated);
5852 5856
5853 __ bind(&runtime_allocate); 5857 __ bind(&runtime_allocate);
5854 __ push(ebx); 5858 __ push(ebx);
5855 __ push(Immediate(Smi::FromInt(size))); 5859 __ push(Immediate(Smi::FromInt(size)));
5856 CallRuntime(Runtime::kAllocateInNewSpace, 1, instr); 5860 CallRuntime(Runtime::kAllocateInNewSpace, 1, instr);
5857 __ pop(ebx); 5861 __ pop(ebx);
5858 5862
5859 __ bind(&allocated); 5863 __ bind(&allocated);
5860 // Copy the content into the newly allocated memory. 5864 // Copy the content into the newly allocated memory.
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
6243 FixedArray::kHeaderSize - kPointerSize)); 6247 FixedArray::kHeaderSize - kPointerSize));
6244 __ bind(&done); 6248 __ bind(&done);
6245 } 6249 }
6246 6250
6247 6251
6248 #undef __ 6252 #undef __
6249 6253
6250 } } // namespace v8::internal 6254 } } // namespace v8::internal
6251 6255
6252 #endif // V8_TARGET_ARCH_IA32 6256 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698