| 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 2037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2048 return DefineAsRegister(new(zone()) LLoadExternalArrayPointer(input)); | 2048 return DefineAsRegister(new(zone()) LLoadExternalArrayPointer(input)); |
| 2049 } | 2049 } |
| 2050 | 2050 |
| 2051 | 2051 |
| 2052 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { | 2052 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { |
| 2053 ASSERT(instr->key()->representation().IsInteger32()); | 2053 ASSERT(instr->key()->representation().IsInteger32()); |
| 2054 ElementsKind elements_kind = instr->elements_kind(); | 2054 ElementsKind elements_kind = instr->elements_kind(); |
| 2055 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); | 2055 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
| 2056 LLoadKeyed* result = NULL; | 2056 LLoadKeyed* result = NULL; |
| 2057 | 2057 |
| 2058 if (!instr->is_external()) { | 2058 if (!instr->is_external() && !instr->is_fixed_typed_array()) { |
| 2059 LOperand* obj = UseRegisterAtStart(instr->elements()); | 2059 LOperand* obj = UseRegisterAtStart(instr->elements()); |
| 2060 result = new(zone()) LLoadKeyed(obj, key); | 2060 result = new(zone()) LLoadKeyed(obj, key); |
| 2061 } else { | 2061 } else { |
| 2062 ASSERT( | 2062 ASSERT( |
| 2063 (instr->representation().IsInteger32() && | 2063 (instr->representation().IsInteger32() && |
| 2064 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && | 2064 !(IsDoubleOrFloatElementsKind(instr->elements_kind()))) || |
| 2065 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || | |
| 2066 (instr->representation().IsDouble() && | 2065 (instr->representation().IsDouble() && |
| 2067 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || | 2066 (IsDoubleOrFloatElementsKind(instr->elements_kind())))); |
| 2068 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); | 2067 LOperand* backing_store = UseRegister(instr->elements()); |
| 2069 LOperand* external_pointer = UseRegister(instr->elements()); | 2068 result = new(zone()) LLoadKeyed(backing_store, key); |
| 2070 result = new(zone()) LLoadKeyed(external_pointer, key); | |
| 2071 } | 2069 } |
| 2072 | 2070 |
| 2073 DefineAsRegister(result); | 2071 DefineAsRegister(result); |
| 2074 bool can_deoptimize = instr->RequiresHoleCheck() || | 2072 bool can_deoptimize = instr->RequiresHoleCheck() || |
| 2075 (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS); | 2073 (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS) || |
| 2074 (elements_kind == UINT32_ELEMENTS); |
| 2076 // An unsigned int array load might overflow and cause a deopt, make sure it | 2075 // An unsigned int array load might overflow and cause a deopt, make sure it |
| 2077 // has an environment. | 2076 // has an environment. |
| 2078 return can_deoptimize ? AssignEnvironment(result) : result; | 2077 return can_deoptimize ? AssignEnvironment(result) : result; |
| 2079 } | 2078 } |
| 2080 | 2079 |
| 2081 | 2080 |
| 2082 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { | 2081 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { |
| 2083 LOperand* context = UseFixed(instr->context(), rsi); | 2082 LOperand* context = UseFixed(instr->context(), rsi); |
| 2084 LOperand* object = UseFixed(instr->object(), rdx); | 2083 LOperand* object = UseFixed(instr->object(), rdx); |
| 2085 LOperand* key = UseFixed(instr->key(), rax); | 2084 LOperand* key = UseFixed(instr->key(), rax); |
| 2086 | 2085 |
| 2087 LLoadKeyedGeneric* result = | 2086 LLoadKeyedGeneric* result = |
| 2088 new(zone()) LLoadKeyedGeneric(context, object, key); | 2087 new(zone()) LLoadKeyedGeneric(context, object, key); |
| 2089 return MarkAsCall(DefineFixed(result, rax), instr); | 2088 return MarkAsCall(DefineFixed(result, rax), instr); |
| 2090 } | 2089 } |
| 2091 | 2090 |
| 2092 | 2091 |
| 2093 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { | 2092 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { |
| 2094 ElementsKind elements_kind = instr->elements_kind(); | 2093 ElementsKind elements_kind = instr->elements_kind(); |
| 2095 | 2094 |
| 2096 if (!instr->is_external()) { | 2095 if (!instr->is_external() && !instr->is_fixed_typed_array()) { |
| 2097 ASSERT(instr->elements()->representation().IsTagged()); | 2096 ASSERT(instr->elements()->representation().IsTagged()); |
| 2098 bool needs_write_barrier = instr->NeedsWriteBarrier(); | 2097 bool needs_write_barrier = instr->NeedsWriteBarrier(); |
| 2099 LOperand* object = NULL; | 2098 LOperand* object = NULL; |
| 2100 LOperand* key = NULL; | 2099 LOperand* key = NULL; |
| 2101 LOperand* val = NULL; | 2100 LOperand* val = NULL; |
| 2102 | 2101 |
| 2103 Representation value_representation = instr->value()->representation(); | 2102 Representation value_representation = instr->value()->representation(); |
| 2104 if (value_representation.IsDouble()) { | 2103 if (value_representation.IsDouble()) { |
| 2105 object = UseRegisterAtStart(instr->elements()); | 2104 object = UseRegisterAtStart(instr->elements()); |
| 2106 val = UseTempRegister(instr->value()); | 2105 val = UseTempRegister(instr->value()); |
| 2107 key = UseRegisterOrConstantAtStart(instr->key()); | 2106 key = UseRegisterOrConstantAtStart(instr->key()); |
| 2108 } else { | 2107 } else { |
| 2109 ASSERT(value_representation.IsSmiOrTagged() || | 2108 ASSERT(value_representation.IsSmiOrTagged() || |
| 2110 value_representation.IsInteger32()); | 2109 value_representation.IsInteger32()); |
| 2111 if (needs_write_barrier) { | 2110 if (needs_write_barrier) { |
| 2112 object = UseTempRegister(instr->elements()); | 2111 object = UseTempRegister(instr->elements()); |
| 2113 val = UseTempRegister(instr->value()); | 2112 val = UseTempRegister(instr->value()); |
| 2114 key = UseTempRegister(instr->key()); | 2113 key = UseTempRegister(instr->key()); |
| 2115 } else { | 2114 } else { |
| 2116 object = UseRegisterAtStart(instr->elements()); | 2115 object = UseRegisterAtStart(instr->elements()); |
| 2117 val = UseRegisterOrConstantAtStart(instr->value()); | 2116 val = UseRegisterOrConstantAtStart(instr->value()); |
| 2118 key = UseRegisterOrConstantAtStart(instr->key()); | 2117 key = UseRegisterOrConstantAtStart(instr->key()); |
| 2119 } | 2118 } |
| 2120 } | 2119 } |
| 2121 | 2120 |
| 2122 return new(zone()) LStoreKeyed(object, key, val); | 2121 return new(zone()) LStoreKeyed(object, key, val); |
| 2123 } | 2122 } |
| 2124 | 2123 |
| 2125 ASSERT( | 2124 ASSERT( |
| 2126 (instr->value()->representation().IsInteger32() && | 2125 (instr->value()->representation().IsInteger32() && |
| 2127 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && | 2126 !IsDoubleOrFloatElementsKind(elements_kind)) || |
| 2128 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || | 2127 (instr->value()->representation().IsDouble() && |
| 2129 (instr->value()->representation().IsDouble() && | 2128 IsDoubleOrFloatElementsKind(elements_kind))); |
| 2130 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || | 2129 ASSERT((instr->is_fixed_typed_array() && |
| 2131 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); | 2130 instr->elements()->representation().IsTagged()) || |
| 2132 ASSERT(instr->elements()->representation().IsExternal()); | 2131 (instr->is_external() && |
| 2132 instr->elements()->representation().IsExternal())); |
| 2133 bool val_is_temp_register = | 2133 bool val_is_temp_register = |
| 2134 elements_kind == EXTERNAL_PIXEL_ELEMENTS || | 2134 elements_kind == EXTERNAL_PIXEL_ELEMENTS || |
| 2135 elements_kind == EXTERNAL_FLOAT_ELEMENTS; | 2135 elements_kind == EXTERNAL_FLOAT_ELEMENTS || |
| 2136 elements_kind == FLOAT32_ELEMENTS; |
| 2136 LOperand* val = val_is_temp_register ? UseTempRegister(instr->value()) | 2137 LOperand* val = val_is_temp_register ? UseTempRegister(instr->value()) |
| 2137 : UseRegister(instr->value()); | 2138 : UseRegister(instr->value()); |
| 2138 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); | 2139 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
| 2139 LOperand* external_pointer = UseRegister(instr->elements()); | 2140 LOperand* backing_store = UseRegister(instr->elements()); |
| 2140 return new(zone()) LStoreKeyed(external_pointer, key, val); | 2141 return new(zone()) LStoreKeyed(backing_store, key, val); |
| 2141 } | 2142 } |
| 2142 | 2143 |
| 2143 | 2144 |
| 2144 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { | 2145 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { |
| 2145 LOperand* context = UseFixed(instr->context(), rsi); | 2146 LOperand* context = UseFixed(instr->context(), rsi); |
| 2146 LOperand* object = UseFixed(instr->object(), rdx); | 2147 LOperand* object = UseFixed(instr->object(), rdx); |
| 2147 LOperand* key = UseFixed(instr->key(), rcx); | 2148 LOperand* key = UseFixed(instr->key(), rcx); |
| 2148 LOperand* value = UseFixed(instr->value(), rax); | 2149 LOperand* value = UseFixed(instr->value(), rax); |
| 2149 | 2150 |
| 2150 ASSERT(instr->object()->representation().IsTagged()); | 2151 ASSERT(instr->object()->representation().IsTagged()); |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2525 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2526 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2526 LOperand* object = UseRegister(instr->object()); | 2527 LOperand* object = UseRegister(instr->object()); |
| 2527 LOperand* index = UseTempRegister(instr->index()); | 2528 LOperand* index = UseTempRegister(instr->index()); |
| 2528 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2529 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
| 2529 } | 2530 } |
| 2530 | 2531 |
| 2531 | 2532 |
| 2532 } } // namespace v8::internal | 2533 } } // namespace v8::internal |
| 2533 | 2534 |
| 2534 #endif // V8_TARGET_ARCH_X64 | 2535 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |