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 2107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2118 LOperand* object = UseFixed(instr->object(), a1); | 2118 LOperand* object = UseFixed(instr->object(), a1); |
2119 LOperand* key = UseFixed(instr->key(), a0); | 2119 LOperand* key = UseFixed(instr->key(), a0); |
2120 | 2120 |
2121 LInstruction* result = | 2121 LInstruction* result = |
2122 DefineFixed(new(zone()) LLoadKeyedGeneric(object, key), v0); | 2122 DefineFixed(new(zone()) LLoadKeyedGeneric(object, key), v0); |
2123 return MarkAsCall(result, instr); | 2123 return MarkAsCall(result, instr); |
2124 } | 2124 } |
2125 | 2125 |
2126 | 2126 |
2127 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { | 2127 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { |
2128 ElementsKind elements_kind = instr->elements_kind(); | |
2129 | |
2130 if (!instr->is_external()) { | 2128 if (!instr->is_external()) { |
2131 ASSERT(instr->elements()->representation().IsTagged()); | 2129 ASSERT(instr->elements()->representation().IsTagged()); |
2132 bool needs_write_barrier = instr->NeedsWriteBarrier(); | 2130 bool needs_write_barrier = instr->NeedsWriteBarrier(); |
2133 LOperand* object = NULL; | 2131 LOperand* object = NULL; |
2134 LOperand* val = NULL; | 2132 LOperand* val = NULL; |
2135 LOperand* key = NULL; | 2133 LOperand* key = NULL; |
2136 | 2134 |
2137 if (instr->value()->representation().IsDouble()) { | 2135 if (instr->value()->representation().IsDouble()) { |
2138 object = UseRegisterAtStart(instr->elements()); | 2136 object = UseRegisterAtStart(instr->elements()); |
2139 key = UseRegisterOrConstantAtStart(instr->key()); | 2137 key = UseRegisterOrConstantAtStart(instr->key()); |
2140 val = UseTempRegister(instr->value()); | 2138 val = UseRegister(instr->value()); |
2141 } else { | 2139 } else { |
2142 ASSERT(instr->value()->representation().IsSmiOrTagged()); | 2140 ASSERT(instr->value()->representation().IsSmiOrTagged()); |
2143 object = UseTempRegister(instr->elements()); | 2141 if (needs_write_barrier) { |
2144 val = needs_write_barrier ? UseTempRegister(instr->value()) | 2142 object = UseTempRegister(instr->elements()); |
2145 : UseRegisterAtStart(instr->value()); | 2143 val = UseTempRegister(instr->value()); |
2146 key = needs_write_barrier ? UseTempRegister(instr->key()) | 2144 key = UseTempRegister(instr->key()); |
2147 : UseRegisterOrConstantAtStart(instr->key()); | 2145 } else { |
| 2146 object = UseRegisterAtStart(instr->elements()); |
| 2147 val = UseRegisterAtStart(instr->value()); |
| 2148 key = UseRegisterOrConstantAtStart(instr->key()); |
| 2149 } |
2148 } | 2150 } |
2149 | 2151 |
2150 return new(zone()) LStoreKeyed(object, key, val); | 2152 return new(zone()) LStoreKeyed(object, key, val); |
2151 } | 2153 } |
2152 | 2154 |
2153 ASSERT( | 2155 ASSERT( |
2154 (instr->value()->representation().IsInteger32() && | 2156 (instr->value()->representation().IsInteger32() && |
2155 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && | 2157 (instr->elements_kind() != EXTERNAL_FLOAT_ELEMENTS) && |
2156 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || | 2158 (instr->elements_kind() != EXTERNAL_DOUBLE_ELEMENTS)) || |
2157 (instr->value()->representation().IsDouble() && | 2159 (instr->value()->representation().IsDouble() && |
2158 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || | 2160 ((instr->elements_kind() == EXTERNAL_FLOAT_ELEMENTS) || |
2159 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); | 2161 (instr->elements_kind() == EXTERNAL_DOUBLE_ELEMENTS)))); |
2160 ASSERT(instr->elements()->representation().IsExternal()); | 2162 ASSERT(instr->elements()->representation().IsExternal()); |
2161 bool val_is_temp_register = | 2163 LOperand* val = UseRegister(instr->value()); |
2162 elements_kind == EXTERNAL_PIXEL_ELEMENTS || | |
2163 elements_kind == EXTERNAL_FLOAT_ELEMENTS; | |
2164 LOperand* val = val_is_temp_register ? UseTempRegister(instr->value()) | |
2165 : UseRegister(instr->value()); | |
2166 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); | 2164 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
2167 LOperand* external_pointer = UseRegister(instr->elements()); | 2165 LOperand* external_pointer = UseRegister(instr->elements()); |
2168 | 2166 |
2169 return new(zone()) LStoreKeyed(external_pointer, key, val); | 2167 return new(zone()) LStoreKeyed(external_pointer, key, val); |
2170 } | 2168 } |
2171 | 2169 |
2172 | 2170 |
2173 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { | 2171 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { |
2174 LOperand* obj = UseFixed(instr->object(), a2); | 2172 LOperand* obj = UseFixed(instr->object(), a2); |
2175 LOperand* key = UseFixed(instr->key(), a1); | 2173 LOperand* key = UseFixed(instr->key(), a1); |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2501 | 2499 |
2502 | 2500 |
2503 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2501 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2504 LOperand* object = UseRegister(instr->object()); | 2502 LOperand* object = UseRegister(instr->object()); |
2505 LOperand* index = UseRegister(instr->index()); | 2503 LOperand* index = UseRegister(instr->index()); |
2506 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2504 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
2507 } | 2505 } |
2508 | 2506 |
2509 | 2507 |
2510 } } // namespace v8::internal | 2508 } } // namespace v8::internal |
OLD | NEW |