| 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 5236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5247 Handle<Map> initial_map(constructor->initial_map()); | 5247 Handle<Map> initial_map(constructor->initial_map()); |
| 5248 int instance_size = initial_map->instance_size(); | 5248 int instance_size = initial_map->instance_size(); |
| 5249 ASSERT(initial_map->pre_allocated_property_fields() + | 5249 ASSERT(initial_map->pre_allocated_property_fields() + |
| 5250 initial_map->unused_property_fields() - | 5250 initial_map->unused_property_fields() - |
| 5251 initial_map->inobject_properties() == 0); | 5251 initial_map->inobject_properties() == 0); |
| 5252 | 5252 |
| 5253 // Allocate memory for the object. The initial map might change when | 5253 // Allocate memory for the object. The initial map might change when |
| 5254 // the constructor's prototype changes, but instance size and property | 5254 // the constructor's prototype changes, but instance size and property |
| 5255 // counts remain unchanged (if slack tracking finished). | 5255 // counts remain unchanged (if slack tracking finished). |
| 5256 ASSERT(!constructor->shared()->IsInobjectSlackTrackingInProgress()); | 5256 ASSERT(!constructor->shared()->IsInobjectSlackTrackingInProgress()); |
| 5257 __ AllocateInNewSpace(instance_size, | 5257 __ Allocate(instance_size, result, scratch, scratch2, deferred->entry(), |
| 5258 result, | 5258 TAG_OBJECT); |
| 5259 scratch, | |
| 5260 scratch2, | |
| 5261 deferred->entry(), | |
| 5262 TAG_OBJECT); | |
| 5263 | 5259 |
| 5264 __ bind(deferred->exit()); | 5260 __ bind(deferred->exit()); |
| 5265 if (FLAG_debug_code) { | 5261 if (FLAG_debug_code) { |
| 5266 Label is_in_new_space; | 5262 Label is_in_new_space; |
| 5267 __ JumpIfInNewSpace(result, scratch, &is_in_new_space); | 5263 __ JumpIfInNewSpace(result, scratch, &is_in_new_space); |
| 5268 __ Abort("Allocated object is not in new-space"); | 5264 __ Abort("Allocated object is not in new-space"); |
| 5269 __ bind(&is_in_new_space); | 5265 __ bind(&is_in_new_space); |
| 5270 } | 5266 } |
| 5271 | 5267 |
| 5272 // Load the initial map. | 5268 // Load the initial map. |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5327 Register scratch = ToRegister(instr->temp1()); | 5323 Register scratch = ToRegister(instr->temp1()); |
| 5328 Register scratch2 = ToRegister(instr->temp2()); | 5324 Register scratch2 = ToRegister(instr->temp2()); |
| 5329 | 5325 |
| 5330 // Allocate memory for the object. | 5326 // Allocate memory for the object. |
| 5331 AllocationFlags flags = TAG_OBJECT; | 5327 AllocationFlags flags = TAG_OBJECT; |
| 5332 if (instr->hydrogen()->MustAllocateDoubleAligned()) { | 5328 if (instr->hydrogen()->MustAllocateDoubleAligned()) { |
| 5333 flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT); | 5329 flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT); |
| 5334 } | 5330 } |
| 5335 if (instr->size()->IsConstantOperand()) { | 5331 if (instr->size()->IsConstantOperand()) { |
| 5336 int32_t size = ToInteger32(LConstantOperand::cast(instr->size())); | 5332 int32_t size = ToInteger32(LConstantOperand::cast(instr->size())); |
| 5337 __ AllocateInNewSpace(size, | 5333 if (instr->hydrogen()->CanAllocateInOldPointerSpace()) { |
| 5338 result, | 5334 flags = static_cast<AllocationFlags>(flags | PRETENURE_OLD_POINTER_SPACE); |
| 5339 scratch, | 5335 } |
| 5340 scratch2, | 5336 __ Allocate(size, result, scratch, scratch2, deferred->entry(), flags); |
| 5341 deferred->entry(), | |
| 5342 flags); | |
| 5343 } else { | 5337 } else { |
| 5344 Register size = ToRegister(instr->size()); | 5338 Register size = ToRegister(instr->size()); |
| 5345 __ AllocateInNewSpace(size, | 5339 __ AllocateInNewSpace(size, |
| 5346 result, | 5340 result, |
| 5347 scratch, | 5341 scratch, |
| 5348 scratch2, | 5342 scratch2, |
| 5349 deferred->entry(), | 5343 deferred->entry(), |
| 5350 flags); | 5344 flags); |
| 5351 } | 5345 } |
| 5352 | 5346 |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5567 __ lbu(a2, FieldMemOperand(a2, Map::kBitField2Offset)); | 5561 __ lbu(a2, FieldMemOperand(a2, Map::kBitField2Offset)); |
| 5568 // Retrieve elements_kind from bit field 2. | 5562 // Retrieve elements_kind from bit field 2. |
| 5569 __ Ext(a2, a2, Map::kElementsKindShift, Map::kElementsKindBitCount); | 5563 __ Ext(a2, a2, Map::kElementsKindShift, Map::kElementsKindBitCount); |
| 5570 DeoptimizeIf(ne, instr->environment(), a2, | 5564 DeoptimizeIf(ne, instr->environment(), a2, |
| 5571 Operand(boilerplate_elements_kind)); | 5565 Operand(boilerplate_elements_kind)); |
| 5572 } | 5566 } |
| 5573 | 5567 |
| 5574 // Allocate all objects that are part of the literal in one big | 5568 // Allocate all objects that are part of the literal in one big |
| 5575 // allocation. This avoids multiple limit checks. | 5569 // allocation. This avoids multiple limit checks. |
| 5576 Label allocated, runtime_allocate; | 5570 Label allocated, runtime_allocate; |
| 5577 __ AllocateInNewSpace(size, v0, a2, a3, &runtime_allocate, TAG_OBJECT); | 5571 __ Allocate(size, v0, a2, a3, &runtime_allocate, TAG_OBJECT); |
| 5578 __ jmp(&allocated); | 5572 __ jmp(&allocated); |
| 5579 | 5573 |
| 5580 __ bind(&runtime_allocate); | 5574 __ bind(&runtime_allocate); |
| 5581 __ li(a0, Operand(Smi::FromInt(size))); | 5575 __ li(a0, Operand(Smi::FromInt(size))); |
| 5582 __ push(a0); | 5576 __ push(a0); |
| 5583 CallRuntime(Runtime::kAllocateInNewSpace, 1, instr); | 5577 CallRuntime(Runtime::kAllocateInNewSpace, 1, instr); |
| 5584 | 5578 |
| 5585 __ bind(&allocated); | 5579 __ bind(&allocated); |
| 5586 int offset = 0; | 5580 int offset = 0; |
| 5587 __ LoadHeapObject(a1, instr->hydrogen()->boilerplate()); | 5581 __ LoadHeapObject(a1, instr->hydrogen()->boilerplate()); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5650 __ li(t1, Operand(instr->hydrogen()->pattern())); | 5644 __ li(t1, Operand(instr->hydrogen()->pattern())); |
| 5651 __ li(t0, Operand(instr->hydrogen()->flags())); | 5645 __ li(t0, Operand(instr->hydrogen()->flags())); |
| 5652 __ Push(t3, t2, t1, t0); | 5646 __ Push(t3, t2, t1, t0); |
| 5653 CallRuntime(Runtime::kMaterializeRegExpLiteral, 4, instr); | 5647 CallRuntime(Runtime::kMaterializeRegExpLiteral, 4, instr); |
| 5654 __ mov(a1, v0); | 5648 __ mov(a1, v0); |
| 5655 | 5649 |
| 5656 __ bind(&materialized); | 5650 __ bind(&materialized); |
| 5657 int size = JSRegExp::kSize + JSRegExp::kInObjectFieldCount * kPointerSize; | 5651 int size = JSRegExp::kSize + JSRegExp::kInObjectFieldCount * kPointerSize; |
| 5658 Label allocated, runtime_allocate; | 5652 Label allocated, runtime_allocate; |
| 5659 | 5653 |
| 5660 __ AllocateInNewSpace(size, v0, a2, a3, &runtime_allocate, TAG_OBJECT); | 5654 __ Allocate(size, v0, a2, a3, &runtime_allocate, TAG_OBJECT); |
| 5661 __ jmp(&allocated); | 5655 __ jmp(&allocated); |
| 5662 | 5656 |
| 5663 __ bind(&runtime_allocate); | 5657 __ bind(&runtime_allocate); |
| 5664 __ li(a0, Operand(Smi::FromInt(size))); | 5658 __ li(a0, Operand(Smi::FromInt(size))); |
| 5665 __ Push(a1, a0); | 5659 __ Push(a1, a0); |
| 5666 CallRuntime(Runtime::kAllocateInNewSpace, 1, instr); | 5660 CallRuntime(Runtime::kAllocateInNewSpace, 1, instr); |
| 5667 __ pop(a1); | 5661 __ pop(a1); |
| 5668 | 5662 |
| 5669 __ bind(&allocated); | 5663 __ bind(&allocated); |
| 5670 // Copy the content into the newly allocated memory. | 5664 // Copy the content into the newly allocated memory. |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6102 __ Subu(scratch, result, scratch); | 6096 __ Subu(scratch, result, scratch); |
| 6103 __ lw(result, FieldMemOperand(scratch, | 6097 __ lw(result, FieldMemOperand(scratch, |
| 6104 FixedArray::kHeaderSize - kPointerSize)); | 6098 FixedArray::kHeaderSize - kPointerSize)); |
| 6105 __ bind(&done); | 6099 __ bind(&done); |
| 6106 } | 6100 } |
| 6107 | 6101 |
| 6108 | 6102 |
| 6109 #undef __ | 6103 #undef __ |
| 6110 | 6104 |
| 6111 } } // namespace v8::internal | 6105 } } // namespace v8::internal |
| OLD | NEW |