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 2092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2103 return DefineAsRegister(new(zone()) LLoadExternalArrayPointer(input)); | 2103 return DefineAsRegister(new(zone()) LLoadExternalArrayPointer(input)); |
2104 } | 2104 } |
2105 | 2105 |
2106 | 2106 |
2107 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { | 2107 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { |
2108 ASSERT(instr->key()->representation().IsSmiOrInteger32()); | 2108 ASSERT(instr->key()->representation().IsSmiOrInteger32()); |
2109 ElementsKind elements_kind = instr->elements_kind(); | 2109 ElementsKind elements_kind = instr->elements_kind(); |
2110 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); | 2110 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
2111 LLoadKeyed* result = NULL; | 2111 LLoadKeyed* result = NULL; |
2112 | 2112 |
2113 if (!instr->is_typed_elements()) { | 2113 if (!instr->is_external()) { |
2114 LOperand* obj = NULL; | 2114 LOperand* obj = NULL; |
2115 if (instr->representation().IsDouble()) { | 2115 if (instr->representation().IsDouble()) { |
2116 obj = UseRegister(instr->elements()); | 2116 obj = UseRegister(instr->elements()); |
2117 } else { | 2117 } else { |
2118 ASSERT(instr->representation().IsSmiOrTagged()); | 2118 ASSERT(instr->representation().IsSmiOrTagged()); |
2119 obj = UseRegisterAtStart(instr->elements()); | 2119 obj = UseRegisterAtStart(instr->elements()); |
2120 } | 2120 } |
2121 result = new(zone()) LLoadKeyed(obj, key); | 2121 result = new(zone()) LLoadKeyed(obj, key); |
2122 } else { | 2122 } else { |
2123 ASSERT( | 2123 ASSERT( |
2124 (instr->representation().IsInteger32() && | 2124 (instr->representation().IsInteger32() && |
2125 !IsDoubleOrFloatElementsKind(instr->elements_kind())) || | 2125 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && |
| 2126 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || |
2126 (instr->representation().IsDouble() && | 2127 (instr->representation().IsDouble() && |
2127 IsDoubleOrFloatElementsKind(instr->elements_kind()))); | 2128 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || |
2128 LOperand* backing_store = UseRegister(instr->elements()); | 2129 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); |
2129 result = new(zone()) LLoadKeyed(backing_store, key); | 2130 LOperand* external_pointer = UseRegister(instr->elements()); |
| 2131 result = new(zone()) LLoadKeyed(external_pointer, key); |
2130 } | 2132 } |
2131 | 2133 |
2132 DefineAsRegister(result); | 2134 DefineAsRegister(result); |
2133 // An unsigned int array load might overflow and cause a deopt, make sure it | 2135 // An unsigned int array load might overflow and cause a deopt, make sure it |
2134 // has an environment. | 2136 // has an environment. |
2135 bool can_deoptimize = instr->RequiresHoleCheck() || | 2137 bool can_deoptimize = instr->RequiresHoleCheck() || |
2136 elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS || | 2138 (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS); |
2137 elements_kind == UINT32_ELEMENTS; | |
2138 return can_deoptimize ? AssignEnvironment(result) : result; | 2139 return can_deoptimize ? AssignEnvironment(result) : result; |
2139 } | 2140 } |
2140 | 2141 |
2141 | 2142 |
2142 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { | 2143 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { |
2143 LOperand* context = UseFixed(instr->context(), cp); | 2144 LOperand* context = UseFixed(instr->context(), cp); |
2144 LOperand* object = UseFixed(instr->object(), r1); | 2145 LOperand* object = UseFixed(instr->object(), r1); |
2145 LOperand* key = UseFixed(instr->key(), r0); | 2146 LOperand* key = UseFixed(instr->key(), r0); |
2146 | 2147 |
2147 LInstruction* result = | 2148 LInstruction* result = |
2148 DefineFixed(new(zone()) LLoadKeyedGeneric(context, object, key), r0); | 2149 DefineFixed(new(zone()) LLoadKeyedGeneric(context, object, key), r0); |
2149 return MarkAsCall(result, instr); | 2150 return MarkAsCall(result, instr); |
2150 } | 2151 } |
2151 | 2152 |
2152 | 2153 |
2153 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { | 2154 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { |
2154 if (!instr->is_typed_elements()) { | 2155 if (!instr->is_external()) { |
2155 ASSERT(instr->elements()->representation().IsTagged()); | 2156 ASSERT(instr->elements()->representation().IsTagged()); |
2156 bool needs_write_barrier = instr->NeedsWriteBarrier(); | 2157 bool needs_write_barrier = instr->NeedsWriteBarrier(); |
2157 LOperand* object = NULL; | 2158 LOperand* object = NULL; |
2158 LOperand* key = NULL; | 2159 LOperand* key = NULL; |
2159 LOperand* val = NULL; | 2160 LOperand* val = NULL; |
2160 | 2161 |
2161 if (instr->value()->representation().IsDouble()) { | 2162 if (instr->value()->representation().IsDouble()) { |
2162 object = UseRegisterAtStart(instr->elements()); | 2163 object = UseRegisterAtStart(instr->elements()); |
2163 val = UseRegister(instr->value()); | 2164 val = UseRegister(instr->value()); |
2164 key = UseRegisterOrConstantAtStart(instr->key()); | 2165 key = UseRegisterOrConstantAtStart(instr->key()); |
2165 } else { | 2166 } else { |
2166 ASSERT(instr->value()->representation().IsSmiOrTagged()); | 2167 ASSERT(instr->value()->representation().IsSmiOrTagged()); |
2167 if (needs_write_barrier) { | 2168 if (needs_write_barrier) { |
2168 object = UseTempRegister(instr->elements()); | 2169 object = UseTempRegister(instr->elements()); |
2169 val = UseTempRegister(instr->value()); | 2170 val = UseTempRegister(instr->value()); |
2170 key = UseTempRegister(instr->key()); | 2171 key = UseTempRegister(instr->key()); |
2171 } else { | 2172 } else { |
2172 object = UseRegisterAtStart(instr->elements()); | 2173 object = UseRegisterAtStart(instr->elements()); |
2173 val = UseRegisterAtStart(instr->value()); | 2174 val = UseRegisterAtStart(instr->value()); |
2174 key = UseRegisterOrConstantAtStart(instr->key()); | 2175 key = UseRegisterOrConstantAtStart(instr->key()); |
2175 } | 2176 } |
2176 } | 2177 } |
2177 | 2178 |
2178 return new(zone()) LStoreKeyed(object, key, val); | 2179 return new(zone()) LStoreKeyed(object, key, val); |
2179 } | 2180 } |
2180 | 2181 |
2181 ASSERT( | 2182 ASSERT( |
2182 (instr->value()->representation().IsInteger32() && | 2183 (instr->value()->representation().IsInteger32() && |
2183 !IsDoubleOrFloatElementsKind(instr->elements_kind())) || | 2184 (instr->elements_kind() != EXTERNAL_FLOAT_ELEMENTS) && |
| 2185 (instr->elements_kind() != EXTERNAL_DOUBLE_ELEMENTS)) || |
2184 (instr->value()->representation().IsDouble() && | 2186 (instr->value()->representation().IsDouble() && |
2185 IsDoubleOrFloatElementsKind(instr->elements_kind()))); | 2187 ((instr->elements_kind() == EXTERNAL_FLOAT_ELEMENTS) || |
2186 ASSERT((instr->is_fixed_typed_array() && | 2188 (instr->elements_kind() == EXTERNAL_DOUBLE_ELEMENTS)))); |
2187 instr->elements()->representation().IsTagged()) || | 2189 ASSERT(instr->elements()->representation().IsExternal()); |
2188 (instr->is_external() && | |
2189 instr->elements()->representation().IsExternal())); | |
2190 LOperand* val = UseRegister(instr->value()); | 2190 LOperand* val = UseRegister(instr->value()); |
2191 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); | 2191 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
2192 LOperand* backing_store = UseRegister(instr->elements()); | 2192 LOperand* external_pointer = UseRegister(instr->elements()); |
2193 return new(zone()) LStoreKeyed(backing_store, key, val); | 2193 return new(zone()) LStoreKeyed(external_pointer, key, val); |
2194 } | 2194 } |
2195 | 2195 |
2196 | 2196 |
2197 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { | 2197 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { |
2198 LOperand* context = UseFixed(instr->context(), cp); | 2198 LOperand* context = UseFixed(instr->context(), cp); |
2199 LOperand* obj = UseFixed(instr->object(), r2); | 2199 LOperand* obj = UseFixed(instr->object(), r2); |
2200 LOperand* key = UseFixed(instr->key(), r1); | 2200 LOperand* key = UseFixed(instr->key(), r1); |
2201 LOperand* val = UseFixed(instr->value(), r0); | 2201 LOperand* val = UseFixed(instr->value(), r0); |
2202 | 2202 |
2203 ASSERT(instr->object()->representation().IsTagged()); | 2203 ASSERT(instr->object()->representation().IsTagged()); |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2543 } | 2543 } |
2544 | 2544 |
2545 | 2545 |
2546 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2546 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2547 LOperand* object = UseRegister(instr->object()); | 2547 LOperand* object = UseRegister(instr->object()); |
2548 LOperand* index = UseRegister(instr->index()); | 2548 LOperand* index = UseRegister(instr->index()); |
2549 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2549 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
2550 } | 2550 } |
2551 | 2551 |
2552 } } // namespace v8::internal | 2552 } } // namespace v8::internal |
OLD | NEW |