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