OLD | NEW |
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 2087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2098 new(zone()) LTransitionElementsKind(object, | 2098 new(zone()) LTransitionElementsKind(object, |
2099 new_map_reg, | 2099 new_map_reg, |
2100 fixed_object_reg); | 2100 fixed_object_reg); |
2101 return MarkAsCall(DefineFixed(result, r0), instr); | 2101 return MarkAsCall(DefineFixed(result, r0), instr); |
2102 } | 2102 } |
2103 } | 2103 } |
2104 | 2104 |
2105 | 2105 |
2106 LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) { | 2106 LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) { |
2107 bool needs_write_barrier = instr->NeedsWriteBarrier(); | 2107 bool needs_write_barrier = instr->NeedsWriteBarrier(); |
| 2108 bool needs_write_barrier_for_map = !instr->transition().is_null() && |
| 2109 instr->NeedsWriteBarrierForMap(); |
2108 | 2110 |
2109 LOperand* obj = needs_write_barrier | 2111 LOperand* obj; |
2110 ? UseTempRegister(instr->object()) | 2112 if (needs_write_barrier) { |
2111 : UseRegisterAtStart(instr->object()); | 2113 obj = instr->is_in_object() |
| 2114 ? UseRegister(instr->object()) |
| 2115 : UseTempRegister(instr->object()); |
| 2116 } else { |
| 2117 obj = needs_write_barrier_for_map |
| 2118 ? UseRegister(instr->object()) |
| 2119 : UseRegisterAtStart(instr->object()); |
| 2120 } |
2112 | 2121 |
2113 LOperand* val = needs_write_barrier | 2122 LOperand* val = needs_write_barrier |
2114 ? UseTempRegister(instr->value()) | 2123 ? UseTempRegister(instr->value()) |
2115 : UseRegister(instr->value()); | 2124 : UseRegister(instr->value()); |
2116 | 2125 |
2117 return new(zone()) LStoreNamedField(obj, val); | 2126 // We need a temporary register for write barrier of the map field. |
| 2127 LOperand* temp = needs_write_barrier_for_map ? TempRegister() : NULL; |
| 2128 |
| 2129 return new(zone()) LStoreNamedField(obj, val, temp); |
2118 } | 2130 } |
2119 | 2131 |
2120 | 2132 |
2121 LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) { | 2133 LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) { |
2122 LOperand* obj = UseFixed(instr->object(), r1); | 2134 LOperand* obj = UseFixed(instr->object(), r1); |
2123 LOperand* val = UseFixed(instr->value(), r0); | 2135 LOperand* val = UseFixed(instr->value(), r0); |
2124 | 2136 |
2125 LInstruction* result = new(zone()) LStoreNamedGeneric(obj, val); | 2137 LInstruction* result = new(zone()) LStoreNamedGeneric(obj, val); |
2126 return MarkAsCall(result, instr); | 2138 return MarkAsCall(result, instr); |
2127 } | 2139 } |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2378 | 2390 |
2379 | 2391 |
2380 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2392 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2381 LOperand* object = UseRegister(instr->object()); | 2393 LOperand* object = UseRegister(instr->object()); |
2382 LOperand* index = UseRegister(instr->index()); | 2394 LOperand* index = UseRegister(instr->index()); |
2383 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2395 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
2384 } | 2396 } |
2385 | 2397 |
2386 | 2398 |
2387 } } // namespace v8::internal | 2399 } } // namespace v8::internal |
OLD | NEW |