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

Side by Side Diff: src/ia32/lithium-codegen-ia32.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
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 5938 matching lines...) Expand 10 before | Expand all | Expand 10 after
5949 5949
5950 Register result = ToRegister(instr->result()); 5950 Register result = ToRegister(instr->result());
5951 Register scratch = ToRegister(instr->temp()); 5951 Register scratch = ToRegister(instr->temp());
5952 Handle<JSFunction> constructor = instr->hydrogen()->constructor(); 5952 Handle<JSFunction> constructor = instr->hydrogen()->constructor();
5953 Handle<Map> initial_map = instr->hydrogen()->constructor_initial_map(); 5953 Handle<Map> initial_map = instr->hydrogen()->constructor_initial_map();
5954 int instance_size = initial_map->instance_size(); 5954 int instance_size = initial_map->instance_size();
5955 ASSERT(initial_map->pre_allocated_property_fields() + 5955 ASSERT(initial_map->pre_allocated_property_fields() +
5956 initial_map->unused_property_fields() - 5956 initial_map->unused_property_fields() -
5957 initial_map->inobject_properties() == 0); 5957 initial_map->inobject_properties() == 0);
5958 5958
5959 __ Allocate(instance_size, result, no_reg, scratch, deferred->entry(), 5959 AllocationFlags flags = TAG_OBJECT;
5960 TAG_OBJECT); 5960 if (instr->hydrogen()->CanAllocateInOldPointerSpace()) {
5961 flags = static_cast<AllocationFlags>(flags | PRETENURE_OLD_POINTER_SPACE);
5962 }
5963
5964 __ Allocate(instance_size, result, no_reg, scratch, deferred->entry(), flags);
5961 5965
5962 __ bind(deferred->exit()); 5966 __ bind(deferred->exit());
5963 if (FLAG_debug_code) { 5967 if (FLAG_debug_code && !instr->hydrogen()->CanAllocateInOldPointerSpace()) {
5964 Label is_in_new_space; 5968 Label is_in_new_space;
5965 __ JumpIfInNewSpace(result, scratch, &is_in_new_space); 5969 __ JumpIfInNewSpace(result, scratch, &is_in_new_space);
5966 __ Abort("Allocated object is not in new-space"); 5970 __ Abort("Allocated object is not in new-space");
5967 __ bind(&is_in_new_space); 5971 __ bind(&is_in_new_space);
5968 } 5972 }
5969 5973
5970 // Load the initial map. 5974 // Load the initial map.
5971 Register map = scratch; 5975 Register map = scratch;
5972 __ LoadHeapObject(scratch, constructor); 5976 __ LoadHeapObject(scratch, constructor);
5977 // Recording the map slot can be skipped, because maps are not compacted.
5973 __ mov(map, FieldOperand(scratch, JSFunction::kPrototypeOrInitialMapOffset)); 5978 __ mov(map, FieldOperand(scratch, JSFunction::kPrototypeOrInitialMapOffset));
5974 5979
5975 if (FLAG_debug_code) { 5980 if (FLAG_debug_code) {
5976 __ AssertNotSmi(map); 5981 __ AssertNotSmi(map);
5977 __ cmpb(FieldOperand(map, Map::kInstanceSizeOffset), 5982 __ cmpb(FieldOperand(map, Map::kInstanceSizeOffset),
5978 instance_size >> kPointerSizeLog2); 5983 instance_size >> kPointerSizeLog2);
5979 __ Assert(equal, "Unexpected instance size"); 5984 __ Assert(equal, "Unexpected instance size");
5980 __ cmpb(FieldOperand(map, Map::kPreAllocatedPropertyFieldsOffset), 5985 __ cmpb(FieldOperand(map, Map::kPreAllocatedPropertyFieldsOffset),
5981 initial_map->pre_allocated_property_fields()); 5986 initial_map->pre_allocated_property_fields());
5982 __ Assert(equal, "Unexpected pre-allocated property fields count"); 5987 __ Assert(equal, "Unexpected pre-allocated property fields count");
(...skipping 26 matching lines...) Expand all
6009 Handle<Map> initial_map = instr->hydrogen()->constructor_initial_map(); 6014 Handle<Map> initial_map = instr->hydrogen()->constructor_initial_map();
6010 int instance_size = initial_map->instance_size(); 6015 int instance_size = initial_map->instance_size();
6011 6016
6012 // TODO(3095996): Get rid of this. For now, we need to make the 6017 // TODO(3095996): Get rid of this. For now, we need to make the
6013 // result register contain a valid pointer because it is already 6018 // result register contain a valid pointer because it is already
6014 // contained in the register pointer map. 6019 // contained in the register pointer map.
6015 __ Set(result, Immediate(0)); 6020 __ Set(result, Immediate(0));
6016 6021
6017 PushSafepointRegistersScope scope(this); 6022 PushSafepointRegistersScope scope(this);
6018 __ push(Immediate(Smi::FromInt(instance_size))); 6023 __ push(Immediate(Smi::FromInt(instance_size)));
6019 CallRuntimeFromDeferred( 6024
6020 Runtime::kAllocateInNewSpace, 1, instr, instr->context()); 6025 if (instr->hydrogen()->CanAllocateInOldPointerSpace()) {
6026 CallRuntimeFromDeferred(
6027 Runtime::kAllocateInOldPointerSpace, 1, instr, instr->context());
6028 } else {
6029 CallRuntimeFromDeferred(
6030 Runtime::kAllocateInNewSpace, 1, instr, instr->context());
6031 }
6021 __ StoreToSafepointRegisterSlot(result, eax); 6032 __ StoreToSafepointRegisterSlot(result, eax);
6022 } 6033 }
6023 6034
6024 6035
6025 void LCodeGen::DoAllocate(LAllocate* instr) { 6036 void LCodeGen::DoAllocate(LAllocate* instr) {
6026 class DeferredAllocate: public LDeferredCode { 6037 class DeferredAllocate: public LDeferredCode {
6027 public: 6038 public:
6028 DeferredAllocate(LCodeGen* codegen, LAllocate* instr) 6039 DeferredAllocate(LCodeGen* codegen, LAllocate* instr)
6029 : LDeferredCode(codegen), instr_(instr) { } 6040 : LDeferredCode(codegen), instr_(instr) { }
6030 virtual void Generate() { codegen()->DoDeferredAllocate(instr_); } 6041 virtual void Generate() { codegen()->DoDeferredAllocate(instr_); }
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
6527 FixedArray::kHeaderSize - kPointerSize)); 6538 FixedArray::kHeaderSize - kPointerSize));
6528 __ bind(&done); 6539 __ bind(&done);
6529 } 6540 }
6530 6541
6531 6542
6532 #undef __ 6543 #undef __
6533 6544
6534 } } // namespace v8::internal 6545 } } // namespace v8::internal
6535 6546
6536 #endif // V8_TARGET_ARCH_IA32 6547 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698