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

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

Issue 22991007: Cleanup conversion insertion in unboxed -> unboxed case. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/dart_entry.h" 9 #include "vm/dart_entry.h"
10 #include "vm/flow_graph_builder.h" 10 #include "vm/flow_graph_builder.h"
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 } else if ((from == kUnboxedFloat32x4) && (to == kTagged)) { 393 } else if ((from == kUnboxedFloat32x4) && (to == kTagged)) {
394 converted = new BoxFloat32x4Instr(use->CopyWithType()); 394 converted = new BoxFloat32x4Instr(use->CopyWithType());
395 } else if ((from == kTagged) && (to == kUnboxedUint32x4)) { 395 } else if ((from == kTagged) && (to == kUnboxedUint32x4)) {
396 ASSERT((deopt_target != NULL) || (use->Type()->ToCid() == kUint32x4Cid)); 396 ASSERT((deopt_target != NULL) || (use->Type()->ToCid() == kUint32x4Cid));
397 const intptr_t deopt_id = (deopt_target != NULL) ? 397 const intptr_t deopt_id = (deopt_target != NULL) ?
398 deopt_target->DeoptimizationTarget() : Isolate::kNoDeoptId; 398 deopt_target->DeoptimizationTarget() : Isolate::kNoDeoptId;
399 converted = new UnboxUint32x4Instr(use->CopyWithType(), deopt_id); 399 converted = new UnboxUint32x4Instr(use->CopyWithType(), deopt_id);
400 } else if ((from == kUnboxedUint32x4) && (to == kTagged)) { 400 } else if ((from == kUnboxedUint32x4) && (to == kTagged)) {
401 converted = new BoxUint32x4Instr(use->CopyWithType()); 401 converted = new BoxUint32x4Instr(use->CopyWithType());
402 } else { 402 } else {
403 // We have failed to find a suitable conversion instruction.
404 // Insert two "dummy" conversion instructions with the correct
405 // "from" and "to" representation. The inserted instructions will
406 // trigger a deoptimization if executed. See #12417 for a discussion.
403 const intptr_t deopt_id = (deopt_target != NULL) ? 407 const intptr_t deopt_id = (deopt_target != NULL) ?
404 deopt_target->DeoptimizationTarget() : Isolate::kNoDeoptId; 408 deopt_target->DeoptimizationTarget() : Isolate::kNoDeoptId;
405 // We have failed to find a suitable conversion instruction. 409 ASSERT(from != kTagged);
406 // Insert a "dummy" conversion instruction with the correct 410 ASSERT(to != kTagged);
407 // "to" representation. The inserted instruction will trigger a 411 Value* to_value = NULL;
408 // a deoptimization if executed. See issue #12417 for a discussion. 412 if (from == kUnboxedDouble) {
413 BoxDoubleInstr* boxed = new BoxDoubleInstr(use->CopyWithType());
414 use->BindTo(boxed);
415 InsertBefore(insert_before, boxed, NULL, Definition::kValue);
416 to_value = new Value(boxed);
417 } else if (from == kUnboxedUint32x4) {
418 BoxUint32x4Instr* boxed = new BoxUint32x4Instr(use->CopyWithType());
419 use->BindTo(boxed);
420 InsertBefore(insert_before, boxed, NULL, Definition::kValue);
421 to_value = new Value(boxed);
422 } else if (from == kUnboxedFloat32x4) {
423 BoxFloat32x4Instr* boxed = new BoxFloat32x4Instr(use->CopyWithType());
424 use->BindTo(boxed);
425 InsertBefore(insert_before, boxed, NULL, Definition::kValue);
426 to_value = new Value(boxed);
427 } else if (from == kUnboxedMint) {
428 BoxIntegerInstr* boxed = new BoxIntegerInstr(use->CopyWithType());
Florian Schneider 2013/08/21 08:38:51 You could share the three lines below instead of d
429 use->BindTo(boxed);
430 InsertBefore(insert_before, boxed, NULL, Definition::kValue);
431 to_value = new Value(boxed);
432 } else {
433 UNIMPLEMENTED();
434 }
435 ASSERT(to_value != NULL);
409 if (to == kUnboxedDouble) { 436 if (to == kUnboxedDouble) {
410 converted = new UnboxDoubleInstr(use->CopyWithType(), deopt_id); 437 converted = new UnboxDoubleInstr(to_value, deopt_id);
411 } else if (to == kUnboxedUint32x4) { 438 } else if (to == kUnboxedUint32x4) {
412 converted = new UnboxDoubleInstr(use->CopyWithType(), deopt_id); 439 converted = new UnboxUint32x4Instr(to_value, deopt_id);
413 } else if (to == kUnboxedFloat32x4) { 440 } else if (to == kUnboxedFloat32x4) {
414 converted = new UnboxDoubleInstr(use->CopyWithType(), deopt_id); 441 converted = new UnboxFloat32x4Instr(to_value, deopt_id);
415 } else if (to == kUnboxedMint) { 442 } else if (to == kUnboxedMint) {
416 converted = new UnboxIntegerInstr(use->CopyWithType(), deopt_id); 443 converted = new UnboxIntegerInstr(to_value, deopt_id);
444 } else {
445 UNIMPLEMENTED();
417 } 446 }
418 } 447 }
419 ASSERT(converted != NULL); 448 ASSERT(converted != NULL);
420 use->BindTo(converted); 449 use->BindTo(converted);
421 InsertBefore(insert_before, converted, use->instruction()->env(), 450 InsertBefore(insert_before, converted, use->instruction()->env(),
422 Definition::kValue); 451 Definition::kValue);
423 } 452 }
424 453
425 454
426 void FlowGraphOptimizer::ConvertUse(Value* use, Representation from_rep) { 455 void FlowGraphOptimizer::ConvertUse(Value* use, Representation from_rep) {
(...skipping 7069 matching lines...) Expand 10 before | Expand all | Expand 10 after
7496 } 7525 }
7497 7526
7498 // Insert materializations at environment uses. 7527 // Insert materializations at environment uses.
7499 for (intptr_t i = 0; i < exits.length(); i++) { 7528 for (intptr_t i = 0; i < exits.length(); i++) {
7500 CreateMaterializationAt(exits[i], alloc, alloc->cls(), *fields); 7529 CreateMaterializationAt(exits[i], alloc, alloc->cls(), *fields);
7501 } 7530 }
7502 } 7531 }
7503 7532
7504 7533
7505 } // namespace dart 7534 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698