| 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 1944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1955 LInstruction* LChunkBuilder::DoStoreGlobalCell(HStoreGlobalCell* instr) { | 1955 LInstruction* LChunkBuilder::DoStoreGlobalCell(HStoreGlobalCell* instr) { |
| 1956 LOperand* value = UseRegister(instr->value()); | 1956 LOperand* value = UseRegister(instr->value()); |
| 1957 // Use a temp to check the value in the cell in the case where we perform | 1957 // Use a temp to check the value in the cell in the case where we perform |
| 1958 // a hole check. | 1958 // a hole check. |
| 1959 return instr->RequiresHoleCheck() | 1959 return instr->RequiresHoleCheck() |
| 1960 ? AssignEnvironment(new(zone()) LStoreGlobalCell(value, TempRegister())) | 1960 ? AssignEnvironment(new(zone()) LStoreGlobalCell(value, TempRegister())) |
| 1961 : new(zone()) LStoreGlobalCell(value, NULL); | 1961 : new(zone()) LStoreGlobalCell(value, NULL); |
| 1962 } | 1962 } |
| 1963 | 1963 |
| 1964 | 1964 |
| 1965 LInstruction* LChunkBuilder::DoStoreGlobalGeneric(HStoreGlobalGeneric* instr) { | |
| 1966 LOperand* context = UseFixed(instr->context(), cp); | |
| 1967 LOperand* global_object = UseFixed(instr->global_object(), a1); | |
| 1968 LOperand* value = UseFixed(instr->value(), a0); | |
| 1969 LStoreGlobalGeneric* result = | |
| 1970 new(zone()) LStoreGlobalGeneric(context, global_object, value); | |
| 1971 return MarkAsCall(result, instr); | |
| 1972 } | |
| 1973 | |
| 1974 | |
| 1975 LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) { | 1965 LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) { |
| 1976 LOperand* context = UseRegisterAtStart(instr->value()); | 1966 LOperand* context = UseRegisterAtStart(instr->value()); |
| 1977 LInstruction* result = | 1967 LInstruction* result = |
| 1978 DefineAsRegister(new(zone()) LLoadContextSlot(context)); | 1968 DefineAsRegister(new(zone()) LLoadContextSlot(context)); |
| 1979 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result; | 1969 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result; |
| 1980 } | 1970 } |
| 1981 | 1971 |
| 1982 | 1972 |
| 1983 LInstruction* LChunkBuilder::DoStoreContextSlot(HStoreContextSlot* instr) { | 1973 LInstruction* LChunkBuilder::DoStoreContextSlot(HStoreContextSlot* instr) { |
| 1984 LOperand* context; | 1974 LOperand* context; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2028 return DefineAsRegister(new(zone()) LLoadExternalArrayPointer(input)); | 2018 return DefineAsRegister(new(zone()) LLoadExternalArrayPointer(input)); |
| 2029 } | 2019 } |
| 2030 | 2020 |
| 2031 | 2021 |
| 2032 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { | 2022 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { |
| 2033 ASSERT(instr->key()->representation().IsSmiOrInteger32()); | 2023 ASSERT(instr->key()->representation().IsSmiOrInteger32()); |
| 2034 ElementsKind elements_kind = instr->elements_kind(); | 2024 ElementsKind elements_kind = instr->elements_kind(); |
| 2035 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); | 2025 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
| 2036 LLoadKeyed* result = NULL; | 2026 LLoadKeyed* result = NULL; |
| 2037 | 2027 |
| 2038 if (!instr->is_external()) { | 2028 if (!instr->is_typed_elements()) { |
| 2039 LOperand* obj = NULL; | 2029 LOperand* obj = NULL; |
| 2040 if (instr->representation().IsDouble()) { | 2030 if (instr->representation().IsDouble()) { |
| 2041 obj = UseRegister(instr->elements()); | 2031 obj = UseRegister(instr->elements()); |
| 2042 } else { | 2032 } else { |
| 2043 ASSERT(instr->representation().IsSmiOrTagged()); | 2033 ASSERT(instr->representation().IsSmiOrTagged()); |
| 2044 obj = UseRegisterAtStart(instr->elements()); | 2034 obj = UseRegisterAtStart(instr->elements()); |
| 2045 } | 2035 } |
| 2046 result = new(zone()) LLoadKeyed(obj, key); | 2036 result = new(zone()) LLoadKeyed(obj, key); |
| 2047 } else { | 2037 } else { |
| 2048 ASSERT( | 2038 ASSERT( |
| 2049 (instr->representation().IsInteger32() && | 2039 (instr->representation().IsInteger32() && |
| 2050 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && | 2040 !IsDoubleOrFloatElementsKind(instr->elements_kind())) || |
| 2051 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || | |
| 2052 (instr->representation().IsDouble() && | 2041 (instr->representation().IsDouble() && |
| 2053 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || | 2042 IsDoubleOrFloatElementsKind(instr->elements_kind()))); |
| 2054 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); | 2043 LOperand* backing_store = UseRegister(instr->elements()); |
| 2055 LOperand* external_pointer = UseRegister(instr->elements()); | 2044 result = new(zone()) LLoadKeyed(backing_store, key); |
| 2056 result = new(zone()) LLoadKeyed(external_pointer, key); | |
| 2057 } | 2045 } |
| 2058 | 2046 |
| 2059 DefineAsRegister(result); | 2047 DefineAsRegister(result); |
| 2060 // An unsigned int array load might overflow and cause a deopt, make sure it | 2048 // An unsigned int array load might overflow and cause a deopt, make sure it |
| 2061 // has an environment. | 2049 // has an environment. |
| 2062 bool can_deoptimize = instr->RequiresHoleCheck() || | 2050 bool can_deoptimize = instr->RequiresHoleCheck() || |
| 2063 (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS); | 2051 elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS || |
| 2052 elements_kind == UINT32_ELEMENTS; |
| 2064 return can_deoptimize ? AssignEnvironment(result) : result; | 2053 return can_deoptimize ? AssignEnvironment(result) : result; |
| 2065 } | 2054 } |
| 2066 | 2055 |
| 2067 | 2056 |
| 2068 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { | 2057 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { |
| 2069 LOperand* context = UseFixed(instr->context(), cp); | 2058 LOperand* context = UseFixed(instr->context(), cp); |
| 2070 LOperand* object = UseFixed(instr->object(), a1); | 2059 LOperand* object = UseFixed(instr->object(), a1); |
| 2071 LOperand* key = UseFixed(instr->key(), a0); | 2060 LOperand* key = UseFixed(instr->key(), a0); |
| 2072 | 2061 |
| 2073 LInstruction* result = | 2062 LInstruction* result = |
| 2074 DefineFixed(new(zone()) LLoadKeyedGeneric(context, object, key), v0); | 2063 DefineFixed(new(zone()) LLoadKeyedGeneric(context, object, key), v0); |
| 2075 return MarkAsCall(result, instr); | 2064 return MarkAsCall(result, instr); |
| 2076 } | 2065 } |
| 2077 | 2066 |
| 2078 | 2067 |
| 2079 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { | 2068 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { |
| 2080 if (!instr->is_external()) { | 2069 if (!instr->is_typed_elements()) { |
| 2081 ASSERT(instr->elements()->representation().IsTagged()); | 2070 ASSERT(instr->elements()->representation().IsTagged()); |
| 2082 bool needs_write_barrier = instr->NeedsWriteBarrier(); | 2071 bool needs_write_barrier = instr->NeedsWriteBarrier(); |
| 2083 LOperand* object = NULL; | 2072 LOperand* object = NULL; |
| 2084 LOperand* val = NULL; | 2073 LOperand* val = NULL; |
| 2085 LOperand* key = NULL; | 2074 LOperand* key = NULL; |
| 2086 | 2075 |
| 2087 if (instr->value()->representation().IsDouble()) { | 2076 if (instr->value()->representation().IsDouble()) { |
| 2088 object = UseRegisterAtStart(instr->elements()); | 2077 object = UseRegisterAtStart(instr->elements()); |
| 2089 key = UseRegisterOrConstantAtStart(instr->key()); | 2078 key = UseRegisterOrConstantAtStart(instr->key()); |
| 2090 val = UseRegister(instr->value()); | 2079 val = UseRegister(instr->value()); |
| 2091 } else { | 2080 } else { |
| 2092 ASSERT(instr->value()->representation().IsSmiOrTagged()); | 2081 ASSERT(instr->value()->representation().IsSmiOrTagged()); |
| 2093 if (needs_write_barrier) { | 2082 if (needs_write_barrier) { |
| 2094 object = UseTempRegister(instr->elements()); | 2083 object = UseTempRegister(instr->elements()); |
| 2095 val = UseTempRegister(instr->value()); | 2084 val = UseTempRegister(instr->value()); |
| 2096 key = UseTempRegister(instr->key()); | 2085 key = UseTempRegister(instr->key()); |
| 2097 } else { | 2086 } else { |
| 2098 object = UseRegisterAtStart(instr->elements()); | 2087 object = UseRegisterAtStart(instr->elements()); |
| 2099 val = UseRegisterAtStart(instr->value()); | 2088 val = UseRegisterAtStart(instr->value()); |
| 2100 key = UseRegisterOrConstantAtStart(instr->key()); | 2089 key = UseRegisterOrConstantAtStart(instr->key()); |
| 2101 } | 2090 } |
| 2102 } | 2091 } |
| 2103 | 2092 |
| 2104 return new(zone()) LStoreKeyed(object, key, val); | 2093 return new(zone()) LStoreKeyed(object, key, val); |
| 2105 } | 2094 } |
| 2106 | 2095 |
| 2107 ASSERT( | 2096 ASSERT( |
| 2108 (instr->value()->representation().IsInteger32() && | 2097 (instr->value()->representation().IsInteger32() && |
| 2109 (instr->elements_kind() != EXTERNAL_FLOAT_ELEMENTS) && | 2098 !IsDoubleOrFloatElementsKind(instr->elements_kind())) || |
| 2110 (instr->elements_kind() != EXTERNAL_DOUBLE_ELEMENTS)) || | |
| 2111 (instr->value()->representation().IsDouble() && | 2099 (instr->value()->representation().IsDouble() && |
| 2112 ((instr->elements_kind() == EXTERNAL_FLOAT_ELEMENTS) || | 2100 IsDoubleOrFloatElementsKind(instr->elements_kind()))); |
| 2113 (instr->elements_kind() == EXTERNAL_DOUBLE_ELEMENTS)))); | 2101 ASSERT((instr->is_fixed_typed_array() && |
| 2114 ASSERT(instr->elements()->representation().IsExternal()); | 2102 instr->elements()->representation().IsTagged()) || |
| 2103 (instr->is_external() && |
| 2104 instr->elements()->representation().IsExternal())); |
| 2115 LOperand* val = UseRegister(instr->value()); | 2105 LOperand* val = UseRegister(instr->value()); |
| 2116 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); | 2106 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
| 2117 LOperand* external_pointer = UseRegister(instr->elements()); | 2107 LOperand* backing_store = UseRegister(instr->elements()); |
| 2118 | 2108 return new(zone()) LStoreKeyed(backing_store, key, val); |
| 2119 return new(zone()) LStoreKeyed(external_pointer, key, val); | |
| 2120 } | 2109 } |
| 2121 | 2110 |
| 2122 | 2111 |
| 2123 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { | 2112 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { |
| 2124 LOperand* context = UseFixed(instr->context(), cp); | 2113 LOperand* context = UseFixed(instr->context(), cp); |
| 2125 LOperand* obj = UseFixed(instr->object(), a2); | 2114 LOperand* obj = UseFixed(instr->object(), a2); |
| 2126 LOperand* key = UseFixed(instr->key(), a1); | 2115 LOperand* key = UseFixed(instr->key(), a1); |
| 2127 LOperand* val = UseFixed(instr->value(), a0); | 2116 LOperand* val = UseFixed(instr->value(), a0); |
| 2128 | 2117 |
| 2129 ASSERT(instr->object()->representation().IsTagged()); | 2118 ASSERT(instr->object()->representation().IsTagged()); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2209 LOperand* obj = UseFixed(instr->object(), a1); | 2198 LOperand* obj = UseFixed(instr->object(), a1); |
| 2210 LOperand* val = UseFixed(instr->value(), a0); | 2199 LOperand* val = UseFixed(instr->value(), a0); |
| 2211 | 2200 |
| 2212 LInstruction* result = new(zone()) LStoreNamedGeneric(context, obj, val); | 2201 LInstruction* result = new(zone()) LStoreNamedGeneric(context, obj, val); |
| 2213 return MarkAsCall(result, instr); | 2202 return MarkAsCall(result, instr); |
| 2214 } | 2203 } |
| 2215 | 2204 |
| 2216 | 2205 |
| 2217 LInstruction* LChunkBuilder::DoStringAdd(HStringAdd* instr) { | 2206 LInstruction* LChunkBuilder::DoStringAdd(HStringAdd* instr) { |
| 2218 LOperand* context = UseFixed(instr->context(), cp); | 2207 LOperand* context = UseFixed(instr->context(), cp); |
| 2219 LOperand* left = FLAG_new_string_add | 2208 LOperand* left = UseFixed(instr->left(), a1); |
| 2220 ? UseFixed(instr->left(), a1) | 2209 LOperand* right = UseFixed(instr->right(), a0); |
| 2221 : UseRegisterAtStart(instr->left()); | |
| 2222 LOperand* right = FLAG_new_string_add | |
| 2223 ? UseFixed(instr->right(), a0) | |
| 2224 : UseRegisterAtStart(instr->right()); | |
| 2225 return MarkAsCall( | 2210 return MarkAsCall( |
| 2226 DefineFixed(new(zone()) LStringAdd(context, left, right), v0), | 2211 DefineFixed(new(zone()) LStringAdd(context, left, right), v0), |
| 2227 instr); | 2212 instr); |
| 2228 } | 2213 } |
| 2229 | 2214 |
| 2230 | 2215 |
| 2231 LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) { | 2216 LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) { |
| 2232 LOperand* string = UseTempRegister(instr->string()); | 2217 LOperand* string = UseTempRegister(instr->string()); |
| 2233 LOperand* index = UseTempRegister(instr->index()); | 2218 LOperand* index = UseTempRegister(instr->index()); |
| 2234 LOperand* context = UseAny(instr->context()); | 2219 LOperand* context = UseAny(instr->context()); |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2470 | 2455 |
| 2471 | 2456 |
| 2472 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2457 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2473 LOperand* object = UseRegister(instr->object()); | 2458 LOperand* object = UseRegister(instr->object()); |
| 2474 LOperand* index = UseRegister(instr->index()); | 2459 LOperand* index = UseRegister(instr->index()); |
| 2475 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2460 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
| 2476 } | 2461 } |
| 2477 | 2462 |
| 2478 | 2463 |
| 2479 } } // namespace v8::internal | 2464 } } // namespace v8::internal |
| OLD | NEW |