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 2028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2039 new(zone()) LTransitionElementsKind(object, | 2039 new(zone()) LTransitionElementsKind(object, |
2040 new_map_reg, | 2040 new_map_reg, |
2041 fixed_object_reg); | 2041 fixed_object_reg); |
2042 return MarkAsCall(DefineFixed(result, v0), instr); | 2042 return MarkAsCall(DefineFixed(result, v0), instr); |
2043 } | 2043 } |
2044 } | 2044 } |
2045 | 2045 |
2046 | 2046 |
2047 LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) { | 2047 LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) { |
2048 bool needs_write_barrier = instr->NeedsWriteBarrier(); | 2048 bool needs_write_barrier = instr->NeedsWriteBarrier(); |
| 2049 bool needs_write_barrier_for_map = !instr->transition().is_null() && |
| 2050 instr->NeedsWriteBarrierForMap(); |
2049 | 2051 |
2050 LOperand* obj = needs_write_barrier | 2052 LOperand* obj; |
2051 ? UseTempRegister(instr->object()) | 2053 if (needs_write_barrier) { |
2052 : UseRegisterAtStart(instr->object()); | 2054 obj = instr->is_in_object() |
| 2055 ? UseRegister(instr->object()) |
| 2056 : UseTempRegister(instr->object()); |
| 2057 } else { |
| 2058 obj = needs_write_barrier_for_map |
| 2059 ? UseRegister(instr->object()) |
| 2060 : UseRegisterAtStart(instr->object()); |
| 2061 } |
2053 | 2062 |
2054 LOperand* val = needs_write_barrier | 2063 LOperand* val = needs_write_barrier |
2055 ? UseTempRegister(instr->value()) | 2064 ? UseTempRegister(instr->value()) |
2056 : UseRegister(instr->value()); | 2065 : UseRegister(instr->value()); |
2057 | 2066 |
2058 return new(zone()) LStoreNamedField(obj, val); | 2067 // We need a temporary register for write barrier of the map field. |
| 2068 LOperand* temp = needs_write_barrier_for_map ? TempRegister() : NULL; |
| 2069 |
| 2070 return new(zone()) LStoreNamedField(obj, val, temp); |
2059 } | 2071 } |
2060 | 2072 |
2061 | 2073 |
2062 LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) { | 2074 LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) { |
2063 LOperand* obj = UseFixed(instr->object(), a1); | 2075 LOperand* obj = UseFixed(instr->object(), a1); |
2064 LOperand* val = UseFixed(instr->value(), a0); | 2076 LOperand* val = UseFixed(instr->value(), a0); |
2065 | 2077 |
2066 LInstruction* result = new(zone()) LStoreNamedGeneric(obj, val); | 2078 LInstruction* result = new(zone()) LStoreNamedGeneric(obj, val); |
2067 return MarkAsCall(result, instr); | 2079 return MarkAsCall(result, instr); |
2068 } | 2080 } |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2320 | 2332 |
2321 | 2333 |
2322 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2334 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2323 LOperand* object = UseRegister(instr->object()); | 2335 LOperand* object = UseRegister(instr->object()); |
2324 LOperand* index = UseRegister(instr->index()); | 2336 LOperand* index = UseRegister(instr->index()); |
2325 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2337 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
2326 } | 2338 } |
2327 | 2339 |
2328 | 2340 |
2329 } } // namespace v8::internal | 2341 } } // namespace v8::internal |
OLD | NEW |