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 5571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5582 Handle<Map> initial_map(constructor->initial_map()); | 5582 Handle<Map> initial_map(constructor->initial_map()); |
5583 int instance_size = initial_map->instance_size(); | 5583 int instance_size = initial_map->instance_size(); |
5584 ASSERT(initial_map->pre_allocated_property_fields() + | 5584 ASSERT(initial_map->pre_allocated_property_fields() + |
5585 initial_map->unused_property_fields() - | 5585 initial_map->unused_property_fields() - |
5586 initial_map->inobject_properties() == 0); | 5586 initial_map->inobject_properties() == 0); |
5587 | 5587 |
5588 // Allocate memory for the object. The initial map might change when | 5588 // Allocate memory for the object. The initial map might change when |
5589 // the constructor's prototype changes, but instance size and property | 5589 // the constructor's prototype changes, but instance size and property |
5590 // counts remain unchanged (if slack tracking finished). | 5590 // counts remain unchanged (if slack tracking finished). |
5591 ASSERT(!constructor->shared()->IsInobjectSlackTrackingInProgress()); | 5591 ASSERT(!constructor->shared()->IsInobjectSlackTrackingInProgress()); |
5592 __ AllocateInNewSpace(instance_size, | 5592 __ Allocate(instance_size, result, scratch, scratch2, deferred->entry(), |
5593 result, | 5593 TAG_OBJECT); |
5594 scratch, | |
5595 scratch2, | |
5596 deferred->entry(), | |
5597 TAG_OBJECT); | |
5598 | 5594 |
5599 __ bind(deferred->exit()); | 5595 __ bind(deferred->exit()); |
5600 if (FLAG_debug_code) { | 5596 if (FLAG_debug_code) { |
5601 Label is_in_new_space; | 5597 Label is_in_new_space; |
5602 __ JumpIfInNewSpace(result, scratch, &is_in_new_space); | 5598 __ JumpIfInNewSpace(result, scratch, &is_in_new_space); |
5603 __ Abort("Allocated object is not in new-space"); | 5599 __ Abort("Allocated object is not in new-space"); |
5604 __ bind(&is_in_new_space); | 5600 __ bind(&is_in_new_space); |
5605 } | 5601 } |
5606 | 5602 |
5607 // Load the initial map. | 5603 // Load the initial map. |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5662 Register scratch = ToRegister(instr->temp1()); | 5658 Register scratch = ToRegister(instr->temp1()); |
5663 Register scratch2 = ToRegister(instr->temp2()); | 5659 Register scratch2 = ToRegister(instr->temp2()); |
5664 | 5660 |
5665 // Allocate memory for the object. | 5661 // Allocate memory for the object. |
5666 AllocationFlags flags = TAG_OBJECT; | 5662 AllocationFlags flags = TAG_OBJECT; |
5667 if (instr->hydrogen()->MustAllocateDoubleAligned()) { | 5663 if (instr->hydrogen()->MustAllocateDoubleAligned()) { |
5668 flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT); | 5664 flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT); |
5669 } | 5665 } |
5670 if (instr->size()->IsConstantOperand()) { | 5666 if (instr->size()->IsConstantOperand()) { |
5671 int32_t size = ToInteger32(LConstantOperand::cast(instr->size())); | 5667 int32_t size = ToInteger32(LConstantOperand::cast(instr->size())); |
5672 __ AllocateInNewSpace(size, | 5668 if (instr->hydrogen()->CanAllocateInOldPointerSpace()) { |
5673 result, | 5669 flags = static_cast<AllocationFlags>(flags | PRETENURE_OLD_POINTER_SPACE); |
5674 scratch, | 5670 } |
5675 scratch2, | 5671 __ Allocate(size, result, scratch, scratch2, deferred->entry(), flags); |
5676 deferred->entry(), | |
5677 flags); | |
5678 } else { | 5672 } else { |
5679 Register size = ToRegister(instr->size()); | 5673 Register size = ToRegister(instr->size()); |
5680 __ AllocateInNewSpace(size, | 5674 __ AllocateInNewSpace(size, |
5681 result, | 5675 result, |
5682 scratch, | 5676 scratch, |
5683 scratch2, | 5677 scratch2, |
5684 deferred->entry(), | 5678 deferred->entry(), |
5685 flags); | 5679 flags); |
5686 } | 5680 } |
5687 | 5681 |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5900 __ ldrb(r2, FieldMemOperand(r2, Map::kBitField2Offset)); | 5894 __ ldrb(r2, FieldMemOperand(r2, Map::kBitField2Offset)); |
5901 // Retrieve elements_kind from bit field 2. | 5895 // Retrieve elements_kind from bit field 2. |
5902 __ ubfx(r2, r2, Map::kElementsKindShift, Map::kElementsKindBitCount); | 5896 __ ubfx(r2, r2, Map::kElementsKindShift, Map::kElementsKindBitCount); |
5903 __ cmp(r2, Operand(boilerplate_elements_kind)); | 5897 __ cmp(r2, Operand(boilerplate_elements_kind)); |
5904 DeoptimizeIf(ne, instr->environment()); | 5898 DeoptimizeIf(ne, instr->environment()); |
5905 } | 5899 } |
5906 | 5900 |
5907 // Allocate all objects that are part of the literal in one big | 5901 // Allocate all objects that are part of the literal in one big |
5908 // allocation. This avoids multiple limit checks. | 5902 // allocation. This avoids multiple limit checks. |
5909 Label allocated, runtime_allocate; | 5903 Label allocated, runtime_allocate; |
5910 __ AllocateInNewSpace(size, r0, r2, r3, &runtime_allocate, TAG_OBJECT); | 5904 __ Allocate(size, r0, r2, r3, &runtime_allocate, TAG_OBJECT); |
5911 __ jmp(&allocated); | 5905 __ jmp(&allocated); |
5912 | 5906 |
5913 __ bind(&runtime_allocate); | 5907 __ bind(&runtime_allocate); |
5914 __ mov(r0, Operand(Smi::FromInt(size))); | 5908 __ mov(r0, Operand(Smi::FromInt(size))); |
5915 __ push(r0); | 5909 __ push(r0); |
5916 CallRuntime(Runtime::kAllocateInNewSpace, 1, instr); | 5910 CallRuntime(Runtime::kAllocateInNewSpace, 1, instr); |
5917 | 5911 |
5918 __ bind(&allocated); | 5912 __ bind(&allocated); |
5919 int offset = 0; | 5913 int offset = 0; |
5920 __ LoadHeapObject(r1, instr->hydrogen()->boilerplate()); | 5914 __ LoadHeapObject(r1, instr->hydrogen()->boilerplate()); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5982 __ mov(r5, Operand(instr->hydrogen()->pattern())); | 5976 __ mov(r5, Operand(instr->hydrogen()->pattern())); |
5983 __ mov(r4, Operand(instr->hydrogen()->flags())); | 5977 __ mov(r4, Operand(instr->hydrogen()->flags())); |
5984 __ Push(r7, r6, r5, r4); | 5978 __ Push(r7, r6, r5, r4); |
5985 CallRuntime(Runtime::kMaterializeRegExpLiteral, 4, instr); | 5979 CallRuntime(Runtime::kMaterializeRegExpLiteral, 4, instr); |
5986 __ mov(r1, r0); | 5980 __ mov(r1, r0); |
5987 | 5981 |
5988 __ bind(&materialized); | 5982 __ bind(&materialized); |
5989 int size = JSRegExp::kSize + JSRegExp::kInObjectFieldCount * kPointerSize; | 5983 int size = JSRegExp::kSize + JSRegExp::kInObjectFieldCount * kPointerSize; |
5990 Label allocated, runtime_allocate; | 5984 Label allocated, runtime_allocate; |
5991 | 5985 |
5992 __ AllocateInNewSpace(size, r0, r2, r3, &runtime_allocate, TAG_OBJECT); | 5986 __ Allocate(size, r0, r2, r3, &runtime_allocate, TAG_OBJECT); |
5993 __ jmp(&allocated); | 5987 __ jmp(&allocated); |
5994 | 5988 |
5995 __ bind(&runtime_allocate); | 5989 __ bind(&runtime_allocate); |
5996 __ mov(r0, Operand(Smi::FromInt(size))); | 5990 __ mov(r0, Operand(Smi::FromInt(size))); |
5997 __ Push(r1, r0); | 5991 __ Push(r1, r0); |
5998 CallRuntime(Runtime::kAllocateInNewSpace, 1, instr); | 5992 CallRuntime(Runtime::kAllocateInNewSpace, 1, instr); |
5999 __ pop(r1); | 5993 __ pop(r1); |
6000 | 5994 |
6001 __ bind(&allocated); | 5995 __ bind(&allocated); |
6002 // Copy the content into the newly allocated memory. | 5996 // Copy the content into the newly allocated memory. |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6399 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); | 6393 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); |
6400 __ ldr(result, FieldMemOperand(scratch, | 6394 __ ldr(result, FieldMemOperand(scratch, |
6401 FixedArray::kHeaderSize - kPointerSize)); | 6395 FixedArray::kHeaderSize - kPointerSize)); |
6402 __ bind(&done); | 6396 __ bind(&done); |
6403 } | 6397 } |
6404 | 6398 |
6405 | 6399 |
6406 #undef __ | 6400 #undef __ |
6407 | 6401 |
6408 } } // namespace v8::internal | 6402 } } // namespace v8::internal |
OLD | NEW |