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

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

Issue 10443052: Fix missing write barrier in store field stub. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments by Vyacheslav Egorov. Created 8 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-ia32.h ('k') | src/ia32/stub-cache-ia32.cc » ('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 2098 matching lines...) Expand 10 before | Expand all | Expand 10 after
2109 new(zone()) LTransitionElementsKind(object, 2109 new(zone()) LTransitionElementsKind(object,
2110 new_map_reg, 2110 new_map_reg,
2111 fixed_object_reg); 2111 fixed_object_reg);
2112 return MarkAsCall(DefineFixed(result, eax), instr); 2112 return MarkAsCall(DefineFixed(result, eax), instr);
2113 } 2113 }
2114 } 2114 }
2115 2115
2116 2116
2117 LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) { 2117 LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) {
2118 bool needs_write_barrier = instr->NeedsWriteBarrier(); 2118 bool needs_write_barrier = instr->NeedsWriteBarrier();
2119 bool needs_write_barrier_for_map = !instr->transition().is_null() &&
2120 instr->NeedsWriteBarrierForMap();
2119 2121
2120 LOperand* obj; 2122 LOperand* obj;
2121 if (needs_write_barrier) { 2123 if (needs_write_barrier) {
2122 obj = instr->is_in_object() 2124 obj = instr->is_in_object()
2123 ? UseRegister(instr->object()) 2125 ? UseRegister(instr->object())
2124 : UseTempRegister(instr->object()); 2126 : UseTempRegister(instr->object());
2125 } else { 2127 } else {
2126 obj = UseRegisterAtStart(instr->object()); 2128 obj = needs_write_barrier_for_map
2129 ? UseRegister(instr->object())
2130 : UseRegisterAtStart(instr->object());
2127 } 2131 }
2128 2132
2129 LOperand* val = needs_write_barrier 2133 LOperand* val = needs_write_barrier
2130 ? UseTempRegister(instr->value()) 2134 ? UseTempRegister(instr->value())
2131 : UseRegister(instr->value()); 2135 : UseRegister(instr->value());
2132 2136
2133 // We only need a scratch register if we have a write barrier or we 2137 // We only need a scratch register if we have a write barrier or we
2134 // have a store into the properties array (not in-object-property). 2138 // have a store into the properties array (not in-object-property).
2135 LOperand* temp = (!instr->is_in_object() || needs_write_barrier) 2139 LOperand* temp = (!instr->is_in_object() || needs_write_barrier ||
2136 ? TempRegister() 2140 needs_write_barrier_for_map) ? TempRegister() : NULL;
2137 : NULL;
2138 2141
2139 return new(zone()) LStoreNamedField(obj, val, temp); 2142 // We need a temporary register for write barrier of the map field.
2143 LOperand* temp_map = needs_write_barrier_for_map ? TempRegister() : NULL;
2144
2145 return new(zone()) LStoreNamedField(obj, val, temp, temp_map);
2140 } 2146 }
2141 2147
2142 2148
2143 LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) { 2149 LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) {
2144 LOperand* context = UseFixed(instr->context(), esi); 2150 LOperand* context = UseFixed(instr->context(), esi);
2145 LOperand* object = UseFixed(instr->object(), edx); 2151 LOperand* object = UseFixed(instr->object(), edx);
2146 LOperand* value = UseFixed(instr->value(), eax); 2152 LOperand* value = UseFixed(instr->value(), eax);
2147 2153
2148 LStoreNamedGeneric* result = 2154 LStoreNamedGeneric* result =
2149 new(zone()) LStoreNamedGeneric(context, object, value); 2155 new(zone()) LStoreNamedGeneric(context, object, value);
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
2431 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2437 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2432 LOperand* object = UseRegister(instr->object()); 2438 LOperand* object = UseRegister(instr->object());
2433 LOperand* index = UseTempRegister(instr->index()); 2439 LOperand* index = UseTempRegister(instr->index());
2434 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); 2440 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index));
2435 } 2441 }
2436 2442
2437 2443
2438 } } // namespace v8::internal 2444 } } // namespace v8::internal
2439 2445
2440 #endif // V8_TARGET_ARCH_IA32 2446 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/lithium-ia32.h ('k') | src/ia32/stub-cache-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698