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