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

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

Issue 295743002: Refactor transitioning stores. (Closed) Base URL: git@github.com:v8/v8.git@master
Patch Set: Created 6 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
« no previous file with comments | « src/x64/lithium-codegen-x64.cc ('k') | no next file » | 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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "v8.h" 5 #include "v8.h"
6 6
7 #if V8_TARGET_ARCH_X64 7 #if V8_TARGET_ARCH_X64
8 8
9 #include "lithium-allocator-inl.h" 9 #include "lithium-allocator-inl.h"
10 #include "x64/lithium-x64.h" 10 #include "x64/lithium-x64.h"
(...skipping 2258 matching lines...) Expand 10 before | Expand all | Expand 10 after
2269 new(zone()) LTrapAllocationMemento(object, temp); 2269 new(zone()) LTrapAllocationMemento(object, temp);
2270 return AssignEnvironment(result); 2270 return AssignEnvironment(result);
2271 } 2271 }
2272 2272
2273 2273
2274 LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) { 2274 LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) {
2275 bool is_in_object = instr->access().IsInobject(); 2275 bool is_in_object = instr->access().IsInobject();
2276 bool is_external_location = instr->access().IsExternalMemory() && 2276 bool is_external_location = instr->access().IsExternalMemory() &&
2277 instr->access().offset() == 0; 2277 instr->access().offset() == 0;
2278 bool needs_write_barrier = instr->NeedsWriteBarrier(); 2278 bool needs_write_barrier = instr->NeedsWriteBarrier();
2279 bool needs_write_barrier_for_map = instr->has_transition() &&
2280 instr->NeedsWriteBarrierForMap();
2281 2279
2282 LOperand* obj; 2280 LOperand* obj;
2283 if (needs_write_barrier) { 2281 if (needs_write_barrier) {
2284 obj = is_in_object 2282 obj = is_in_object
2285 ? UseRegister(instr->object()) 2283 ? UseRegister(instr->object())
2286 : UseTempRegister(instr->object()); 2284 : UseTempRegister(instr->object());
2287 } else if (is_external_location) { 2285 } else if (is_external_location) {
2288 ASSERT(!is_in_object); 2286 ASSERT(!is_in_object);
2289 ASSERT(!needs_write_barrier); 2287 ASSERT(!needs_write_barrier);
2290 ASSERT(!needs_write_barrier_for_map);
2291 obj = UseRegisterOrConstant(instr->object()); 2288 obj = UseRegisterOrConstant(instr->object());
2292 } else { 2289 } else {
2293 obj = needs_write_barrier_for_map 2290 obj = UseRegisterAtStart(instr->object());
2294 ? UseRegister(instr->object())
2295 : UseRegisterAtStart(instr->object());
2296 } 2291 }
2297 2292
2298 bool can_be_constant = instr->value()->IsConstant() && 2293 bool can_be_constant = instr->value()->IsConstant() &&
2299 HConstant::cast(instr->value())->NotInNewSpace() && 2294 HConstant::cast(instr->value())->NotInNewSpace() &&
2300 !instr->field_representation().IsDouble(); 2295 !instr->field_representation().IsDouble();
2301 2296
2302 LOperand* val; 2297 LOperand* val;
2303 if (needs_write_barrier) { 2298 if (needs_write_barrier) {
2304 val = UseTempRegister(instr->value()); 2299 val = UseTempRegister(instr->value());
2305 } else if (is_external_location) { 2300 } else if (is_external_location) {
2306 val = UseFixed(instr->value(), rax); 2301 val = UseFixed(instr->value(), rax);
2307 } else if (can_be_constant) { 2302 } else if (can_be_constant) {
2308 val = UseRegisterOrConstant(instr->value()); 2303 val = UseRegisterOrConstant(instr->value());
2309 } else if (instr->field_representation().IsSmi()) { 2304 } else if (instr->field_representation().IsSmi()) {
2310 val = UseRegister(instr->value()); 2305 val = UseRegister(instr->value());
2311 } else if (instr->field_representation().IsDouble()) { 2306 } else if (instr->field_representation().IsDouble()) {
2312 val = UseRegisterAtStart(instr->value()); 2307 val = UseRegisterAtStart(instr->value());
2313 } else { 2308 } else {
2314 val = UseRegister(instr->value()); 2309 val = UseRegister(instr->value());
2315 } 2310 }
2316 2311
2317 // We only need a scratch register if we have a write barrier or we 2312 // We only need a scratch register if we have a write barrier or we
2318 // have a store into the properties array (not in-object-property). 2313 // have a store into the properties array (not in-object-property).
2319 LOperand* temp = (!is_in_object || needs_write_barrier || 2314 LOperand* temp = (!is_in_object || needs_write_barrier)
2320 needs_write_barrier_for_map) ? TempRegister() : NULL; 2315 ? TempRegister() : NULL;
2321 2316
2322 LInstruction* result = new(zone()) LStoreNamedField(obj, val, temp); 2317 LInstruction* result = new(zone()) LStoreNamedField(obj, val, temp);
2323 if (!instr->access().IsExternalMemory() && 2318 if (!instr->access().IsExternalMemory() &&
2324 instr->field_representation().IsHeapObject() && 2319 instr->field_representation().IsHeapObject() &&
2325 (val->IsConstantOperand() 2320 (val->IsConstantOperand()
2326 ? HConstant::cast(instr->value())->HasSmiValue() 2321 ? HConstant::cast(instr->value())->HasSmiValue()
2327 : !instr->value()->type().IsHeapObject())) { 2322 : !instr->value()->type().IsHeapObject())) {
2328 result = AssignEnvironment(result); 2323 result = AssignEnvironment(result);
2329 } 2324 }
2330 return result; 2325 return result;
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
2593 LOperand* index = UseTempRegister(instr->index()); 2588 LOperand* index = UseTempRegister(instr->index());
2594 LLoadFieldByIndex* load = new(zone()) LLoadFieldByIndex(object, index); 2589 LLoadFieldByIndex* load = new(zone()) LLoadFieldByIndex(object, index);
2595 LInstruction* result = DefineSameAsFirst(load); 2590 LInstruction* result = DefineSameAsFirst(load);
2596 return AssignPointerMap(result); 2591 return AssignPointerMap(result);
2597 } 2592 }
2598 2593
2599 2594
2600 } } // namespace v8::internal 2595 } } // namespace v8::internal
2601 2596
2602 #endif // V8_TARGET_ARCH_X64 2597 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/lithium-codegen-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698