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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 return NULL; | 168 return NULL; |
169 } | 169 } |
170 } | 170 } |
171 | 171 |
172 | 172 |
173 bool LGoto::HasInterestingComment(LCodeGen* gen) const { | 173 bool LGoto::HasInterestingComment(LCodeGen* gen) const { |
174 return !gen->IsNextEmittedBlock(block_id()); | 174 return !gen->IsNextEmittedBlock(block_id()); |
175 } | 175 } |
176 | 176 |
177 | 177 |
| 178 template<int R> |
| 179 bool LTemplateResultInstruction<R>::MustSignExtendResult( |
| 180 LPlatformChunk* chunk) const { |
| 181 HValue* hvalue = this->hydrogen_value(); |
| 182 |
| 183 if (hvalue == NULL) return false; |
| 184 if (!hvalue->representation().IsInteger32()) return false; |
| 185 if (hvalue->HasRange() && !hvalue->range()->CanBeNegative()) return false; |
| 186 |
| 187 return chunk->GetDehoistedKeyIds()->Contains(hvalue->id()); |
| 188 } |
| 189 |
| 190 |
178 void LGoto::PrintDataTo(StringStream* stream) { | 191 void LGoto::PrintDataTo(StringStream* stream) { |
179 stream->Add("B%d", block_id()); | 192 stream->Add("B%d", block_id()); |
180 } | 193 } |
181 | 194 |
182 | 195 |
183 void LBranch::PrintDataTo(StringStream* stream) { | 196 void LBranch::PrintDataTo(StringStream* stream) { |
184 stream->Add("B%d | B%d on ", true_block_id(), false_block_id()); | 197 stream->Add("B%d | B%d on ", true_block_id(), false_block_id()); |
185 value()->PrintTo(stream); | 198 value()->PrintTo(stream); |
186 } | 199 } |
187 | 200 |
(...skipping 1877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2065 return AssignEnvironment(DefineAsRegister( | 2078 return AssignEnvironment(DefineAsRegister( |
2066 new(zone()) LLoadFunctionPrototype(UseRegister(instr->function())))); | 2079 new(zone()) LLoadFunctionPrototype(UseRegister(instr->function())))); |
2067 } | 2080 } |
2068 | 2081 |
2069 | 2082 |
2070 LInstruction* LChunkBuilder::DoLoadRoot(HLoadRoot* instr) { | 2083 LInstruction* LChunkBuilder::DoLoadRoot(HLoadRoot* instr) { |
2071 return DefineAsRegister(new(zone()) LLoadRoot); | 2084 return DefineAsRegister(new(zone()) LLoadRoot); |
2072 } | 2085 } |
2073 | 2086 |
2074 | 2087 |
| 2088 void LChunkBuilder::FindDehoistedKeyDefinitions(HValue* candidate) { |
| 2089 BitVector* dehoisted_key_ids = chunk_->GetDehoistedKeyIds(); |
| 2090 if (dehoisted_key_ids->Contains(candidate->id())) return; |
| 2091 dehoisted_key_ids->Add(candidate->id()); |
| 2092 if (!candidate->IsPhi()) return; |
| 2093 for (int i = 0; i < candidate->OperandCount(); ++i) { |
| 2094 FindDehoistedKeyDefinitions(candidate->OperandAt(i)); |
| 2095 } |
| 2096 } |
| 2097 |
| 2098 |
2075 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { | 2099 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { |
2076 ASSERT(instr->key()->representation().IsInteger32()); | 2100 ASSERT(instr->key()->representation().IsInteger32()); |
2077 ElementsKind elements_kind = instr->elements_kind(); | 2101 ElementsKind elements_kind = instr->elements_kind(); |
2078 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); | 2102 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
2079 LLoadKeyed* result = NULL; | 2103 LLoadKeyed* result = NULL; |
2080 | 2104 |
| 2105 if (instr->IsDehoisted()) { |
| 2106 FindDehoistedKeyDefinitions(instr->key()); |
| 2107 } |
| 2108 |
2081 if (!instr->is_typed_elements()) { | 2109 if (!instr->is_typed_elements()) { |
2082 LOperand* obj = UseRegisterAtStart(instr->elements()); | 2110 LOperand* obj = UseRegisterAtStart(instr->elements()); |
2083 result = new(zone()) LLoadKeyed(obj, key); | 2111 result = new(zone()) LLoadKeyed(obj, key); |
2084 } else { | 2112 } else { |
2085 ASSERT( | 2113 ASSERT( |
2086 (instr->representation().IsInteger32() && | 2114 (instr->representation().IsInteger32() && |
2087 !(IsDoubleOrFloatElementsKind(instr->elements_kind()))) || | 2115 !(IsDoubleOrFloatElementsKind(instr->elements_kind()))) || |
2088 (instr->representation().IsDouble() && | 2116 (instr->representation().IsDouble() && |
2089 (IsDoubleOrFloatElementsKind(instr->elements_kind())))); | 2117 (IsDoubleOrFloatElementsKind(instr->elements_kind())))); |
2090 LOperand* backing_store = UseRegister(instr->elements()); | 2118 LOperand* backing_store = UseRegister(instr->elements()); |
(...skipping 17 matching lines...) Expand all Loading... |
2108 | 2136 |
2109 LLoadKeyedGeneric* result = | 2137 LLoadKeyedGeneric* result = |
2110 new(zone()) LLoadKeyedGeneric(context, object, key); | 2138 new(zone()) LLoadKeyedGeneric(context, object, key); |
2111 return MarkAsCall(DefineFixed(result, rax), instr); | 2139 return MarkAsCall(DefineFixed(result, rax), instr); |
2112 } | 2140 } |
2113 | 2141 |
2114 | 2142 |
2115 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { | 2143 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { |
2116 ElementsKind elements_kind = instr->elements_kind(); | 2144 ElementsKind elements_kind = instr->elements_kind(); |
2117 | 2145 |
| 2146 if (instr->IsDehoisted()) { |
| 2147 FindDehoistedKeyDefinitions(instr->key()); |
| 2148 } |
| 2149 |
2118 if (!instr->is_typed_elements()) { | 2150 if (!instr->is_typed_elements()) { |
2119 ASSERT(instr->elements()->representation().IsTagged()); | 2151 ASSERT(instr->elements()->representation().IsTagged()); |
2120 bool needs_write_barrier = instr->NeedsWriteBarrier(); | 2152 bool needs_write_barrier = instr->NeedsWriteBarrier(); |
2121 LOperand* object = NULL; | 2153 LOperand* object = NULL; |
2122 LOperand* key = NULL; | 2154 LOperand* key = NULL; |
2123 LOperand* val = NULL; | 2155 LOperand* val = NULL; |
2124 | 2156 |
2125 Representation value_representation = instr->value()->representation(); | 2157 Representation value_representation = instr->value()->representation(); |
2126 if (value_representation.IsDouble()) { | 2158 if (value_representation.IsDouble()) { |
2127 object = UseRegisterAtStart(instr->elements()); | 2159 object = UseRegisterAtStart(instr->elements()); |
2128 val = UseTempRegister(instr->value()); | 2160 val = UseRegisterAtStart(instr->value()); |
2129 key = UseRegisterOrConstantAtStart(instr->key()); | 2161 key = UseRegisterOrConstantAtStart(instr->key()); |
2130 } else { | 2162 } else { |
2131 ASSERT(value_representation.IsSmiOrTagged() || | 2163 ASSERT(value_representation.IsSmiOrTagged() || |
2132 value_representation.IsInteger32()); | 2164 value_representation.IsInteger32()); |
2133 if (needs_write_barrier) { | 2165 if (needs_write_barrier) { |
2134 object = UseTempRegister(instr->elements()); | 2166 object = UseTempRegister(instr->elements()); |
2135 val = UseTempRegister(instr->value()); | 2167 val = UseTempRegister(instr->value()); |
2136 key = UseTempRegister(instr->key()); | 2168 key = UseTempRegister(instr->key()); |
2137 } else { | 2169 } else { |
2138 object = UseRegisterAtStart(instr->elements()); | 2170 object = UseRegisterAtStart(instr->elements()); |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2527 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2559 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2528 LOperand* object = UseRegister(instr->object()); | 2560 LOperand* object = UseRegister(instr->object()); |
2529 LOperand* index = UseTempRegister(instr->index()); | 2561 LOperand* index = UseTempRegister(instr->index()); |
2530 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2562 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
2531 } | 2563 } |
2532 | 2564 |
2533 | 2565 |
2534 } } // namespace v8::internal | 2566 } } // namespace v8::internal |
2535 | 2567 |
2536 #endif // V8_TARGET_ARCH_X64 | 2568 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |