Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: src/x64/lithium-codegen-x64.cc

Issue 12314155: Allow direct allocation in old pointer space. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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);
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
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 flags = static_cast<AllocationFlags>(flags | PRETENURE);
5107 }
5108 __ Allocate(size, result, temp, no_reg, deferred->entry(), flags);
5110 } else { 5109 } else {
5111 Register size = ToRegister(instr->size()); 5110 Register size = ToRegister(instr->size());
5112 __ AllocateInNewSpace(size, result, temp, no_reg, deferred->entry(), flags); 5111 __ AllocateInNewSpace(size, result, temp, no_reg, deferred->entry(), flags);
5113 } 5112 }
5114 5113
5115 __ bind(deferred->exit()); 5114 __ bind(deferred->exit());
5116 } 5115 }
5117 5116
5118 5117
5119 void LCodeGen::DoDeferredAllocate(LAllocate* instr) { 5118 void LCodeGen::DoDeferredAllocate(LAllocate* instr) {
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
5320 // Retrieve elements_kind from bit field 2. 5319 // Retrieve elements_kind from bit field 2.
5321 __ and_(rcx, Immediate(Map::kElementsKindMask)); 5320 __ and_(rcx, Immediate(Map::kElementsKindMask));
5322 __ cmpb(rcx, Immediate(boilerplate_elements_kind << 5321 __ cmpb(rcx, Immediate(boilerplate_elements_kind <<
5323 Map::kElementsKindShift)); 5322 Map::kElementsKindShift));
5324 DeoptimizeIf(not_equal, instr->environment()); 5323 DeoptimizeIf(not_equal, instr->environment());
5325 } 5324 }
5326 5325
5327 // Allocate all objects that are part of the literal in one big 5326 // Allocate all objects that are part of the literal in one big
5328 // allocation. This avoids multiple limit checks. 5327 // allocation. This avoids multiple limit checks.
5329 Label allocated, runtime_allocate; 5328 Label allocated, runtime_allocate;
5330 __ AllocateInNewSpace(size, rax, rcx, rdx, &runtime_allocate, TAG_OBJECT); 5329 __ Allocate(size, rax, rcx, rdx, &runtime_allocate, TAG_OBJECT);
5331 __ jmp(&allocated); 5330 __ jmp(&allocated);
5332 5331
5333 __ bind(&runtime_allocate); 5332 __ bind(&runtime_allocate);
5334 __ Push(Smi::FromInt(size)); 5333 __ Push(Smi::FromInt(size));
5335 CallRuntime(Runtime::kAllocateInNewSpace, 1, instr); 5334 CallRuntime(Runtime::kAllocateInNewSpace, 1, instr);
5336 5335
5337 __ bind(&allocated); 5336 __ bind(&allocated);
5338 int offset = 0; 5337 int offset = 0;
5339 __ LoadHeapObject(rbx, instr->hydrogen()->boilerplate()); 5338 __ LoadHeapObject(rbx, instr->hydrogen()->boilerplate());
5340 EmitDeepCopy(instr->hydrogen()->boilerplate(), rax, rbx, &offset, 5339 EmitDeepCopy(instr->hydrogen()->boilerplate(), rax, rbx, &offset,
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
5407 __ push(rcx); 5406 __ push(rcx);
5408 __ Push(Smi::FromInt(instr->hydrogen()->literal_index())); 5407 __ Push(Smi::FromInt(instr->hydrogen()->literal_index()));
5409 __ Push(instr->hydrogen()->pattern()); 5408 __ Push(instr->hydrogen()->pattern());
5410 __ Push(instr->hydrogen()->flags()); 5409 __ Push(instr->hydrogen()->flags());
5411 CallRuntime(Runtime::kMaterializeRegExpLiteral, 4, instr); 5410 CallRuntime(Runtime::kMaterializeRegExpLiteral, 4, instr);
5412 __ movq(rbx, rax); 5411 __ movq(rbx, rax);
5413 5412
5414 __ bind(&materialized); 5413 __ bind(&materialized);
5415 int size = JSRegExp::kSize + JSRegExp::kInObjectFieldCount * kPointerSize; 5414 int size = JSRegExp::kSize + JSRegExp::kInObjectFieldCount * kPointerSize;
5416 Label allocated, runtime_allocate; 5415 Label allocated, runtime_allocate;
5417 __ AllocateInNewSpace(size, rax, rcx, rdx, &runtime_allocate, TAG_OBJECT); 5416 __ Allocate(size, rax, rcx, rdx, &runtime_allocate, TAG_OBJECT);
5418 __ jmp(&allocated); 5417 __ jmp(&allocated);
5419 5418
5420 __ bind(&runtime_allocate); 5419 __ bind(&runtime_allocate);
5421 __ push(rbx); 5420 __ push(rbx);
5422 __ Push(Smi::FromInt(size)); 5421 __ Push(Smi::FromInt(size));
5423 CallRuntime(Runtime::kAllocateInNewSpace, 1, instr); 5422 CallRuntime(Runtime::kAllocateInNewSpace, 1, instr);
5424 __ pop(rbx); 5423 __ pop(rbx);
5425 5424
5426 __ bind(&allocated); 5425 __ bind(&allocated);
5427 // Copy the content into the newly allocated memory. 5426 // Copy the content into the newly allocated memory.
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
5822 FixedArray::kHeaderSize - kPointerSize)); 5821 FixedArray::kHeaderSize - kPointerSize));
5823 __ bind(&done); 5822 __ bind(&done);
5824 } 5823 }
5825 5824
5826 5825
5827 #undef __ 5826 #undef __
5828 5827
5829 } } // namespace v8::internal 5828 } } // namespace v8::internal
5830 5829
5831 #endif // V8_TARGET_ARCH_X64 5830 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698