| 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 4994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5005 Handle<Map> initial_map(constructor->initial_map()); | 5005 Handle<Map> initial_map(constructor->initial_map()); |
| 5006 int instance_size = initial_map->instance_size(); | 5006 int instance_size = initial_map->instance_size(); |
| 5007 ASSERT(initial_map->pre_allocated_property_fields() + | 5007 ASSERT(initial_map->pre_allocated_property_fields() + |
| 5008 initial_map->unused_property_fields() - | 5008 initial_map->unused_property_fields() - |
| 5009 initial_map->inobject_properties() == 0); | 5009 initial_map->inobject_properties() == 0); |
| 5010 | 5010 |
| 5011 // Allocate memory for the object. The initial map might change when | 5011 // Allocate memory for the object. The initial map might change when |
| 5012 // the constructor's prototype changes, but instance size and property | 5012 // the constructor's prototype changes, but instance size and property |
| 5013 // counts remain unchanged (if slack tracking finished). | 5013 // counts remain unchanged (if slack tracking finished). |
| 5014 ASSERT(!constructor->shared()->IsInobjectSlackTrackingInProgress()); | 5014 ASSERT(!constructor->shared()->IsInobjectSlackTrackingInProgress()); |
| 5015 __ AllocateInNewSpace(instance_size, | 5015 __ Allocate(instance_size, result, no_reg, scratch, deferred->entry(), |
| 5016 result, | 5016 TAG_OBJECT, MacroAssembler::NEW_SPACE); |
| 5017 no_reg, | |
| 5018 scratch, | |
| 5019 deferred->entry(), | |
| 5020 TAG_OBJECT); | |
| 5021 | 5017 |
| 5022 __ bind(deferred->exit()); | 5018 __ bind(deferred->exit()); |
| 5023 if (FLAG_debug_code) { | 5019 if (FLAG_debug_code) { |
| 5024 Label is_in_new_space; | 5020 Label is_in_new_space; |
| 5025 __ JumpIfInNewSpace(result, scratch, &is_in_new_space); | 5021 __ JumpIfInNewSpace(result, scratch, &is_in_new_space); |
| 5026 __ Abort("Allocated object is not in new-space"); | 5022 __ Abort("Allocated object is not in new-space"); |
| 5027 __ bind(&is_in_new_space); | 5023 __ bind(&is_in_new_space); |
| 5028 } | 5024 } |
| 5029 | 5025 |
| 5030 // Load the initial map. | 5026 // Load the initial map. |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5099 Register result = ToRegister(instr->result()); | 5095 Register result = ToRegister(instr->result()); |
| 5100 Register temp = ToRegister(instr->temp()); | 5096 Register temp = ToRegister(instr->temp()); |
| 5101 | 5097 |
| 5102 // Allocate memory for the object. | 5098 // Allocate memory for the object. |
| 5103 AllocationFlags flags = TAG_OBJECT; | 5099 AllocationFlags flags = TAG_OBJECT; |
| 5104 if (instr->hydrogen()->MustAllocateDoubleAligned()) { | 5100 if (instr->hydrogen()->MustAllocateDoubleAligned()) { |
| 5105 flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT); | 5101 flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT); |
| 5106 } | 5102 } |
| 5107 if (instr->size()->IsConstantOperand()) { | 5103 if (instr->size()->IsConstantOperand()) { |
| 5108 int32_t size = ToInteger32(LConstantOperand::cast(instr->size())); | 5104 int32_t size = ToInteger32(LConstantOperand::cast(instr->size())); |
| 5109 __ AllocateInNewSpace(size, result, temp, no_reg, deferred->entry(), flags); | 5105 if (instr->hydrogen()->CanAllocateInOldPointerSpace()) { |
| 5106 __ Allocate(size, result, temp, no_reg, deferred->entry(), flags, |
| 5107 MacroAssembler::OLD_POINTER_SPACE); |
| 5108 } else { |
| 5109 __ Allocate(size, result, temp, no_reg, deferred->entry(), flags, |
| 5110 MacroAssembler::NEW_SPACE); |
| 5111 } |
| 5110 } else { | 5112 } else { |
| 5111 Register size = ToRegister(instr->size()); | 5113 Register size = ToRegister(instr->size()); |
| 5112 __ AllocateInNewSpace(size, result, temp, no_reg, deferred->entry(), flags); | 5114 __ AllocateInNewSpace(size, result, temp, no_reg, deferred->entry(), flags); |
| 5113 } | 5115 } |
| 5114 | 5116 |
| 5115 __ bind(deferred->exit()); | 5117 __ bind(deferred->exit()); |
| 5116 } | 5118 } |
| 5117 | 5119 |
| 5118 | 5120 |
| 5119 void LCodeGen::DoDeferredAllocate(LAllocate* instr) { | 5121 void LCodeGen::DoDeferredAllocate(LAllocate* instr) { |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5320 // Retrieve elements_kind from bit field 2. | 5322 // Retrieve elements_kind from bit field 2. |
| 5321 __ and_(rcx, Immediate(Map::kElementsKindMask)); | 5323 __ and_(rcx, Immediate(Map::kElementsKindMask)); |
| 5322 __ cmpb(rcx, Immediate(boilerplate_elements_kind << | 5324 __ cmpb(rcx, Immediate(boilerplate_elements_kind << |
| 5323 Map::kElementsKindShift)); | 5325 Map::kElementsKindShift)); |
| 5324 DeoptimizeIf(not_equal, instr->environment()); | 5326 DeoptimizeIf(not_equal, instr->environment()); |
| 5325 } | 5327 } |
| 5326 | 5328 |
| 5327 // Allocate all objects that are part of the literal in one big | 5329 // Allocate all objects that are part of the literal in one big |
| 5328 // allocation. This avoids multiple limit checks. | 5330 // allocation. This avoids multiple limit checks. |
| 5329 Label allocated, runtime_allocate; | 5331 Label allocated, runtime_allocate; |
| 5330 __ AllocateInNewSpace(size, rax, rcx, rdx, &runtime_allocate, TAG_OBJECT); | 5332 __ Allocate(size, rax, rcx, rdx, &runtime_allocate, TAG_OBJECT, |
| 5333 MacroAssembler::NEW_SPACE); |
| 5331 __ jmp(&allocated); | 5334 __ jmp(&allocated); |
| 5332 | 5335 |
| 5333 __ bind(&runtime_allocate); | 5336 __ bind(&runtime_allocate); |
| 5334 __ Push(Smi::FromInt(size)); | 5337 __ Push(Smi::FromInt(size)); |
| 5335 CallRuntime(Runtime::kAllocateInNewSpace, 1, instr); | 5338 CallRuntime(Runtime::kAllocateInNewSpace, 1, instr); |
| 5336 | 5339 |
| 5337 __ bind(&allocated); | 5340 __ bind(&allocated); |
| 5338 int offset = 0; | 5341 int offset = 0; |
| 5339 __ LoadHeapObject(rbx, instr->hydrogen()->boilerplate()); | 5342 __ LoadHeapObject(rbx, instr->hydrogen()->boilerplate()); |
| 5340 EmitDeepCopy(instr->hydrogen()->boilerplate(), rax, rbx, &offset, | 5343 EmitDeepCopy(instr->hydrogen()->boilerplate(), rax, rbx, &offset, |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5407 __ push(rcx); | 5410 __ push(rcx); |
| 5408 __ Push(Smi::FromInt(instr->hydrogen()->literal_index())); | 5411 __ Push(Smi::FromInt(instr->hydrogen()->literal_index())); |
| 5409 __ Push(instr->hydrogen()->pattern()); | 5412 __ Push(instr->hydrogen()->pattern()); |
| 5410 __ Push(instr->hydrogen()->flags()); | 5413 __ Push(instr->hydrogen()->flags()); |
| 5411 CallRuntime(Runtime::kMaterializeRegExpLiteral, 4, instr); | 5414 CallRuntime(Runtime::kMaterializeRegExpLiteral, 4, instr); |
| 5412 __ movq(rbx, rax); | 5415 __ movq(rbx, rax); |
| 5413 | 5416 |
| 5414 __ bind(&materialized); | 5417 __ bind(&materialized); |
| 5415 int size = JSRegExp::kSize + JSRegExp::kInObjectFieldCount * kPointerSize; | 5418 int size = JSRegExp::kSize + JSRegExp::kInObjectFieldCount * kPointerSize; |
| 5416 Label allocated, runtime_allocate; | 5419 Label allocated, runtime_allocate; |
| 5417 __ AllocateInNewSpace(size, rax, rcx, rdx, &runtime_allocate, TAG_OBJECT); | 5420 __ Allocate(size, rax, rcx, rdx, &runtime_allocate, TAG_OBJECT, |
| 5421 MacroAssembler::NEW_SPACE); |
| 5418 __ jmp(&allocated); | 5422 __ jmp(&allocated); |
| 5419 | 5423 |
| 5420 __ bind(&runtime_allocate); | 5424 __ bind(&runtime_allocate); |
| 5421 __ push(rbx); | 5425 __ push(rbx); |
| 5422 __ Push(Smi::FromInt(size)); | 5426 __ Push(Smi::FromInt(size)); |
| 5423 CallRuntime(Runtime::kAllocateInNewSpace, 1, instr); | 5427 CallRuntime(Runtime::kAllocateInNewSpace, 1, instr); |
| 5424 __ pop(rbx); | 5428 __ pop(rbx); |
| 5425 | 5429 |
| 5426 __ bind(&allocated); | 5430 __ bind(&allocated); |
| 5427 // Copy the content into the newly allocated memory. | 5431 // Copy the content into the newly allocated memory. |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5822 FixedArray::kHeaderSize - kPointerSize)); | 5826 FixedArray::kHeaderSize - kPointerSize)); |
| 5823 __ bind(&done); | 5827 __ bind(&done); |
| 5824 } | 5828 } |
| 5825 | 5829 |
| 5826 | 5830 |
| 5827 #undef __ | 5831 #undef __ |
| 5828 | 5832 |
| 5829 } } // namespace v8::internal | 5833 } } // namespace v8::internal |
| 5830 | 5834 |
| 5831 #endif // V8_TARGET_ARCH_X64 | 5835 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |