| 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 2017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2028 return DefineAsRegister(new(zone()) LLoadExternalArrayPointer(input)); | 2028 return DefineAsRegister(new(zone()) LLoadExternalArrayPointer(input)); |
| 2029 } | 2029 } |
| 2030 | 2030 |
| 2031 | 2031 |
| 2032 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { | 2032 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { |
| 2033 ASSERT(instr->key()->representation().IsSmiOrInteger32()); | 2033 ASSERT(instr->key()->representation().IsSmiOrInteger32()); |
| 2034 ElementsKind elements_kind = instr->elements_kind(); | 2034 ElementsKind elements_kind = instr->elements_kind(); |
| 2035 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); | 2035 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
| 2036 LLoadKeyed* result = NULL; | 2036 LLoadKeyed* result = NULL; |
| 2037 | 2037 |
| 2038 if (!instr->is_external()) { | 2038 if (!instr->is_typed_elements()) { |
| 2039 LOperand* obj = NULL; | 2039 LOperand* obj = NULL; |
| 2040 if (instr->representation().IsDouble()) { | 2040 if (instr->representation().IsDouble()) { |
| 2041 obj = UseRegister(instr->elements()); | 2041 obj = UseRegister(instr->elements()); |
| 2042 } else { | 2042 } else { |
| 2043 ASSERT(instr->representation().IsSmiOrTagged()); | 2043 ASSERT(instr->representation().IsSmiOrTagged()); |
| 2044 obj = UseRegisterAtStart(instr->elements()); | 2044 obj = UseRegisterAtStart(instr->elements()); |
| 2045 } | 2045 } |
| 2046 result = new(zone()) LLoadKeyed(obj, key); | 2046 result = new(zone()) LLoadKeyed(obj, key); |
| 2047 } else { | 2047 } else { |
| 2048 ASSERT( | 2048 ASSERT( |
| 2049 (instr->representation().IsInteger32() && | 2049 (instr->representation().IsInteger32() && |
| 2050 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && | 2050 !IsDoubleOrFloatElementsKind(instr->elements_kind())) || |
| 2051 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || | |
| 2052 (instr->representation().IsDouble() && | 2051 (instr->representation().IsDouble() && |
| 2053 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || | 2052 IsDoubleOrFloatElementsKind(instr->elements_kind()))); |
| 2054 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); | 2053 LOperand* backing_store = UseRegister(instr->elements()); |
| 2055 LOperand* external_pointer = UseRegister(instr->elements()); | 2054 result = new(zone()) LLoadKeyed(backing_store, key); |
| 2056 result = new(zone()) LLoadKeyed(external_pointer, key); | |
| 2057 } | 2055 } |
| 2058 | 2056 |
| 2059 DefineAsRegister(result); | 2057 DefineAsRegister(result); |
| 2060 // An unsigned int array load might overflow and cause a deopt, make sure it | 2058 // An unsigned int array load might overflow and cause a deopt, make sure it |
| 2061 // has an environment. | 2059 // has an environment. |
| 2062 bool can_deoptimize = instr->RequiresHoleCheck() || | 2060 bool can_deoptimize = instr->RequiresHoleCheck() || |
| 2063 (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS); | 2061 elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS || |
| 2062 elements_kind == UINT32_ELEMENTS; |
| 2064 return can_deoptimize ? AssignEnvironment(result) : result; | 2063 return can_deoptimize ? AssignEnvironment(result) : result; |
| 2065 } | 2064 } |
| 2066 | 2065 |
| 2067 | 2066 |
| 2068 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { | 2067 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { |
| 2069 LOperand* context = UseFixed(instr->context(), cp); | 2068 LOperand* context = UseFixed(instr->context(), cp); |
| 2070 LOperand* object = UseFixed(instr->object(), a1); | 2069 LOperand* object = UseFixed(instr->object(), a1); |
| 2071 LOperand* key = UseFixed(instr->key(), a0); | 2070 LOperand* key = UseFixed(instr->key(), a0); |
| 2072 | 2071 |
| 2073 LInstruction* result = | 2072 LInstruction* result = |
| 2074 DefineFixed(new(zone()) LLoadKeyedGeneric(context, object, key), v0); | 2073 DefineFixed(new(zone()) LLoadKeyedGeneric(context, object, key), v0); |
| 2075 return MarkAsCall(result, instr); | 2074 return MarkAsCall(result, instr); |
| 2076 } | 2075 } |
| 2077 | 2076 |
| 2078 | 2077 |
| 2079 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { | 2078 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { |
| 2080 if (!instr->is_external()) { | 2079 if (!instr->is_typed_elements()) { |
| 2081 ASSERT(instr->elements()->representation().IsTagged()); | 2080 ASSERT(instr->elements()->representation().IsTagged()); |
| 2082 bool needs_write_barrier = instr->NeedsWriteBarrier(); | 2081 bool needs_write_barrier = instr->NeedsWriteBarrier(); |
| 2083 LOperand* object = NULL; | 2082 LOperand* object = NULL; |
| 2084 LOperand* val = NULL; | 2083 LOperand* val = NULL; |
| 2085 LOperand* key = NULL; | 2084 LOperand* key = NULL; |
| 2086 | 2085 |
| 2087 if (instr->value()->representation().IsDouble()) { | 2086 if (instr->value()->representation().IsDouble()) { |
| 2088 object = UseRegisterAtStart(instr->elements()); | 2087 object = UseRegisterAtStart(instr->elements()); |
| 2089 key = UseRegisterOrConstantAtStart(instr->key()); | 2088 key = UseRegisterOrConstantAtStart(instr->key()); |
| 2090 val = UseRegister(instr->value()); | 2089 val = UseRegister(instr->value()); |
| 2091 } else { | 2090 } else { |
| 2092 ASSERT(instr->value()->representation().IsSmiOrTagged()); | 2091 ASSERT(instr->value()->representation().IsSmiOrTagged()); |
| 2093 if (needs_write_barrier) { | 2092 if (needs_write_barrier) { |
| 2094 object = UseTempRegister(instr->elements()); | 2093 object = UseTempRegister(instr->elements()); |
| 2095 val = UseTempRegister(instr->value()); | 2094 val = UseTempRegister(instr->value()); |
| 2096 key = UseTempRegister(instr->key()); | 2095 key = UseTempRegister(instr->key()); |
| 2097 } else { | 2096 } else { |
| 2098 object = UseRegisterAtStart(instr->elements()); | 2097 object = UseRegisterAtStart(instr->elements()); |
| 2099 val = UseRegisterAtStart(instr->value()); | 2098 val = UseRegisterAtStart(instr->value()); |
| 2100 key = UseRegisterOrConstantAtStart(instr->key()); | 2099 key = UseRegisterOrConstantAtStart(instr->key()); |
| 2101 } | 2100 } |
| 2102 } | 2101 } |
| 2103 | 2102 |
| 2104 return new(zone()) LStoreKeyed(object, key, val); | 2103 return new(zone()) LStoreKeyed(object, key, val); |
| 2105 } | 2104 } |
| 2106 | 2105 |
| 2107 ASSERT( | 2106 ASSERT( |
| 2108 (instr->value()->representation().IsInteger32() && | 2107 (instr->value()->representation().IsInteger32() && |
| 2109 (instr->elements_kind() != EXTERNAL_FLOAT_ELEMENTS) && | 2108 !IsDoubleOrFloatElementsKind(instr->elements_kind())) || |
| 2110 (instr->elements_kind() != EXTERNAL_DOUBLE_ELEMENTS)) || | |
| 2111 (instr->value()->representation().IsDouble() && | 2109 (instr->value()->representation().IsDouble() && |
| 2112 ((instr->elements_kind() == EXTERNAL_FLOAT_ELEMENTS) || | 2110 IsDoubleOrFloatElementsKind(instr->elements_kind()))); |
| 2113 (instr->elements_kind() == EXTERNAL_DOUBLE_ELEMENTS)))); | 2111 ASSERT((instr->is_fixed_typed_array() && |
| 2114 ASSERT(instr->elements()->representation().IsExternal()); | 2112 instr->elements()->representation().IsTagged()) || |
| 2113 (instr->is_external() && |
| 2114 instr->elements()->representation().IsExternal())); |
| 2115 LOperand* val = UseRegister(instr->value()); | 2115 LOperand* val = UseRegister(instr->value()); |
| 2116 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); | 2116 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
| 2117 LOperand* external_pointer = UseRegister(instr->elements()); | 2117 LOperand* backing_store = UseRegister(instr->elements()); |
| 2118 | 2118 return new(zone()) LStoreKeyed(backing_store, key, val); |
| 2119 return new(zone()) LStoreKeyed(external_pointer, key, val); | |
| 2120 } | 2119 } |
| 2121 | 2120 |
| 2122 | 2121 |
| 2123 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { | 2122 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { |
| 2124 LOperand* context = UseFixed(instr->context(), cp); | 2123 LOperand* context = UseFixed(instr->context(), cp); |
| 2125 LOperand* obj = UseFixed(instr->object(), a2); | 2124 LOperand* obj = UseFixed(instr->object(), a2); |
| 2126 LOperand* key = UseFixed(instr->key(), a1); | 2125 LOperand* key = UseFixed(instr->key(), a1); |
| 2127 LOperand* val = UseFixed(instr->value(), a0); | 2126 LOperand* val = UseFixed(instr->value(), a0); |
| 2128 | 2127 |
| 2129 ASSERT(instr->object()->representation().IsTagged()); | 2128 ASSERT(instr->object()->representation().IsTagged()); |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2470 | 2469 |
| 2471 | 2470 |
| 2472 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2471 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2473 LOperand* object = UseRegister(instr->object()); | 2472 LOperand* object = UseRegister(instr->object()); |
| 2474 LOperand* index = UseRegister(instr->index()); | 2473 LOperand* index = UseRegister(instr->index()); |
| 2475 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2474 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
| 2476 } | 2475 } |
| 2477 | 2476 |
| 2478 | 2477 |
| 2479 } } // namespace v8::internal | 2478 } } // namespace v8::internal |
| OLD | NEW |