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

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

Issue 112913002: Split up HLoadNamedField and HStoreNamedField. Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years 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-ia32.h ('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 // 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 2398 matching lines...) Expand 10 before | Expand all | Expand 10 after
2409 HTrapAllocationMemento* instr) { 2409 HTrapAllocationMemento* instr) {
2410 LOperand* object = UseRegister(instr->object()); 2410 LOperand* object = UseRegister(instr->object());
2411 LOperand* temp = TempRegister(); 2411 LOperand* temp = TempRegister();
2412 LTrapAllocationMemento* result = 2412 LTrapAllocationMemento* result =
2413 new(zone()) LTrapAllocationMemento(object, temp); 2413 new(zone()) LTrapAllocationMemento(object, temp);
2414 return AssignEnvironment(result); 2414 return AssignEnvironment(result);
2415 } 2415 }
2416 2416
2417 2417
2418 LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) { 2418 LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) {
2419 bool is_in_object = instr->access().IsInobject();
2420 bool is_external_location = instr->access().IsExternalMemory() && 2419 bool is_external_location = instr->access().IsExternalMemory() &&
2421 instr->access().offset() == 0; 2420 instr->access().offset() == 0;
2422 bool needs_write_barrier = instr->NeedsWriteBarrier(); 2421 bool needs_write_barrier = instr->NeedsWriteBarrier();
2423 bool needs_write_barrier_for_map = instr->has_transition() &&
2424 instr->NeedsWriteBarrierForMap();
2425 2422
2426 LOperand* obj; 2423 LOperand* obj;
2427 if (needs_write_barrier) { 2424 if (needs_write_barrier) {
2428 obj = is_in_object 2425 obj = UseRegister(instr->object());
2429 ? UseRegister(instr->object())
2430 : UseTempRegister(instr->object());
2431 } else if (is_external_location) { 2426 } else if (is_external_location) {
2432 ASSERT(!is_in_object); 2427 ASSERT(!instr->access().IsInobject());
2433 ASSERT(!needs_write_barrier); 2428 ASSERT(!needs_write_barrier);
2434 ASSERT(!needs_write_barrier_for_map);
2435 obj = UseRegisterOrConstant(instr->object()); 2429 obj = UseRegisterOrConstant(instr->object());
2436 } else { 2430 } else {
2437 obj = needs_write_barrier_for_map 2431 obj = UseRegisterAtStart(instr->object());
2438 ? UseRegister(instr->object())
2439 : UseRegisterAtStart(instr->object());
2440 } 2432 }
2441 2433
2442 bool can_be_constant = instr->value()->IsConstant() && 2434 bool can_be_constant = instr->value()->IsConstant() &&
2443 HConstant::cast(instr->value())->NotInNewSpace() && 2435 HConstant::cast(instr->value())->NotInNewSpace() &&
2444 !(FLAG_track_double_fields && instr->field_representation().IsDouble()); 2436 !(FLAG_track_double_fields && instr->field_representation().IsDouble());
2445 2437
2446 LOperand* val; 2438 LOperand* val;
2447 if (instr->field_representation().IsInteger8() || 2439 if (instr->field_representation().IsInteger8() ||
2448 instr->field_representation().IsUInteger8()) { 2440 instr->field_representation().IsUInteger8()) {
2449 // mov_b requires a byte register (i.e. any of eax, ebx, ecx, edx). 2441 // mov_b requires a byte register (i.e. any of eax, ebx, ecx, edx).
2450 // Just force the value to be in eax and we're safe here. 2442 // Just force the value to be in eax and we're safe here.
2451 val = UseFixed(instr->value(), eax); 2443 val = UseFixed(instr->value(), eax);
2452 } else if (needs_write_barrier) { 2444 } else if (needs_write_barrier) {
2453 val = UseTempRegister(instr->value()); 2445 val = UseTempRegister(instr->value());
2454 } else if (can_be_constant) { 2446 } else if (can_be_constant) {
2455 val = UseRegisterOrConstant(instr->value()); 2447 val = UseRegisterOrConstant(instr->value());
2456 } else if (FLAG_track_fields && instr->field_representation().IsSmi()) { 2448 } else if (FLAG_track_fields && instr->field_representation().IsSmi()) {
2457 val = UseTempRegister(instr->value()); 2449 val = UseTempRegister(instr->value());
2458 } else if (FLAG_track_double_fields && 2450 } else if (FLAG_track_double_fields &&
2459 instr->field_representation().IsDouble()) { 2451 instr->field_representation().IsDouble()) {
2460 val = UseRegisterAtStart(instr->value()); 2452 val = UseRegisterAtStart(instr->value());
2461 } else { 2453 } else {
2462 val = UseRegister(instr->value()); 2454 val = UseRegister(instr->value());
2463 } 2455 }
2464 2456
2465 // We only need a scratch register if we have a write barrier or we 2457 // We only need a scratch register if we have a write barrier or we
2466 // have a store into the properties array (not in-object-property). 2458 // have a store into the properties array (not in-object-property).
2467 LOperand* temp = (!is_in_object || needs_write_barrier || 2459 LOperand* temp = needs_write_barrier ? TempRegister() : NULL;
2468 needs_write_barrier_for_map) ? TempRegister() : NULL;
2469
2470 // We need a temporary register for write barrier of the map field.
2471 LOperand* temp_map = needs_write_barrier_for_map ? TempRegister() : NULL;
2472 2460
2473 LStoreNamedField* result = 2461 LStoreNamedField* result =
2474 new(zone()) LStoreNamedField(obj, val, temp, temp_map); 2462 new(zone()) LStoreNamedField(obj, val, temp);
2475 if (FLAG_track_heap_object_fields && 2463 if (FLAG_track_heap_object_fields &&
2476 instr->field_representation().IsHeapObject()) { 2464 instr->field_representation().IsHeapObject()) {
2477 if (!instr->value()->type().IsHeapObject()) { 2465 if (!instr->value()->type().IsHeapObject()) {
2478 return AssignEnvironment(result); 2466 return AssignEnvironment(result);
2479 } 2467 }
2480 } 2468 }
2481 return result; 2469 return result;
2482 } 2470 }
2483 2471
2484 2472
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
2765 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2753 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2766 LOperand* object = UseRegister(instr->object()); 2754 LOperand* object = UseRegister(instr->object());
2767 LOperand* index = UseTempRegister(instr->index()); 2755 LOperand* index = UseTempRegister(instr->index());
2768 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); 2756 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index));
2769 } 2757 }
2770 2758
2771 2759
2772 } } // namespace v8::internal 2760 } } // namespace v8::internal
2773 2761
2774 #endif // V8_TARGET_ARCH_IA32 2762 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/lithium-ia32.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698