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

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

Issue 15734002: Add pretenuring support to HAllocateObject. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 7 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
« no previous file with comments | « no previous file | src/flag-definitions.h » ('j') | src/flag-definitions.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 5344 matching lines...) Expand 10 before | Expand all | Expand 10 after
5355 Register result = ToRegister(instr->result()); 5355 Register result = ToRegister(instr->result());
5356 Register scratch = ToRegister(instr->temp()); 5356 Register scratch = ToRegister(instr->temp());
5357 Register scratch2 = ToRegister(instr->temp2()); 5357 Register scratch2 = ToRegister(instr->temp2());
5358 Handle<JSFunction> constructor = instr->hydrogen()->constructor(); 5358 Handle<JSFunction> constructor = instr->hydrogen()->constructor();
5359 Handle<Map> initial_map = instr->hydrogen()->constructor_initial_map(); 5359 Handle<Map> initial_map = instr->hydrogen()->constructor_initial_map();
5360 int instance_size = initial_map->instance_size(); 5360 int instance_size = initial_map->instance_size();
5361 ASSERT(initial_map->pre_allocated_property_fields() + 5361 ASSERT(initial_map->pre_allocated_property_fields() +
5362 initial_map->unused_property_fields() - 5362 initial_map->unused_property_fields() -
5363 initial_map->inobject_properties() == 0); 5363 initial_map->inobject_properties() == 0);
5364 5364
5365 AllocationFlags flags = TAG_OBJECT;
5366 if (instr->hydrogen()->CanAllocateInOldPointerSpace()) {
5367 flags = static_cast<AllocationFlags>(flags | PRETENURE_OLD_POINTER_SPACE);
5368 }
5369
5365 __ Allocate(instance_size, result, scratch, scratch2, deferred->entry(), 5370 __ Allocate(instance_size, result, scratch, scratch2, deferred->entry(),
5366 TAG_OBJECT); 5371 flags);
5367 5372
5368 __ bind(deferred->exit()); 5373 __ bind(deferred->exit());
5369 if (FLAG_debug_code) { 5374 if (FLAG_debug_code && !instr->hydrogen()->CanAllocateInOldPointerSpace()) {
5370 Label is_in_new_space; 5375 Label is_in_new_space;
5371 __ JumpIfInNewSpace(result, scratch, &is_in_new_space); 5376 __ JumpIfInNewSpace(result, scratch, &is_in_new_space);
5372 __ Abort("Allocated object is not in new-space"); 5377 __ Abort("Allocated object is not in new-space");
5373 __ bind(&is_in_new_space); 5378 __ bind(&is_in_new_space);
5374 } 5379 }
5375 5380
5376 // Load the initial map. 5381 // Load the initial map.
5377 Register map = scratch; 5382 Register map = scratch;
5378 __ LoadHeapObject(map, constructor); 5383 __ LoadHeapObject(map, constructor);
5384 // Recording the map slot can be skipped, because maps are not compacted.
5379 __ ldr(map, FieldMemOperand(map, JSFunction::kPrototypeOrInitialMapOffset)); 5385 __ ldr(map, FieldMemOperand(map, JSFunction::kPrototypeOrInitialMapOffset));
5380 5386
5381 // Initialize map and fields of the newly allocated object. 5387 // Initialize map and fields of the newly allocated object.
5382 ASSERT(initial_map->instance_type() == JS_OBJECT_TYPE); 5388 ASSERT(initial_map->instance_type() == JS_OBJECT_TYPE);
5383 __ str(map, FieldMemOperand(result, JSObject::kMapOffset)); 5389 __ str(map, FieldMemOperand(result, JSObject::kMapOffset));
5384 __ LoadRoot(scratch, Heap::kEmptyFixedArrayRootIndex); 5390 __ LoadRoot(scratch, Heap::kEmptyFixedArrayRootIndex);
5385 __ str(scratch, FieldMemOperand(result, JSObject::kElementsOffset)); 5391 __ str(scratch, FieldMemOperand(result, JSObject::kElementsOffset));
5386 __ str(scratch, FieldMemOperand(result, JSObject::kPropertiesOffset)); 5392 __ str(scratch, FieldMemOperand(result, JSObject::kPropertiesOffset));
5387 if (initial_map->inobject_properties() != 0) { 5393 if (initial_map->inobject_properties() != 0) {
5388 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex); 5394 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex);
(...skipping 11 matching lines...) Expand all
5400 int instance_size = initial_map->instance_size(); 5406 int instance_size = initial_map->instance_size();
5401 5407
5402 // TODO(3095996): Get rid of this. For now, we need to make the 5408 // TODO(3095996): Get rid of this. For now, we need to make the
5403 // result register contain a valid pointer because it is already 5409 // result register contain a valid pointer because it is already
5404 // contained in the register pointer map. 5410 // contained in the register pointer map.
5405 __ mov(result, Operand::Zero()); 5411 __ mov(result, Operand::Zero());
5406 5412
5407 PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters); 5413 PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters);
5408 __ mov(r0, Operand(Smi::FromInt(instance_size))); 5414 __ mov(r0, Operand(Smi::FromInt(instance_size)));
5409 __ push(r0); 5415 __ push(r0);
5410 CallRuntimeFromDeferred(Runtime::kAllocateInNewSpace, 1, instr); 5416 if (instr->hydrogen()->CanAllocateInOldPointerSpace()) {
5417 CallRuntimeFromDeferred(Runtime::kAllocateInOldPointerSpace, 1, instr);
5418 } else {
5419 CallRuntimeFromDeferred(Runtime::kAllocateInNewSpace, 1, instr);
5420 }
5411 __ StoreToSafepointRegisterSlot(r0, result); 5421 __ StoreToSafepointRegisterSlot(r0, result);
5412 } 5422 }
5413 5423
5414 5424
5415 void LCodeGen::DoAllocate(LAllocate* instr) { 5425 void LCodeGen::DoAllocate(LAllocate* instr) {
5416 class DeferredAllocate: public LDeferredCode { 5426 class DeferredAllocate: public LDeferredCode {
5417 public: 5427 public:
5418 DeferredAllocate(LCodeGen* codegen, LAllocate* instr) 5428 DeferredAllocate(LCodeGen* codegen, LAllocate* instr)
5419 : LDeferredCode(codegen), instr_(instr) { } 5429 : LDeferredCode(codegen), instr_(instr) { }
5420 virtual void Generate() { codegen()->DoDeferredAllocate(instr_); } 5430 virtual void Generate() { codegen()->DoDeferredAllocate(instr_); }
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
5922 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); 5932 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index));
5923 __ ldr(result, FieldMemOperand(scratch, 5933 __ ldr(result, FieldMemOperand(scratch,
5924 FixedArray::kHeaderSize - kPointerSize)); 5934 FixedArray::kHeaderSize - kPointerSize));
5925 __ bind(&done); 5935 __ bind(&done);
5926 } 5936 }
5927 5937
5928 5938
5929 #undef __ 5939 #undef __
5930 5940
5931 } } // namespace v8::internal 5941 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/flag-definitions.h » ('j') | src/flag-definitions.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698