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 2018 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2029 new(zone()) LTransitionElementsKind(object, | 2029 new(zone()) LTransitionElementsKind(object, |
2030 new_map_reg, | 2030 new_map_reg, |
2031 fixed_object_reg); | 2031 fixed_object_reg); |
2032 return MarkAsCall(DefineFixed(result, rax), instr); | 2032 return MarkAsCall(DefineFixed(result, rax), instr); |
2033 } | 2033 } |
2034 } | 2034 } |
2035 | 2035 |
2036 | 2036 |
2037 LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) { | 2037 LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) { |
2038 bool needs_write_barrier = instr->NeedsWriteBarrier(); | 2038 bool needs_write_barrier = instr->NeedsWriteBarrier(); |
2039 bool needs_write_barrier_for_map = !instr->transition().is_null() && | |
2040 instr->NeedsWriteBarrierForMap(); | |
2039 | 2041 |
2040 LOperand* obj = needs_write_barrier | 2042 LOperand* obj; |
2041 ? UseTempRegister(instr->object()) | 2043 if (needs_write_barrier) { |
2042 : UseRegisterAtStart(instr->object()); | 2044 obj = instr->is_in_object() |
2045 ? UseRegister(instr->object()) | |
2046 : UseTempRegister(instr->object()); | |
Vyacheslav Egorov (Google)
2012/05/29 15:09:26
I don't think it has to be temp anymore. RecordWri
Michael Starzinger
2012/05/29 16:35:49
See response to previous comment.
| |
2047 } else { | |
2048 obj = needs_write_barrier_for_map | |
2049 ? UseRegister(instr->object()) | |
2050 : UseRegisterAtStart(instr->object()); | |
2051 } | |
2043 | 2052 |
2044 LOperand* val = needs_write_barrier | 2053 LOperand* val = needs_write_barrier |
2045 ? UseTempRegister(instr->value()) | 2054 ? UseTempRegister(instr->value()) |
2046 : UseRegister(instr->value()); | 2055 : UseRegister(instr->value()); |
2047 | 2056 |
2048 // We only need a scratch register if we have a write barrier or we | 2057 // We only need a scratch register if we have a write barrier or we |
2049 // have a store into the properties array (not in-object-property). | 2058 // have a store into the properties array (not in-object-property). |
2050 LOperand* temp = (!instr->is_in_object() || needs_write_barrier) | 2059 LOperand* temp = (!instr->is_in_object() || needs_write_barrier || |
Vyacheslav Egorov (Google)
2012/05/29 15:09:26
I wonder if we can use designated scratch kScratch
Michael Starzinger
2012/05/29 16:35:49
Done.
| |
2051 ? TempRegister() : NULL; | 2060 needs_write_barrier_for_map) ? TempRegister() : NULL; |
2052 | 2061 |
2053 return new(zone()) LStoreNamedField(obj, val, temp); | 2062 // We need a temporary register for write barrier of the map field. |
2063 LOperand* temp_map = needs_write_barrier_for_map ? TempRegister() : NULL; | |
2064 | |
2065 return new(zone()) LStoreNamedField(obj, val, temp, temp_map); | |
2054 } | 2066 } |
2055 | 2067 |
2056 | 2068 |
2057 LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) { | 2069 LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) { |
2058 LOperand* object = UseFixed(instr->object(), rdx); | 2070 LOperand* object = UseFixed(instr->object(), rdx); |
2059 LOperand* value = UseFixed(instr->value(), rax); | 2071 LOperand* value = UseFixed(instr->value(), rax); |
2060 | 2072 |
2061 LStoreNamedGeneric* result = new(zone()) LStoreNamedGeneric(object, value); | 2073 LStoreNamedGeneric* result = new(zone()) LStoreNamedGeneric(object, value); |
2062 return MarkAsCall(result, instr); | 2074 return MarkAsCall(result, instr); |
2063 } | 2075 } |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2316 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2328 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2317 LOperand* object = UseRegister(instr->object()); | 2329 LOperand* object = UseRegister(instr->object()); |
2318 LOperand* index = UseTempRegister(instr->index()); | 2330 LOperand* index = UseTempRegister(instr->index()); |
2319 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2331 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
2320 } | 2332 } |
2321 | 2333 |
2322 | 2334 |
2323 } } // namespace v8::internal | 2335 } } // namespace v8::internal |
2324 | 2336 |
2325 #endif // V8_TARGET_ARCH_X64 | 2337 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |