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 5405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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); |
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 Loading... |
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 flags = static_cast<AllocationFlags>(flags | PRETENURE); |
| 5519 } |
| 5520 __ Allocate(size, result, temp, no_reg, deferred->entry(), flags); |
5522 } else { | 5521 } else { |
5523 Register size = ToRegister(instr->size()); | 5522 Register size = ToRegister(instr->size()); |
5524 __ AllocateInNewSpace(size, result, temp, no_reg, deferred->entry(), flags); | 5523 __ AllocateInNewSpace(size, result, temp, no_reg, deferred->entry(), flags); |
5525 } | 5524 } |
5526 | 5525 |
5527 __ bind(deferred->exit()); | 5526 __ bind(deferred->exit()); |
5528 } | 5527 } |
5529 | 5528 |
5530 | 5529 |
5531 void LCodeGen::DoDeferredAllocate(LAllocate* instr) { | 5530 void LCodeGen::DoDeferredAllocate(LAllocate* instr) { |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5750 __ mov(ecx, FieldOperand(ecx, Map::kBitField2Offset)); | 5749 __ mov(ecx, FieldOperand(ecx, Map::kBitField2Offset)); |
5751 // Retrieve elements_kind from bit field 2. | 5750 // Retrieve elements_kind from bit field 2. |
5752 __ and_(ecx, Map::kElementsKindMask); | 5751 __ and_(ecx, Map::kElementsKindMask); |
5753 __ cmp(ecx, boilerplate_elements_kind << Map::kElementsKindShift); | 5752 __ cmp(ecx, boilerplate_elements_kind << Map::kElementsKindShift); |
5754 DeoptimizeIf(not_equal, instr->environment()); | 5753 DeoptimizeIf(not_equal, instr->environment()); |
5755 } | 5754 } |
5756 | 5755 |
5757 // Allocate all objects that are part of the literal in one big | 5756 // Allocate all objects that are part of the literal in one big |
5758 // allocation. This avoids multiple limit checks. | 5757 // allocation. This avoids multiple limit checks. |
5759 Label allocated, runtime_allocate; | 5758 Label allocated, runtime_allocate; |
5760 __ AllocateInNewSpace(size, eax, ecx, edx, &runtime_allocate, TAG_OBJECT); | 5759 __ Allocate(size, eax, ecx, edx, &runtime_allocate, TAG_OBJECT); |
5761 __ jmp(&allocated); | 5760 __ jmp(&allocated); |
5762 | 5761 |
5763 __ bind(&runtime_allocate); | 5762 __ bind(&runtime_allocate); |
5764 __ push(Immediate(Smi::FromInt(size))); | 5763 __ push(Immediate(Smi::FromInt(size))); |
5765 CallRuntime(Runtime::kAllocateInNewSpace, 1, instr); | 5764 CallRuntime(Runtime::kAllocateInNewSpace, 1, instr); |
5766 | 5765 |
5767 __ bind(&allocated); | 5766 __ bind(&allocated); |
5768 int offset = 0; | 5767 int offset = 0; |
5769 __ LoadHeapObject(ebx, instr->hydrogen()->boilerplate()); | 5768 __ LoadHeapObject(ebx, instr->hydrogen()->boilerplate()); |
5770 EmitDeepCopy(instr->hydrogen()->boilerplate(), eax, ebx, &offset, | 5769 EmitDeepCopy(instr->hydrogen()->boilerplate(), eax, ebx, &offset, |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5840 __ push(ecx); | 5839 __ push(ecx); |
5841 __ push(Immediate(Smi::FromInt(instr->hydrogen()->literal_index()))); | 5840 __ push(Immediate(Smi::FromInt(instr->hydrogen()->literal_index()))); |
5842 __ push(Immediate(instr->hydrogen()->pattern())); | 5841 __ push(Immediate(instr->hydrogen()->pattern())); |
5843 __ push(Immediate(instr->hydrogen()->flags())); | 5842 __ push(Immediate(instr->hydrogen()->flags())); |
5844 CallRuntime(Runtime::kMaterializeRegExpLiteral, 4, instr); | 5843 CallRuntime(Runtime::kMaterializeRegExpLiteral, 4, instr); |
5845 __ mov(ebx, eax); | 5844 __ mov(ebx, eax); |
5846 | 5845 |
5847 __ bind(&materialized); | 5846 __ bind(&materialized); |
5848 int size = JSRegExp::kSize + JSRegExp::kInObjectFieldCount * kPointerSize; | 5847 int size = JSRegExp::kSize + JSRegExp::kInObjectFieldCount * kPointerSize; |
5849 Label allocated, runtime_allocate; | 5848 Label allocated, runtime_allocate; |
5850 __ AllocateInNewSpace(size, eax, ecx, edx, &runtime_allocate, TAG_OBJECT); | 5849 __ Allocate(size, eax, ecx, edx, &runtime_allocate, TAG_OBJECT); |
5851 __ jmp(&allocated); | 5850 __ jmp(&allocated); |
5852 | 5851 |
5853 __ bind(&runtime_allocate); | 5852 __ bind(&runtime_allocate); |
5854 __ push(ebx); | 5853 __ push(ebx); |
5855 __ push(Immediate(Smi::FromInt(size))); | 5854 __ push(Immediate(Smi::FromInt(size))); |
5856 CallRuntime(Runtime::kAllocateInNewSpace, 1, instr); | 5855 CallRuntime(Runtime::kAllocateInNewSpace, 1, instr); |
5857 __ pop(ebx); | 5856 __ pop(ebx); |
5858 | 5857 |
5859 __ bind(&allocated); | 5858 __ bind(&allocated); |
5860 // Copy the content into the newly allocated memory. | 5859 // Copy the content into the newly allocated memory. |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6243 FixedArray::kHeaderSize - kPointerSize)); | 6242 FixedArray::kHeaderSize - kPointerSize)); |
6244 __ bind(&done); | 6243 __ bind(&done); |
6245 } | 6244 } |
6246 | 6245 |
6247 | 6246 |
6248 #undef __ | 6247 #undef __ |
6249 | 6248 |
6250 } } // namespace v8::internal | 6249 } } // namespace v8::internal |
6251 | 6250 |
6252 #endif // V8_TARGET_ARCH_IA32 | 6251 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |