OLD | NEW |
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 5443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5454 Handle<Map> initial_map(constructor->initial_map()); | 5454 Handle<Map> initial_map(constructor->initial_map()); |
5455 int instance_size = initial_map->instance_size(); | 5455 int instance_size = initial_map->instance_size(); |
5456 ASSERT(initial_map->pre_allocated_property_fields() + | 5456 ASSERT(initial_map->pre_allocated_property_fields() + |
5457 initial_map->unused_property_fields() - | 5457 initial_map->unused_property_fields() - |
5458 initial_map->inobject_properties() == 0); | 5458 initial_map->inobject_properties() == 0); |
5459 | 5459 |
5460 // Allocate memory for the object. The initial map might change when | 5460 // Allocate memory for the object. The initial map might change when |
5461 // the constructor's prototype changes, but instance size and property | 5461 // the constructor's prototype changes, but instance size and property |
5462 // counts remain unchanged (if slack tracking finished). | 5462 // counts remain unchanged (if slack tracking finished). |
5463 ASSERT(!constructor->shared()->IsInobjectSlackTrackingInProgress()); | 5463 ASSERT(!constructor->shared()->IsInobjectSlackTrackingInProgress()); |
5464 __ AllocateInNewSpace(instance_size, | 5464 __ Allocate(instance_size, result, no_reg, scratch, deferred->entry(), |
5465 result, | 5465 TAG_OBJECT); |
5466 no_reg, | |
5467 scratch, | |
5468 deferred->entry(), | |
5469 TAG_OBJECT); | |
5470 | 5466 |
5471 __ bind(deferred->exit()); | 5467 __ bind(deferred->exit()); |
5472 if (FLAG_debug_code) { | 5468 if (FLAG_debug_code) { |
5473 Label is_in_new_space; | 5469 Label is_in_new_space; |
5474 __ JumpIfInNewSpace(result, scratch, &is_in_new_space); | 5470 __ JumpIfInNewSpace(result, scratch, &is_in_new_space); |
5475 __ Abort("Allocated object is not in new-space"); | 5471 __ Abort("Allocated object is not in new-space"); |
5476 __ bind(&is_in_new_space); | 5472 __ bind(&is_in_new_space); |
5477 } | 5473 } |
5478 | 5474 |
5479 // Load the initial map. | 5475 // Load the initial map. |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5549 Register result = ToRegister(instr->result()); | 5545 Register result = ToRegister(instr->result()); |
5550 Register temp = ToRegister(instr->temp()); | 5546 Register temp = ToRegister(instr->temp()); |
5551 | 5547 |
5552 // Allocate memory for the object. | 5548 // Allocate memory for the object. |
5553 AllocationFlags flags = TAG_OBJECT; | 5549 AllocationFlags flags = TAG_OBJECT; |
5554 if (instr->hydrogen()->MustAllocateDoubleAligned()) { | 5550 if (instr->hydrogen()->MustAllocateDoubleAligned()) { |
5555 flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT); | 5551 flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT); |
5556 } | 5552 } |
5557 if (instr->size()->IsConstantOperand()) { | 5553 if (instr->size()->IsConstantOperand()) { |
5558 int32_t size = ToInteger32(LConstantOperand::cast(instr->size())); | 5554 int32_t size = ToInteger32(LConstantOperand::cast(instr->size())); |
5559 __ AllocateInNewSpace(size, result, temp, no_reg, deferred->entry(), flags); | 5555 if (instr->hydrogen()->CanAllocateInOldPointerSpace()) { |
| 5556 flags = static_cast<AllocationFlags>(flags | PRETENURE_OLD_POINTER_SPACE); |
| 5557 } |
| 5558 __ Allocate(size, result, temp, no_reg, deferred->entry(), flags); |
5560 } else { | 5559 } else { |
5561 Register size = ToRegister(instr->size()); | 5560 Register size = ToRegister(instr->size()); |
5562 __ AllocateInNewSpace(size, result, temp, no_reg, deferred->entry(), flags); | 5561 __ AllocateInNewSpace(size, result, temp, no_reg, deferred->entry(), flags); |
5563 } | 5562 } |
5564 | 5563 |
5565 __ bind(deferred->exit()); | 5564 __ bind(deferred->exit()); |
5566 } | 5565 } |
5567 | 5566 |
5568 | 5567 |
5569 void LCodeGen::DoDeferredAllocate(LAllocate* instr) { | 5568 void LCodeGen::DoDeferredAllocate(LAllocate* instr) { |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5788 __ mov(ecx, FieldOperand(ecx, Map::kBitField2Offset)); | 5787 __ mov(ecx, FieldOperand(ecx, Map::kBitField2Offset)); |
5789 // Retrieve elements_kind from bit field 2. | 5788 // Retrieve elements_kind from bit field 2. |
5790 __ and_(ecx, Map::kElementsKindMask); | 5789 __ and_(ecx, Map::kElementsKindMask); |
5791 __ cmp(ecx, boilerplate_elements_kind << Map::kElementsKindShift); | 5790 __ cmp(ecx, boilerplate_elements_kind << Map::kElementsKindShift); |
5792 DeoptimizeIf(not_equal, instr->environment()); | 5791 DeoptimizeIf(not_equal, instr->environment()); |
5793 } | 5792 } |
5794 | 5793 |
5795 // Allocate all objects that are part of the literal in one big | 5794 // Allocate all objects that are part of the literal in one big |
5796 // allocation. This avoids multiple limit checks. | 5795 // allocation. This avoids multiple limit checks. |
5797 Label allocated, runtime_allocate; | 5796 Label allocated, runtime_allocate; |
5798 __ AllocateInNewSpace(size, eax, ecx, edx, &runtime_allocate, TAG_OBJECT); | 5797 __ Allocate(size, eax, ecx, edx, &runtime_allocate, TAG_OBJECT); |
5799 __ jmp(&allocated); | 5798 __ jmp(&allocated); |
5800 | 5799 |
5801 __ bind(&runtime_allocate); | 5800 __ bind(&runtime_allocate); |
5802 __ push(Immediate(Smi::FromInt(size))); | 5801 __ push(Immediate(Smi::FromInt(size))); |
5803 CallRuntime(Runtime::kAllocateInNewSpace, 1, instr); | 5802 CallRuntime(Runtime::kAllocateInNewSpace, 1, instr); |
5804 | 5803 |
5805 __ bind(&allocated); | 5804 __ bind(&allocated); |
5806 int offset = 0; | 5805 int offset = 0; |
5807 __ LoadHeapObject(ebx, instr->hydrogen()->boilerplate()); | 5806 __ LoadHeapObject(ebx, instr->hydrogen()->boilerplate()); |
5808 EmitDeepCopy(instr->hydrogen()->boilerplate(), eax, ebx, &offset, | 5807 EmitDeepCopy(instr->hydrogen()->boilerplate(), eax, ebx, &offset, |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5878 __ push(ecx); | 5877 __ push(ecx); |
5879 __ push(Immediate(Smi::FromInt(instr->hydrogen()->literal_index()))); | 5878 __ push(Immediate(Smi::FromInt(instr->hydrogen()->literal_index()))); |
5880 __ push(Immediate(instr->hydrogen()->pattern())); | 5879 __ push(Immediate(instr->hydrogen()->pattern())); |
5881 __ push(Immediate(instr->hydrogen()->flags())); | 5880 __ push(Immediate(instr->hydrogen()->flags())); |
5882 CallRuntime(Runtime::kMaterializeRegExpLiteral, 4, instr); | 5881 CallRuntime(Runtime::kMaterializeRegExpLiteral, 4, instr); |
5883 __ mov(ebx, eax); | 5882 __ mov(ebx, eax); |
5884 | 5883 |
5885 __ bind(&materialized); | 5884 __ bind(&materialized); |
5886 int size = JSRegExp::kSize + JSRegExp::kInObjectFieldCount * kPointerSize; | 5885 int size = JSRegExp::kSize + JSRegExp::kInObjectFieldCount * kPointerSize; |
5887 Label allocated, runtime_allocate; | 5886 Label allocated, runtime_allocate; |
5888 __ AllocateInNewSpace(size, eax, ecx, edx, &runtime_allocate, TAG_OBJECT); | 5887 __ Allocate(size, eax, ecx, edx, &runtime_allocate, TAG_OBJECT); |
5889 __ jmp(&allocated); | 5888 __ jmp(&allocated); |
5890 | 5889 |
5891 __ bind(&runtime_allocate); | 5890 __ bind(&runtime_allocate); |
5892 __ push(ebx); | 5891 __ push(ebx); |
5893 __ push(Immediate(Smi::FromInt(size))); | 5892 __ push(Immediate(Smi::FromInt(size))); |
5894 CallRuntime(Runtime::kAllocateInNewSpace, 1, instr); | 5893 CallRuntime(Runtime::kAllocateInNewSpace, 1, instr); |
5895 __ pop(ebx); | 5894 __ pop(ebx); |
5896 | 5895 |
5897 __ bind(&allocated); | 5896 __ bind(&allocated); |
5898 // Copy the content into the newly allocated memory. | 5897 // Copy the content into the newly allocated memory. |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6287 FixedArray::kHeaderSize - kPointerSize)); | 6286 FixedArray::kHeaderSize - kPointerSize)); |
6288 __ bind(&done); | 6287 __ bind(&done); |
6289 } | 6288 } |
6290 | 6289 |
6291 | 6290 |
6292 #undef __ | 6291 #undef __ |
6293 | 6292 |
6294 } } // namespace v8::internal | 6293 } } // namespace v8::internal |
6295 | 6294 |
6296 #endif // V8_TARGET_ARCH_IA32 | 6295 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |