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

Side by Side Diff: src/x64/lithium-codegen-x64.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/x64/lithium-codegen-x64.h ('k') | src/x64/lithium-x64.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 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 5066 matching lines...) Expand 10 before | Expand all | Expand 10 after
5077 5077
5078 if (!instr->hydrogen()->CanOmitPrototypeChecks()) { 5078 if (!instr->hydrogen()->CanOmitPrototypeChecks()) {
5079 for (int i = 0; i < prototypes->length(); i++) { 5079 for (int i = 0; i < prototypes->length(); i++) {
5080 __ LoadHeapObject(reg, prototypes->at(i)); 5080 __ LoadHeapObject(reg, prototypes->at(i));
5081 DoCheckMapCommon(reg, maps->at(i), instr); 5081 DoCheckMapCommon(reg, maps->at(i), instr);
5082 } 5082 }
5083 } 5083 }
5084 } 5084 }
5085 5085
5086 5086
5087 void LCodeGen::DoAllocateObject(LAllocateObject* instr) {
5088 class DeferredAllocateObject: public LDeferredCode {
5089 public:
5090 DeferredAllocateObject(LCodeGen* codegen, LAllocateObject* instr)
5091 : LDeferredCode(codegen), instr_(instr) { }
5092 virtual void Generate() { codegen()->DoDeferredAllocateObject(instr_); }
5093 virtual LInstruction* instr() { return instr_; }
5094 private:
5095 LAllocateObject* instr_;
5096 };
5097
5098 DeferredAllocateObject* deferred =
5099 new(zone()) DeferredAllocateObject(this, instr);
5100
5101 Register result = ToRegister(instr->result());
5102 Register scratch = ToRegister(instr->temp());
5103 Handle<JSFunction> constructor = instr->hydrogen()->constructor();
5104 Handle<Map> initial_map = instr->hydrogen()->constructor_initial_map();
5105 int instance_size = initial_map->instance_size();
5106 ASSERT(initial_map->pre_allocated_property_fields() +
5107 initial_map->unused_property_fields() -
5108 initial_map->inobject_properties() == 0);
5109
5110 __ Allocate(instance_size, result, no_reg, scratch, deferred->entry(),
5111 TAG_OBJECT);
5112
5113 __ bind(deferred->exit());
5114 if (FLAG_debug_code) {
5115 Label is_in_new_space;
5116 __ JumpIfInNewSpace(result, scratch, &is_in_new_space);
5117 __ Abort("Allocated object is not in new-space");
5118 __ bind(&is_in_new_space);
5119 }
5120
5121 // Load the initial map.
5122 Register map = scratch;
5123 __ LoadHeapObject(scratch, constructor);
5124 __ movq(map, FieldOperand(scratch, JSFunction::kPrototypeOrInitialMapOffset));
5125
5126 if (FLAG_debug_code) {
5127 __ AssertNotSmi(map);
5128 __ cmpb(FieldOperand(map, Map::kInstanceSizeOffset),
5129 Immediate(instance_size >> kPointerSizeLog2));
5130 __ Assert(equal, "Unexpected instance size");
5131 __ cmpb(FieldOperand(map, Map::kPreAllocatedPropertyFieldsOffset),
5132 Immediate(initial_map->pre_allocated_property_fields()));
5133 __ Assert(equal, "Unexpected pre-allocated property fields count");
5134 __ cmpb(FieldOperand(map, Map::kUnusedPropertyFieldsOffset),
5135 Immediate(initial_map->unused_property_fields()));
5136 __ Assert(equal, "Unexpected unused property fields count");
5137 __ cmpb(FieldOperand(map, Map::kInObjectPropertiesOffset),
5138 Immediate(initial_map->inobject_properties()));
5139 __ Assert(equal, "Unexpected in-object property fields count");
5140 }
5141
5142 // Initialize map and fields of the newly allocated object.
5143 ASSERT(initial_map->instance_type() == JS_OBJECT_TYPE);
5144 __ movq(FieldOperand(result, JSObject::kMapOffset), map);
5145 __ LoadRoot(scratch, Heap::kEmptyFixedArrayRootIndex);
5146 __ movq(FieldOperand(result, JSObject::kElementsOffset), scratch);
5147 __ movq(FieldOperand(result, JSObject::kPropertiesOffset), scratch);
5148 if (initial_map->inobject_properties() != 0) {
5149 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex);
5150 for (int i = 0; i < initial_map->inobject_properties(); i++) {
5151 int property_offset = JSObject::kHeaderSize + i * kPointerSize;
5152 __ movq(FieldOperand(result, property_offset), scratch);
5153 }
5154 }
5155 }
5156
5157
5158 void LCodeGen::DoDeferredAllocateObject(LAllocateObject* instr) {
5159 Register result = ToRegister(instr->result());
5160 Handle<Map> initial_map = instr->hydrogen()->constructor_initial_map();
5161 int instance_size = initial_map->instance_size();
5162
5163 // TODO(3095996): Get rid of this. For now, we need to make the
5164 // result register contain a valid pointer because it is already
5165 // contained in the register pointer map.
5166 __ Set(result, 0);
5167
5168 PushSafepointRegistersScope scope(this);
5169 __ Push(Smi::FromInt(instance_size));
5170 CallRuntimeFromDeferred(Runtime::kAllocateInNewSpace, 1, instr);
5171 __ StoreToSafepointRegisterSlot(result, rax);
5172 }
5173
5174
5087 void LCodeGen::DoAllocate(LAllocate* instr) { 5175 void LCodeGen::DoAllocate(LAllocate* instr) {
5088 class DeferredAllocate: public LDeferredCode { 5176 class DeferredAllocate: public LDeferredCode {
5089 public: 5177 public:
5090 DeferredAllocate(LCodeGen* codegen, LAllocate* instr) 5178 DeferredAllocate(LCodeGen* codegen, LAllocate* instr)
5091 : LDeferredCode(codegen), instr_(instr) { } 5179 : LDeferredCode(codegen), instr_(instr) { }
5092 virtual void Generate() { codegen()->DoDeferredAllocate(instr_); } 5180 virtual void Generate() { codegen()->DoDeferredAllocate(instr_); }
5093 virtual LInstruction* instr() { return instr_; } 5181 virtual LInstruction* instr() { return instr_; }
5094 private: 5182 private:
5095 LAllocate* instr_; 5183 LAllocate* instr_;
5096 }; 5184 };
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
5605 FixedArray::kHeaderSize - kPointerSize)); 5693 FixedArray::kHeaderSize - kPointerSize));
5606 __ bind(&done); 5694 __ bind(&done);
5607 } 5695 }
5608 5696
5609 5697
5610 #undef __ 5698 #undef __
5611 5699
5612 } } // namespace v8::internal 5700 } } // namespace v8::internal
5613 5701
5614 #endif // V8_TARGET_ARCH_X64 5702 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/lithium-codegen-x64.h ('k') | src/x64/lithium-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698