OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 5006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5017 Handle<Map> initial_map(constructor->initial_map()); | 5017 Handle<Map> initial_map(constructor->initial_map()); |
5018 int instance_size = initial_map->instance_size(); | 5018 int instance_size = initial_map->instance_size(); |
5019 ASSERT(initial_map->pre_allocated_property_fields() + | 5019 ASSERT(initial_map->pre_allocated_property_fields() + |
5020 initial_map->unused_property_fields() - | 5020 initial_map->unused_property_fields() - |
5021 initial_map->inobject_properties() == 0); | 5021 initial_map->inobject_properties() == 0); |
5022 | 5022 |
5023 // Allocate memory for the object. The initial map might change when | 5023 // Allocate memory for the object. The initial map might change when |
5024 // the constructor's prototype changes, but instance size and property | 5024 // the constructor's prototype changes, but instance size and property |
5025 // counts remain unchanged (if slack tracking finished). | 5025 // counts remain unchanged (if slack tracking finished). |
5026 ASSERT(!constructor->shared()->IsInobjectSlackTrackingInProgress()); | 5026 ASSERT(!constructor->shared()->IsInobjectSlackTrackingInProgress()); |
5027 __ AllocateInNewSpace(instance_size, | 5027 __ Allocate(instance_size, result, no_reg, scratch, deferred->entry(), |
5028 result, | 5028 TAG_OBJECT); |
5029 no_reg, | |
5030 scratch, | |
5031 deferred->entry(), | |
5032 TAG_OBJECT); | |
5033 | 5029 |
5034 __ bind(deferred->exit()); | 5030 __ bind(deferred->exit()); |
5035 if (FLAG_debug_code) { | 5031 if (FLAG_debug_code) { |
5036 Label is_in_new_space; | 5032 Label is_in_new_space; |
5037 __ JumpIfInNewSpace(result, scratch, &is_in_new_space); | 5033 __ JumpIfInNewSpace(result, scratch, &is_in_new_space); |
5038 __ Abort("Allocated object is not in new-space"); | 5034 __ Abort("Allocated object is not in new-space"); |
5039 __ bind(&is_in_new_space); | 5035 __ bind(&is_in_new_space); |
5040 } | 5036 } |
5041 | 5037 |
5042 // Load the initial map. | 5038 // Load the initial map. |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5111 Register result = ToRegister(instr->result()); | 5107 Register result = ToRegister(instr->result()); |
5112 Register temp = ToRegister(instr->temp()); | 5108 Register temp = ToRegister(instr->temp()); |
5113 | 5109 |
5114 // Allocate memory for the object. | 5110 // Allocate memory for the object. |
5115 AllocationFlags flags = TAG_OBJECT; | 5111 AllocationFlags flags = TAG_OBJECT; |
5116 if (instr->hydrogen()->MustAllocateDoubleAligned()) { | 5112 if (instr->hydrogen()->MustAllocateDoubleAligned()) { |
5117 flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT); | 5113 flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT); |
5118 } | 5114 } |
5119 if (instr->size()->IsConstantOperand()) { | 5115 if (instr->size()->IsConstantOperand()) { |
5120 int32_t size = ToInteger32(LConstantOperand::cast(instr->size())); | 5116 int32_t size = ToInteger32(LConstantOperand::cast(instr->size())); |
5121 __ AllocateInNewSpace(size, result, temp, no_reg, deferred->entry(), flags); | 5117 if (instr->hydrogen()->CanAllocateInOldPointerSpace()) { |
| 5118 flags = static_cast<AllocationFlags>(flags | PRETENURE_OLD_POINTER_SPACE); |
| 5119 } |
| 5120 __ Allocate(size, result, temp, no_reg, deferred->entry(), flags); |
5122 } else { | 5121 } else { |
5123 Register size = ToRegister(instr->size()); | 5122 Register size = ToRegister(instr->size()); |
5124 __ AllocateInNewSpace(size, result, temp, no_reg, deferred->entry(), flags); | 5123 __ AllocateInNewSpace(size, result, temp, no_reg, deferred->entry(), flags); |
5125 } | 5124 } |
5126 | 5125 |
5127 __ bind(deferred->exit()); | 5126 __ bind(deferred->exit()); |
5128 } | 5127 } |
5129 | 5128 |
5130 | 5129 |
5131 void LCodeGen::DoDeferredAllocate(LAllocate* instr) { | 5130 void LCodeGen::DoDeferredAllocate(LAllocate* instr) { |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5332 // Retrieve elements_kind from bit field 2. | 5331 // Retrieve elements_kind from bit field 2. |
5333 __ and_(rcx, Immediate(Map::kElementsKindMask)); | 5332 __ and_(rcx, Immediate(Map::kElementsKindMask)); |
5334 __ cmpb(rcx, Immediate(boilerplate_elements_kind << | 5333 __ cmpb(rcx, Immediate(boilerplate_elements_kind << |
5335 Map::kElementsKindShift)); | 5334 Map::kElementsKindShift)); |
5336 DeoptimizeIf(not_equal, instr->environment()); | 5335 DeoptimizeIf(not_equal, instr->environment()); |
5337 } | 5336 } |
5338 | 5337 |
5339 // Allocate all objects that are part of the literal in one big | 5338 // Allocate all objects that are part of the literal in one big |
5340 // allocation. This avoids multiple limit checks. | 5339 // allocation. This avoids multiple limit checks. |
5341 Label allocated, runtime_allocate; | 5340 Label allocated, runtime_allocate; |
5342 __ AllocateInNewSpace(size, rax, rcx, rdx, &runtime_allocate, TAG_OBJECT); | 5341 __ Allocate(size, rax, rcx, rdx, &runtime_allocate, TAG_OBJECT); |
5343 __ jmp(&allocated); | 5342 __ jmp(&allocated); |
5344 | 5343 |
5345 __ bind(&runtime_allocate); | 5344 __ bind(&runtime_allocate); |
5346 __ Push(Smi::FromInt(size)); | 5345 __ Push(Smi::FromInt(size)); |
5347 CallRuntime(Runtime::kAllocateInNewSpace, 1, instr); | 5346 CallRuntime(Runtime::kAllocateInNewSpace, 1, instr); |
5348 | 5347 |
5349 __ bind(&allocated); | 5348 __ bind(&allocated); |
5350 int offset = 0; | 5349 int offset = 0; |
5351 __ LoadHeapObject(rbx, instr->hydrogen()->boilerplate()); | 5350 __ LoadHeapObject(rbx, instr->hydrogen()->boilerplate()); |
5352 EmitDeepCopy(instr->hydrogen()->boilerplate(), rax, rbx, &offset, | 5351 EmitDeepCopy(instr->hydrogen()->boilerplate(), rax, rbx, &offset, |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5419 __ push(rcx); | 5418 __ push(rcx); |
5420 __ Push(Smi::FromInt(instr->hydrogen()->literal_index())); | 5419 __ Push(Smi::FromInt(instr->hydrogen()->literal_index())); |
5421 __ Push(instr->hydrogen()->pattern()); | 5420 __ Push(instr->hydrogen()->pattern()); |
5422 __ Push(instr->hydrogen()->flags()); | 5421 __ Push(instr->hydrogen()->flags()); |
5423 CallRuntime(Runtime::kMaterializeRegExpLiteral, 4, instr); | 5422 CallRuntime(Runtime::kMaterializeRegExpLiteral, 4, instr); |
5424 __ movq(rbx, rax); | 5423 __ movq(rbx, rax); |
5425 | 5424 |
5426 __ bind(&materialized); | 5425 __ bind(&materialized); |
5427 int size = JSRegExp::kSize + JSRegExp::kInObjectFieldCount * kPointerSize; | 5426 int size = JSRegExp::kSize + JSRegExp::kInObjectFieldCount * kPointerSize; |
5428 Label allocated, runtime_allocate; | 5427 Label allocated, runtime_allocate; |
5429 __ AllocateInNewSpace(size, rax, rcx, rdx, &runtime_allocate, TAG_OBJECT); | 5428 __ Allocate(size, rax, rcx, rdx, &runtime_allocate, TAG_OBJECT); |
5430 __ jmp(&allocated); | 5429 __ jmp(&allocated); |
5431 | 5430 |
5432 __ bind(&runtime_allocate); | 5431 __ bind(&runtime_allocate); |
5433 __ push(rbx); | 5432 __ push(rbx); |
5434 __ Push(Smi::FromInt(size)); | 5433 __ Push(Smi::FromInt(size)); |
5435 CallRuntime(Runtime::kAllocateInNewSpace, 1, instr); | 5434 CallRuntime(Runtime::kAllocateInNewSpace, 1, instr); |
5436 __ pop(rbx); | 5435 __ pop(rbx); |
5437 | 5436 |
5438 __ bind(&allocated); | 5437 __ bind(&allocated); |
5439 // Copy the content into the newly allocated memory. | 5438 // Copy the content into the newly allocated memory. |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5840 FixedArray::kHeaderSize - kPointerSize)); | 5839 FixedArray::kHeaderSize - kPointerSize)); |
5841 __ bind(&done); | 5840 __ bind(&done); |
5842 } | 5841 } |
5843 | 5842 |
5844 | 5843 |
5845 #undef __ | 5844 #undef __ |
5846 | 5845 |
5847 } } // namespace v8::internal | 5846 } } // namespace v8::internal |
5848 | 5847 |
5849 #endif // V8_TARGET_ARCH_X64 | 5848 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |