| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/flow_graph_optimizer.h" | 5 #include "vm/flow_graph_optimizer.h" |
| 6 | 6 |
| 7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/cha.h" | 8 #include "vm/cha.h" |
| 9 #include "vm/dart_entry.h" | 9 #include "vm/dart_entry.h" |
| 10 #include "vm/flow_graph_builder.h" | 10 #include "vm/flow_graph_builder.h" |
| (...skipping 2165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2176 return true; | 2176 return true; |
| 2177 } else if (recognized_kind == MethodRecognizer::kFloat32x4Constructor) { | 2177 } else if (recognized_kind == MethodRecognizer::kFloat32x4Constructor) { |
| 2178 Float32x4ConstructorInstr* con = | 2178 Float32x4ConstructorInstr* con = |
| 2179 new Float32x4ConstructorInstr(new Value(call->ArgumentAt(1)), | 2179 new Float32x4ConstructorInstr(new Value(call->ArgumentAt(1)), |
| 2180 new Value(call->ArgumentAt(2)), | 2180 new Value(call->ArgumentAt(2)), |
| 2181 new Value(call->ArgumentAt(3)), | 2181 new Value(call->ArgumentAt(3)), |
| 2182 new Value(call->ArgumentAt(4)), | 2182 new Value(call->ArgumentAt(4)), |
| 2183 call->deopt_id()); | 2183 call->deopt_id()); |
| 2184 ReplaceCall(call, con); | 2184 ReplaceCall(call, con); |
| 2185 return true; | 2185 return true; |
| 2186 } else if (recognized_kind == MethodRecognizer::kFloat32x4FromUint32x4Bits) { |
| 2187 Uint32x4ToFloat32x4Instr* cast = |
| 2188 new Uint32x4ToFloat32x4Instr(new Value(call->ArgumentAt(1)), |
| 2189 call->deopt_id()); |
| 2190 ReplaceCall(call, cast); |
| 2191 return true; |
| 2186 } | 2192 } |
| 2187 return false; | 2193 return false; |
| 2188 } | 2194 } |
| 2189 | 2195 |
| 2190 | 2196 |
| 2191 bool FlowGraphOptimizer::TryInlineUint32x4Constructor( | 2197 bool FlowGraphOptimizer::TryInlineUint32x4Constructor( |
| 2192 StaticCallInstr* call, | 2198 StaticCallInstr* call, |
| 2193 MethodRecognizer::Kind recognized_kind) { | 2199 MethodRecognizer::Kind recognized_kind) { |
| 2194 if (!ShouldInlineSimd()) { | 2200 if (!ShouldInlineSimd()) { |
| 2195 return false; | 2201 return false; |
| 2196 } | 2202 } |
| 2197 if (recognized_kind == MethodRecognizer::kUint32x4BoolConstructor) { | 2203 if (recognized_kind == MethodRecognizer::kUint32x4BoolConstructor) { |
| 2198 Uint32x4BoolConstructorInstr* con = new Uint32x4BoolConstructorInstr( | 2204 Uint32x4BoolConstructorInstr* con = new Uint32x4BoolConstructorInstr( |
| 2199 new Value(call->ArgumentAt(1)), | 2205 new Value(call->ArgumentAt(1)), |
| 2200 new Value(call->ArgumentAt(2)), | 2206 new Value(call->ArgumentAt(2)), |
| 2201 new Value(call->ArgumentAt(3)), | 2207 new Value(call->ArgumentAt(3)), |
| 2202 new Value(call->ArgumentAt(4)), | 2208 new Value(call->ArgumentAt(4)), |
| 2203 call->deopt_id()); | 2209 call->deopt_id()); |
| 2204 ReplaceCall(call, con); | 2210 ReplaceCall(call, con); |
| 2205 return true; | 2211 return true; |
| 2212 } else if (recognized_kind == MethodRecognizer::kUint32x4FromFloat32x4Bits) { |
| 2213 Float32x4ToUint32x4Instr* cast = |
| 2214 new Float32x4ToUint32x4Instr(new Value(call->ArgumentAt(1)), |
| 2215 call->deopt_id()); |
| 2216 ReplaceCall(call, cast); |
| 2217 return true; |
| 2206 } | 2218 } |
| 2207 return false; | 2219 return false; |
| 2208 } | 2220 } |
| 2209 | 2221 |
| 2210 | 2222 |
| 2211 bool FlowGraphOptimizer::TryInlineFloat32x4Method( | 2223 bool FlowGraphOptimizer::TryInlineFloat32x4Method( |
| 2212 InstanceCallInstr* call, | 2224 InstanceCallInstr* call, |
| 2213 MethodRecognizer::Kind recognized_kind) { | 2225 MethodRecognizer::Kind recognized_kind) { |
| 2214 if (!ShouldInlineSimd()) { | 2226 if (!ShouldInlineSimd()) { |
| 2215 return false; | 2227 return false; |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2366 call->deopt_id(), | 2378 call->deopt_id(), |
| 2367 call->env(), | 2379 call->env(), |
| 2368 call); | 2380 call); |
| 2369 Float32x4ClampInstr* clamp = new Float32x4ClampInstr(new Value(left), | 2381 Float32x4ClampInstr* clamp = new Float32x4ClampInstr(new Value(left), |
| 2370 new Value(lower), | 2382 new Value(lower), |
| 2371 new Value(upper), | 2383 new Value(upper), |
| 2372 call->deopt_id()); | 2384 call->deopt_id()); |
| 2373 ReplaceCall(call, clamp); | 2385 ReplaceCall(call, clamp); |
| 2374 return true; | 2386 return true; |
| 2375 } | 2387 } |
| 2376 case MethodRecognizer::kFloat32x4ToUint32x4: { | |
| 2377 Definition* left = call->ArgumentAt(0); | |
| 2378 // Type check left. | |
| 2379 AddCheckClass(left, | |
| 2380 ICData::ZoneHandle( | |
| 2381 call->ic_data()->AsUnaryClassChecksForArgNr(0)), | |
| 2382 call->deopt_id(), | |
| 2383 call->env(), | |
| 2384 call); | |
| 2385 Float32x4ToUint32x4Instr* cast = | |
| 2386 new Float32x4ToUint32x4Instr(new Value(left), call->deopt_id()); | |
| 2387 ReplaceCall(call, cast); | |
| 2388 return true; | |
| 2389 } | |
| 2390 case MethodRecognizer::kFloat32x4Shuffle: { | 2388 case MethodRecognizer::kFloat32x4Shuffle: { |
| 2391 return InlineFloat32x4Getter(call, recognized_kind); | 2389 return InlineFloat32x4Getter(call, recognized_kind); |
| 2392 } | 2390 } |
| 2393 default: | 2391 default: |
| 2394 return false; | 2392 return false; |
| 2395 } | 2393 } |
| 2396 } | 2394 } |
| 2397 | 2395 |
| 2398 | 2396 |
| 2399 bool FlowGraphOptimizer::TryInlineUint32x4Method( | 2397 bool FlowGraphOptimizer::TryInlineUint32x4Method( |
| (...skipping 25 matching lines...) Expand all Loading... |
| 2425 call->env(), | 2423 call->env(), |
| 2426 call); | 2424 call); |
| 2427 Uint32x4SelectInstr* select = new Uint32x4SelectInstr( | 2425 Uint32x4SelectInstr* select = new Uint32x4SelectInstr( |
| 2428 new Value(mask), | 2426 new Value(mask), |
| 2429 new Value(trueValue), | 2427 new Value(trueValue), |
| 2430 new Value(falseValue), | 2428 new Value(falseValue), |
| 2431 call->deopt_id()); | 2429 call->deopt_id()); |
| 2432 ReplaceCall(call, select); | 2430 ReplaceCall(call, select); |
| 2433 return true; | 2431 return true; |
| 2434 } | 2432 } |
| 2435 case MethodRecognizer::kUint32x4ToUint32x4: { | |
| 2436 Definition* left = call->ArgumentAt(0); | |
| 2437 // Type check left. | |
| 2438 AddCheckClass(left, | |
| 2439 ICData::ZoneHandle( | |
| 2440 call->ic_data()->AsUnaryClassChecksForArgNr(0)), | |
| 2441 call->deopt_id(), | |
| 2442 call->env(), | |
| 2443 call); | |
| 2444 Uint32x4ToFloat32x4Instr* cast = | |
| 2445 new Uint32x4ToFloat32x4Instr(new Value(left), call->deopt_id()); | |
| 2446 ReplaceCall(call, cast); | |
| 2447 return true; | |
| 2448 } | |
| 2449 case MethodRecognizer::kUint32x4WithFlagX: | 2433 case MethodRecognizer::kUint32x4WithFlagX: |
| 2450 case MethodRecognizer::kUint32x4WithFlagY: | 2434 case MethodRecognizer::kUint32x4WithFlagY: |
| 2451 case MethodRecognizer::kUint32x4WithFlagZ: | 2435 case MethodRecognizer::kUint32x4WithFlagZ: |
| 2452 case MethodRecognizer::kUint32x4WithFlagW: { | 2436 case MethodRecognizer::kUint32x4WithFlagW: { |
| 2453 Definition* left = call->ArgumentAt(0); | 2437 Definition* left = call->ArgumentAt(0); |
| 2454 Definition* flag = call->ArgumentAt(1); | 2438 Definition* flag = call->ArgumentAt(1); |
| 2455 // Type check left. | 2439 // Type check left. |
| 2456 AddCheckClass(left, | 2440 AddCheckClass(left, |
| 2457 ICData::ZoneHandle( | 2441 ICData::ZoneHandle( |
| 2458 call->ic_data()->AsUnaryClassChecksForArgNr(0)), | 2442 call->ic_data()->AsUnaryClassChecksForArgNr(0)), |
| (...skipping 5212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7671 } | 7655 } |
| 7672 | 7656 |
| 7673 // Insert materializations at environment uses. | 7657 // Insert materializations at environment uses. |
| 7674 for (intptr_t i = 0; i < exits.length(); i++) { | 7658 for (intptr_t i = 0; i < exits.length(); i++) { |
| 7675 CreateMaterializationAt(exits[i], alloc, alloc->cls(), *fields); | 7659 CreateMaterializationAt(exits[i], alloc, alloc->cls(), *fields); |
| 7676 } | 7660 } |
| 7677 } | 7661 } |
| 7678 | 7662 |
| 7679 | 7663 |
| 7680 } // namespace dart | 7664 } // namespace dart |
| OLD | NEW |