Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Side by Side Diff: runtime/vm/flow_graph_optimizer.cc

Issue 475563002: Inline Int32x4 constructor (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/cpu.h" 9 #include "vm/cpu.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 (use->Type()->ToCid() == kUnboxedMint)); 605 (use->Type()->ToCid() == kUnboxedMint));
606 const intptr_t deopt_id = (deopt_target != NULL) ? 606 const intptr_t deopt_id = (deopt_target != NULL) ?
607 deopt_target->DeoptimizationTarget() : Isolate::kNoDeoptId; 607 deopt_target->DeoptimizationTarget() : Isolate::kNoDeoptId;
608 converted = new(I) UnboxIntegerInstr(use->CopyWithType(), deopt_id); 608 converted = new(I) UnboxIntegerInstr(use->CopyWithType(), deopt_id);
609 } else if ((from == kUnboxedMint) && (to == kTagged)) { 609 } else if ((from == kUnboxedMint) && (to == kTagged)) {
610 converted = new(I) BoxIntegerInstr(use->CopyWithType()); 610 converted = new(I) BoxIntegerInstr(use->CopyWithType());
611 } else if ((from == kUnboxedMint) && (to == kUnboxedUint32)) { 611 } else if ((from == kUnboxedMint) && (to == kUnboxedUint32)) {
612 converted = new(I) UnboxedIntConverterInstr(from, to, use->CopyWithType()); 612 converted = new(I) UnboxedIntConverterInstr(from, to, use->CopyWithType());
613 } else if ((from == kUnboxedUint32) && (to == kUnboxedMint)) { 613 } else if ((from == kUnboxedUint32) && (to == kUnboxedMint)) {
614 converted = new(I) UnboxedIntConverterInstr(from, to, use->CopyWithType()); 614 converted = new(I) UnboxedIntConverterInstr(from, to, use->CopyWithType());
615 } else if ((from == kTagged) && (to == kUnboxedUint32)) {
616 const intptr_t deopt_id = (deopt_target != NULL) ?
617 deopt_target->DeoptimizationTarget() : Isolate::kNoDeoptId;
618 converted = new UnboxUint32Instr(use->CopyWithType(), deopt_id);
615 } else if (from == kUnboxedMint && to == kUnboxedDouble) { 619 } else if (from == kUnboxedMint && to == kUnboxedDouble) {
616 ASSERT(CanUnboxDouble()); 620 ASSERT(CanUnboxDouble());
617 // Convert by boxing/unboxing. 621 // Convert by boxing/unboxing.
618 // TODO(fschneider): Implement direct unboxed mint-to-double conversion. 622 // TODO(fschneider): Implement direct unboxed mint-to-double conversion.
619 BoxIntegerInstr* boxed = 623 BoxIntegerInstr* boxed =
620 new(I) BoxIntegerInstr(use->CopyWithType()); 624 new(I) BoxIntegerInstr(use->CopyWithType());
621 use->BindTo(boxed); 625 use->BindTo(boxed);
622 InsertBefore(insert_before, boxed, NULL, FlowGraph::kValue); 626 InsertBefore(insert_before, boxed, NULL, FlowGraph::kValue);
623 627
624 const intptr_t deopt_id = (deopt_target != NULL) ? 628 const intptr_t deopt_id = (deopt_target != NULL) ?
(...skipping 2601 matching lines...) Expand 10 before | Expand all | Expand 10 after
3226 new(I) Value(call->ArgumentAt(4)), 3230 new(I) Value(call->ArgumentAt(4)),
3227 call->deopt_id()); 3231 call->deopt_id());
3228 ReplaceCall(call, con); 3232 ReplaceCall(call, con);
3229 return true; 3233 return true;
3230 } else if (recognized_kind == MethodRecognizer::kInt32x4FromFloat32x4Bits) { 3234 } else if (recognized_kind == MethodRecognizer::kInt32x4FromFloat32x4Bits) {
3231 Float32x4ToInt32x4Instr* cast = 3235 Float32x4ToInt32x4Instr* cast =
3232 new(I) Float32x4ToInt32x4Instr( 3236 new(I) Float32x4ToInt32x4Instr(
3233 new(I) Value(call->ArgumentAt(1)), call->deopt_id()); 3237 new(I) Value(call->ArgumentAt(1)), call->deopt_id());
3234 ReplaceCall(call, cast); 3238 ReplaceCall(call, cast);
3235 return true; 3239 return true;
3240 } else if (recognized_kind == MethodRecognizer::kInt32x4Constructor) {
3241 Int32x4ConstructorInstr* con =
3242 new(I) Int32x4ConstructorInstr(
3243 new(I) Value(call->ArgumentAt(1)),
3244 new(I) Value(call->ArgumentAt(2)),
3245 new(I) Value(call->ArgumentAt(3)),
3246 new(I) Value(call->ArgumentAt(4)),
3247 call->deopt_id());
3248 ReplaceCall(call, con);
3249 return true;
3236 } 3250 }
3237 return false; 3251 return false;
3238 } 3252 }
3239 3253
3240 3254
3241 bool FlowGraphOptimizer::TryInlineFloat32x4Method( 3255 bool FlowGraphOptimizer::TryInlineFloat32x4Method(
3242 InstanceCallInstr* call, 3256 InstanceCallInstr* call,
3243 MethodRecognizer::Kind recognized_kind) { 3257 MethodRecognizer::Kind recognized_kind) {
3244 if (!ShouldInlineSimd()) { 3258 if (!ShouldInlineSimd()) {
3245 return false; 3259 return false;
(...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after
4268 } else if ((recognized_kind == MethodRecognizer::kFloat32x4Zero) || 4282 } else if ((recognized_kind == MethodRecognizer::kFloat32x4Zero) ||
4269 (recognized_kind == MethodRecognizer::kFloat32x4Splat) || 4283 (recognized_kind == MethodRecognizer::kFloat32x4Splat) ||
4270 (recognized_kind == MethodRecognizer::kFloat32x4Constructor) || 4284 (recognized_kind == MethodRecognizer::kFloat32x4Constructor) ||
4271 (recognized_kind == MethodRecognizer::kFloat32x4FromFloat64x2)) { 4285 (recognized_kind == MethodRecognizer::kFloat32x4FromFloat64x2)) {
4272 TryInlineFloat32x4Constructor(call, recognized_kind); 4286 TryInlineFloat32x4Constructor(call, recognized_kind);
4273 } else if ((recognized_kind == MethodRecognizer::kFloat64x2Constructor) || 4287 } else if ((recognized_kind == MethodRecognizer::kFloat64x2Constructor) ||
4274 (recognized_kind == MethodRecognizer::kFloat64x2Zero) || 4288 (recognized_kind == MethodRecognizer::kFloat64x2Zero) ||
4275 (recognized_kind == MethodRecognizer::kFloat64x2Splat) || 4289 (recognized_kind == MethodRecognizer::kFloat64x2Splat) ||
4276 (recognized_kind == MethodRecognizer::kFloat64x2FromFloat32x4)) { 4290 (recognized_kind == MethodRecognizer::kFloat64x2FromFloat32x4)) {
4277 TryInlineFloat64x2Constructor(call, recognized_kind); 4291 TryInlineFloat64x2Constructor(call, recognized_kind);
4278 } else if (recognized_kind == MethodRecognizer::kInt32x4BoolConstructor) { 4292 } else if ((recognized_kind == MethodRecognizer::kInt32x4BoolConstructor) ||
4293 (recognized_kind == MethodRecognizer::kInt32x4Constructor)) {
4279 TryInlineInt32x4Constructor(call, recognized_kind); 4294 TryInlineInt32x4Constructor(call, recognized_kind);
4280 } else if (recognized_kind == MethodRecognizer::kObjectConstructor) { 4295 } else if (recognized_kind == MethodRecognizer::kObjectConstructor) {
4281 // Remove the original push arguments. 4296 // Remove the original push arguments.
4282 for (intptr_t i = 0; i < call->ArgumentCount(); ++i) { 4297 for (intptr_t i = 0; i < call->ArgumentCount(); ++i) {
4283 PushArgumentInstr* push = call->PushArgumentAt(i); 4298 PushArgumentInstr* push = call->PushArgumentAt(i);
4284 push->ReplaceUsesWith(push->value()->definition()); 4299 push->ReplaceUsesWith(push->value()->definition());
4285 push->RemoveFromGraph(); 4300 push->RemoveFromGraph();
4286 } 4301 }
4287 // Manually replace call with global null constant. ReplaceCall can't 4302 // Manually replace call with global null constant. ReplaceCall can't
4288 // be used for definitions that are already in the graph. 4303 // be used for definitions that are already in the graph.
(...skipping 3802 matching lines...) Expand 10 before | Expand all | Expand 10 after
8091 SetValue(instr, non_constant_); 8106 SetValue(instr, non_constant_);
8092 } 8107 }
8093 8108
8094 8109
8095 void ConstantPropagator::VisitFloat32x4ToInt32x4( 8110 void ConstantPropagator::VisitFloat32x4ToInt32x4(
8096 Float32x4ToInt32x4Instr* instr) { 8111 Float32x4ToInt32x4Instr* instr) {
8097 SetValue(instr, non_constant_); 8112 SetValue(instr, non_constant_);
8098 } 8113 }
8099 8114
8100 8115
8116 void ConstantPropagator::VisitInt32x4Constructor(
8117 Int32x4ConstructorInstr* instr) {
8118 SetValue(instr, non_constant_);
8119 }
8120
8121
8101 void ConstantPropagator::VisitInt32x4BoolConstructor( 8122 void ConstantPropagator::VisitInt32x4BoolConstructor(
8102 Int32x4BoolConstructorInstr* instr) { 8123 Int32x4BoolConstructorInstr* instr) {
8103 SetValue(instr, non_constant_); 8124 SetValue(instr, non_constant_);
8104 } 8125 }
8105 8126
8106 8127
8107 void ConstantPropagator::VisitInt32x4GetFlag(Int32x4GetFlagInstr* instr) { 8128 void ConstantPropagator::VisitInt32x4GetFlag(Int32x4GetFlagInstr* instr) {
8108 SetValue(instr, non_constant_); 8129 SetValue(instr, non_constant_);
8109 } 8130 }
8110 8131
(...skipping 1427 matching lines...) Expand 10 before | Expand all | Expand 10 after
9538 9559
9539 // Insert materializations at environment uses. 9560 // Insert materializations at environment uses.
9540 for (intptr_t i = 0; i < exits_collector_.exits().length(); i++) { 9561 for (intptr_t i = 0; i < exits_collector_.exits().length(); i++) {
9541 CreateMaterializationAt( 9562 CreateMaterializationAt(
9542 exits_collector_.exits()[i], alloc, alloc->cls(), *slots); 9563 exits_collector_.exits()[i], alloc, alloc->cls(), *slots);
9543 } 9564 }
9544 } 9565 }
9545 9566
9546 9567
9547 } // namespace dart 9568 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698