Chromium Code Reviews| 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 2112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2123 return DefineAsRegister(new(zone()) LLoadExternalArrayPointer(input)); | 2123 return DefineAsRegister(new(zone()) LLoadExternalArrayPointer(input)); |
| 2124 } | 2124 } |
| 2125 | 2125 |
| 2126 | 2126 |
| 2127 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { | 2127 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { |
| 2128 ASSERT(instr->key()->representation().IsSmiOrInteger32()); | 2128 ASSERT(instr->key()->representation().IsSmiOrInteger32()); |
| 2129 ElementsKind elements_kind = instr->elements_kind(); | 2129 ElementsKind elements_kind = instr->elements_kind(); |
| 2130 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); | 2130 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
| 2131 LLoadKeyed* result = NULL; | 2131 LLoadKeyed* result = NULL; |
| 2132 | 2132 |
| 2133 if (!instr->is_external()) { | 2133 if (!instr->is_external() && !instr->is_fixed_typed_array()) { |
| 2134 LOperand* obj = NULL; | 2134 LOperand* obj = NULL; |
| 2135 if (instr->representation().IsDouble()) { | 2135 if (instr->representation().IsDouble()) { |
| 2136 obj = UseRegister(instr->elements()); | 2136 obj = UseRegister(instr->elements()); |
| 2137 } else { | 2137 } else { |
| 2138 ASSERT(instr->representation().IsSmiOrTagged()); | 2138 ASSERT(instr->representation().IsSmiOrTagged()); |
| 2139 obj = UseRegisterAtStart(instr->elements()); | 2139 obj = UseRegisterAtStart(instr->elements()); |
| 2140 } | 2140 } |
| 2141 result = new(zone()) LLoadKeyed(obj, key); | 2141 result = new(zone()) LLoadKeyed(obj, key); |
| 2142 } else { | 2142 } else { |
| 2143 ASSERT( | 2143 ASSERT( |
| 2144 (instr->representation().IsInteger32() && | 2144 (instr->representation().IsInteger32() && |
| 2145 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && | 2145 !(IsDoubleOrFloatElementsKind(instr->elements_kind()))) || |
|
Toon Verwaest
2014/01/16 10:54:51
remove () around IsDouble...
Dmitry Lomov (no reviews)
2014/01/16 13:52:18
Done.
| |
| 2146 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || | |
| 2147 (instr->representation().IsDouble() && | 2146 (instr->representation().IsDouble() && |
| 2148 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || | 2147 (IsDoubleOrFloatElementsKind(instr->elements_kind())))); |
|
Toon Verwaest
2014/01/16 10:54:51
Remove () around IsDouble...
Dmitry Lomov (no reviews)
2014/01/16 13:52:18
Done.
| |
| 2149 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); | 2148 LOperand* backing_store = UseRegister(instr->elements()); |
| 2150 LOperand* external_pointer = UseRegister(instr->elements()); | 2149 result = new(zone()) LLoadKeyed(backing_store, key); |
| 2151 result = new(zone()) LLoadKeyed(external_pointer, key); | |
| 2152 } | 2150 } |
| 2153 | 2151 |
| 2154 DefineAsRegister(result); | 2152 DefineAsRegister(result); |
| 2155 // An unsigned int array load might overflow and cause a deopt, make sure it | 2153 // An unsigned int array load might overflow and cause a deopt, make sure it |
| 2156 // has an environment. | 2154 // has an environment. |
| 2157 bool can_deoptimize = instr->RequiresHoleCheck() || | 2155 bool can_deoptimize = instr->RequiresHoleCheck() || |
| 2158 (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS); | 2156 (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS) || |
|
Toon Verwaest
2014/01/16 10:54:51
remove ()
Dmitry Lomov (no reviews)
2014/01/16 13:52:18
Done.
| |
| 2157 (elements_kind == UINT32_ELEMENTS); | |
| 2159 return can_deoptimize ? AssignEnvironment(result) : result; | 2158 return can_deoptimize ? AssignEnvironment(result) : result; |
| 2160 } | 2159 } |
| 2161 | 2160 |
| 2162 | 2161 |
| 2163 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { | 2162 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { |
| 2164 LOperand* context = UseFixed(instr->context(), cp); | 2163 LOperand* context = UseFixed(instr->context(), cp); |
| 2165 LOperand* object = UseFixed(instr->object(), r1); | 2164 LOperand* object = UseFixed(instr->object(), r1); |
| 2166 LOperand* key = UseFixed(instr->key(), r0); | 2165 LOperand* key = UseFixed(instr->key(), r0); |
| 2167 | 2166 |
| 2168 LInstruction* result = | 2167 LInstruction* result = |
| 2169 DefineFixed(new(zone()) LLoadKeyedGeneric(context, object, key), r0); | 2168 DefineFixed(new(zone()) LLoadKeyedGeneric(context, object, key), r0); |
| 2170 return MarkAsCall(result, instr); | 2169 return MarkAsCall(result, instr); |
| 2171 } | 2170 } |
| 2172 | 2171 |
| 2173 | 2172 |
| 2174 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { | 2173 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { |
| 2175 if (!instr->is_external()) { | 2174 if (!instr->is_external() && !instr->is_fixed_typed_array()) { |
| 2176 ASSERT(instr->elements()->representation().IsTagged()); | 2175 ASSERT(instr->elements()->representation().IsTagged()); |
| 2177 bool needs_write_barrier = instr->NeedsWriteBarrier(); | 2176 bool needs_write_barrier = instr->NeedsWriteBarrier(); |
| 2178 LOperand* object = NULL; | 2177 LOperand* object = NULL; |
| 2179 LOperand* key = NULL; | 2178 LOperand* key = NULL; |
| 2180 LOperand* val = NULL; | 2179 LOperand* val = NULL; |
| 2181 | 2180 |
| 2182 if (instr->value()->representation().IsDouble()) { | 2181 if (instr->value()->representation().IsDouble()) { |
| 2183 object = UseRegisterAtStart(instr->elements()); | 2182 object = UseRegisterAtStart(instr->elements()); |
| 2184 val = UseRegister(instr->value()); | 2183 val = UseRegister(instr->value()); |
| 2185 key = UseRegisterOrConstantAtStart(instr->key()); | 2184 key = UseRegisterOrConstantAtStart(instr->key()); |
| 2186 } else { | 2185 } else { |
| 2187 ASSERT(instr->value()->representation().IsSmiOrTagged()); | 2186 ASSERT(instr->value()->representation().IsSmiOrTagged()); |
| 2188 if (needs_write_barrier) { | 2187 if (needs_write_barrier) { |
| 2189 object = UseTempRegister(instr->elements()); | 2188 object = UseTempRegister(instr->elements()); |
| 2190 val = UseTempRegister(instr->value()); | 2189 val = UseTempRegister(instr->value()); |
| 2191 key = UseTempRegister(instr->key()); | 2190 key = UseTempRegister(instr->key()); |
| 2192 } else { | 2191 } else { |
| 2193 object = UseRegisterAtStart(instr->elements()); | 2192 object = UseRegisterAtStart(instr->elements()); |
| 2194 val = UseRegisterAtStart(instr->value()); | 2193 val = UseRegisterAtStart(instr->value()); |
| 2195 key = UseRegisterOrConstantAtStart(instr->key()); | 2194 key = UseRegisterOrConstantAtStart(instr->key()); |
| 2196 } | 2195 } |
| 2197 } | 2196 } |
| 2198 | 2197 |
| 2199 return new(zone()) LStoreKeyed(object, key, val); | 2198 return new(zone()) LStoreKeyed(object, key, val); |
| 2200 } | 2199 } |
| 2201 | 2200 |
| 2202 ASSERT( | 2201 ASSERT( |
| 2203 (instr->value()->representation().IsInteger32() && | 2202 (instr->value()->representation().IsInteger32() && |
| 2204 (instr->elements_kind() != EXTERNAL_FLOAT_ELEMENTS) && | 2203 !IsDoubleOrFloatElementsKind(instr->elements_kind())) || |
| 2205 (instr->elements_kind() != EXTERNAL_DOUBLE_ELEMENTS)) || | |
| 2206 (instr->value()->representation().IsDouble() && | 2204 (instr->value()->representation().IsDouble() && |
| 2207 ((instr->elements_kind() == EXTERNAL_FLOAT_ELEMENTS) || | 2205 IsDoubleOrFloatElementsKind(instr->elements_kind()))); |
| 2208 (instr->elements_kind() == EXTERNAL_DOUBLE_ELEMENTS)))); | 2206 ASSERT((instr->is_fixed_typed_array() && |
| 2209 ASSERT(instr->elements()->representation().IsExternal()); | 2207 instr->elements()->representation().IsTagged()) || |
| 2208 (instr->is_external() && | |
| 2209 instr->elements()->representation().IsExternal())); | |
| 2210 LOperand* val = UseRegister(instr->value()); | 2210 LOperand* val = UseRegister(instr->value()); |
| 2211 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); | 2211 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
| 2212 LOperand* external_pointer = UseRegister(instr->elements()); | 2212 LOperand* backing_store = UseRegister(instr->elements()); |
| 2213 return new(zone()) LStoreKeyed(external_pointer, key, val); | 2213 return new(zone()) LStoreKeyed(backing_store, key, val); |
| 2214 } | 2214 } |
| 2215 | 2215 |
| 2216 | 2216 |
| 2217 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { | 2217 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { |
| 2218 LOperand* context = UseFixed(instr->context(), cp); | 2218 LOperand* context = UseFixed(instr->context(), cp); |
| 2219 LOperand* obj = UseFixed(instr->object(), r2); | 2219 LOperand* obj = UseFixed(instr->object(), r2); |
| 2220 LOperand* key = UseFixed(instr->key(), r1); | 2220 LOperand* key = UseFixed(instr->key(), r1); |
| 2221 LOperand* val = UseFixed(instr->value(), r0); | 2221 LOperand* val = UseFixed(instr->value(), r0); |
| 2222 | 2222 |
| 2223 ASSERT(instr->object()->representation().IsTagged()); | 2223 ASSERT(instr->object()->representation().IsTagged()); |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2564 } | 2564 } |
| 2565 | 2565 |
| 2566 | 2566 |
| 2567 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2567 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2568 LOperand* object = UseRegister(instr->object()); | 2568 LOperand* object = UseRegister(instr->object()); |
| 2569 LOperand* index = UseRegister(instr->index()); | 2569 LOperand* index = UseRegister(instr->index()); |
| 2570 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2570 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
| 2571 } | 2571 } |
| 2572 | 2572 |
| 2573 } } // namespace v8::internal | 2573 } } // namespace v8::internal |
| OLD | NEW |