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

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

Issue 17491002: Revert r14930 and r14935 temporarily. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 6 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 | « src/ia32/lithium-codegen-ia32.h ('k') | src/ia32/lithium-ia32.h » ('j') | no next file with comments »
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 5973 matching lines...) Expand 10 before | Expand all | Expand 10 after
5984 5984
5985 if (!instr->hydrogen()->CanOmitPrototypeChecks()) { 5985 if (!instr->hydrogen()->CanOmitPrototypeChecks()) {
5986 for (int i = 0; i < prototypes->length(); i++) { 5986 for (int i = 0; i < prototypes->length(); i++) {
5987 __ LoadHeapObject(reg, prototypes->at(i)); 5987 __ LoadHeapObject(reg, prototypes->at(i));
5988 DoCheckMapCommon(reg, maps->at(i), instr); 5988 DoCheckMapCommon(reg, maps->at(i), instr);
5989 } 5989 }
5990 } 5990 }
5991 } 5991 }
5992 5992
5993 5993
5994 void LCodeGen::DoAllocateObject(LAllocateObject* instr) {
5995 class DeferredAllocateObject: public LDeferredCode {
5996 public:
5997 DeferredAllocateObject(LCodeGen* codegen, LAllocateObject* instr)
5998 : LDeferredCode(codegen), instr_(instr) { }
5999 virtual void Generate() { codegen()->DoDeferredAllocateObject(instr_); }
6000 virtual LInstruction* instr() { return instr_; }
6001 private:
6002 LAllocateObject* instr_;
6003 };
6004
6005 DeferredAllocateObject* deferred =
6006 new(zone()) DeferredAllocateObject(this, instr);
6007
6008 Register result = ToRegister(instr->result());
6009 Register scratch = ToRegister(instr->temp());
6010 Handle<JSFunction> constructor = instr->hydrogen()->constructor();
6011 Handle<Map> initial_map = instr->hydrogen()->constructor_initial_map();
6012 int instance_size = initial_map->instance_size();
6013 ASSERT(initial_map->pre_allocated_property_fields() +
6014 initial_map->unused_property_fields() -
6015 initial_map->inobject_properties() == 0);
6016
6017 __ Allocate(instance_size, result, no_reg, scratch, deferred->entry(),
6018 TAG_OBJECT);
6019
6020 __ bind(deferred->exit());
6021 if (FLAG_debug_code) {
6022 Label is_in_new_space;
6023 __ JumpIfInNewSpace(result, scratch, &is_in_new_space);
6024 __ Abort("Allocated object is not in new-space");
6025 __ bind(&is_in_new_space);
6026 }
6027
6028 // Load the initial map.
6029 Register map = scratch;
6030 __ LoadHeapObject(scratch, constructor);
6031 __ mov(map, FieldOperand(scratch, JSFunction::kPrototypeOrInitialMapOffset));
6032
6033 if (FLAG_debug_code) {
6034 __ AssertNotSmi(map);
6035 __ cmpb(FieldOperand(map, Map::kInstanceSizeOffset),
6036 instance_size >> kPointerSizeLog2);
6037 __ Assert(equal, "Unexpected instance size");
6038 __ cmpb(FieldOperand(map, Map::kPreAllocatedPropertyFieldsOffset),
6039 initial_map->pre_allocated_property_fields());
6040 __ Assert(equal, "Unexpected pre-allocated property fields count");
6041 __ cmpb(FieldOperand(map, Map::kUnusedPropertyFieldsOffset),
6042 initial_map->unused_property_fields());
6043 __ Assert(equal, "Unexpected unused property fields count");
6044 __ cmpb(FieldOperand(map, Map::kInObjectPropertiesOffset),
6045 initial_map->inobject_properties());
6046 __ Assert(equal, "Unexpected in-object property fields count");
6047 }
6048
6049 // Initialize map and fields of the newly allocated object.
6050 ASSERT(initial_map->instance_type() == JS_OBJECT_TYPE);
6051 __ mov(FieldOperand(result, JSObject::kMapOffset), map);
6052 __ mov(scratch, factory()->empty_fixed_array());
6053 __ mov(FieldOperand(result, JSObject::kElementsOffset), scratch);
6054 __ mov(FieldOperand(result, JSObject::kPropertiesOffset), scratch);
6055 if (initial_map->inobject_properties() != 0) {
6056 __ mov(scratch, factory()->undefined_value());
6057 for (int i = 0; i < initial_map->inobject_properties(); i++) {
6058 int property_offset = JSObject::kHeaderSize + i * kPointerSize;
6059 __ mov(FieldOperand(result, property_offset), scratch);
6060 }
6061 }
6062 }
6063
6064
6065 void LCodeGen::DoDeferredAllocateObject(LAllocateObject* instr) {
6066 Register result = ToRegister(instr->result());
6067 Handle<Map> initial_map = instr->hydrogen()->constructor_initial_map();
6068 int instance_size = initial_map->instance_size();
6069
6070 // TODO(3095996): Get rid of this. For now, we need to make the
6071 // result register contain a valid pointer because it is already
6072 // contained in the register pointer map.
6073 __ Set(result, Immediate(0));
6074
6075 PushSafepointRegistersScope scope(this);
6076 __ push(Immediate(Smi::FromInt(instance_size)));
6077 CallRuntimeFromDeferred(
6078 Runtime::kAllocateInNewSpace, 1, instr, instr->context());
6079 __ StoreToSafepointRegisterSlot(result, eax);
6080 }
6081
6082
5994 void LCodeGen::DoAllocate(LAllocate* instr) { 6083 void LCodeGen::DoAllocate(LAllocate* instr) {
5995 class DeferredAllocate: public LDeferredCode { 6084 class DeferredAllocate: public LDeferredCode {
5996 public: 6085 public:
5997 DeferredAllocate(LCodeGen* codegen, LAllocate* instr) 6086 DeferredAllocate(LCodeGen* codegen, LAllocate* instr)
5998 : LDeferredCode(codegen), instr_(instr) { } 6087 : LDeferredCode(codegen), instr_(instr) { }
5999 virtual void Generate() { codegen()->DoDeferredAllocate(instr_); } 6088 virtual void Generate() { codegen()->DoDeferredAllocate(instr_); }
6000 virtual LInstruction* instr() { return instr_; } 6089 virtual LInstruction* instr() { return instr_; }
6001 private: 6090 private:
6002 LAllocate* instr_; 6091 LAllocate* instr_;
6003 }; 6092 };
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
6504 FixedArray::kHeaderSize - kPointerSize)); 6593 FixedArray::kHeaderSize - kPointerSize));
6505 __ bind(&done); 6594 __ bind(&done);
6506 } 6595 }
6507 6596
6508 6597
6509 #undef __ 6598 #undef __
6510 6599
6511 } } // namespace v8::internal 6600 } } // namespace v8::internal
6512 6601
6513 #endif // V8_TARGET_ARCH_IA32 6602 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/lithium-codegen-ia32.h ('k') | src/ia32/lithium-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698