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

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

Issue 22859007: Insert dummy conversion instruction for impossible conversion requests. (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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 converted = new UnboxFloat32x4Instr(use->CopyWithType(), deopt_id); 390 converted = new UnboxFloat32x4Instr(use->CopyWithType(), deopt_id);
391 } else if ((from == kUnboxedFloat32x4) && (to == kTagged)) { 391 } else if ((from == kUnboxedFloat32x4) && (to == kTagged)) {
392 converted = new BoxFloat32x4Instr(use->CopyWithType()); 392 converted = new BoxFloat32x4Instr(use->CopyWithType());
393 } else if ((from == kTagged) && (to == kUnboxedUint32x4)) { 393 } else if ((from == kTagged) && (to == kUnboxedUint32x4)) {
394 ASSERT((deopt_target != NULL) || (use->Type()->ToCid() == kUint32x4Cid)); 394 ASSERT((deopt_target != NULL) || (use->Type()->ToCid() == kUint32x4Cid));
395 const intptr_t deopt_id = (deopt_target != NULL) ? 395 const intptr_t deopt_id = (deopt_target != NULL) ?
396 deopt_target->DeoptimizationTarget() : Isolate::kNoDeoptId; 396 deopt_target->DeoptimizationTarget() : Isolate::kNoDeoptId;
397 converted = new UnboxUint32x4Instr(use->CopyWithType(), deopt_id); 397 converted = new UnboxUint32x4Instr(use->CopyWithType(), deopt_id);
398 } else if ((from == kUnboxedUint32x4) && (to == kTagged)) { 398 } else if ((from == kUnboxedUint32x4) && (to == kTagged)) {
399 converted = new BoxUint32x4Instr(use->CopyWithType()); 399 converted = new BoxUint32x4Instr(use->CopyWithType());
400 } else {
401 const intptr_t deopt_id = (deopt_target != NULL) ?
402 deopt_target->DeoptimizationTarget() : Isolate::kNoDeoptId;
403 // We have failed to find a suitable conversion instruction.
404 // Insert a "dummy" conversion instruction with the correct
405 // "to" representation. The inserted instruction will trigger a
406 // a deoptimization if executed. See issue #12417 for a discussion.
407 if (to == kUnboxedDouble) {
408 converted = new UnboxDoubleInstr(use->CopyWithType(), deopt_id);
Florian Schneider 2013/08/15 09:11:35 How about inserting a Box- and an Unbox-instructio
srdjan 2013/08/15 14:34:39 What John has observed is that this code is actual
Cutch 2013/08/15 14:35:02 We are being asked to convert an UnboxedFloat32x4
Florian Schneider 2013/08/16 10:31:18 Still, I don't understand how this should work: Ev
Cutch 2013/08/16 15:57:05 So what ends up happening is that unboxed -> tagge
409 } else if (to == kUnboxedUint32x4) {
410 converted = new UnboxDoubleInstr(use->CopyWithType(), deopt_id);
Florian Schneider 2013/08/16 10:31:18 Ok, but shouldn't this be UnboxUint32x4Instr here?
Cutch 2013/08/16 15:57:05 Yes.
411 } else if (to == kUnboxedFloat32x4) {
412 converted = new UnboxDoubleInstr(use->CopyWithType(), deopt_id);
Florian Schneider 2013/08/16 10:31:18 Likewise, UnboxFloat32x4Instr here?
413 } else if (to == kUnboxedMint) {
414 converted = new UnboxIntegerInstr(use->CopyWithType(), deopt_id);
415 }
400 } 416 }
401 ASSERT(converted != NULL); 417 ASSERT(converted != NULL);
402 use->BindTo(converted); 418 use->BindTo(converted);
403 InsertBefore(insert_before, converted, use->instruction()->env(), 419 InsertBefore(insert_before, converted, use->instruction()->env(),
404 Definition::kValue); 420 Definition::kValue);
405 } 421 }
406 422
407 423
408 void FlowGraphOptimizer::ConvertUse(Value* use, Representation from_rep) { 424 void FlowGraphOptimizer::ConvertUse(Value* use, Representation from_rep) {
409 const Representation to_rep = 425 const Representation to_rep =
(...skipping 7060 matching lines...) Expand 10 before | Expand all | Expand 10 after
7470 } 7486 }
7471 7487
7472 // Insert materializations at environment uses. 7488 // Insert materializations at environment uses.
7473 for (intptr_t i = 0; i < exits.length(); i++) { 7489 for (intptr_t i = 0; i < exits.length(); i++) {
7474 CreateMaterializationAt(exits[i], alloc, alloc->cls(), *fields); 7490 CreateMaterializationAt(exits[i], alloc, alloc->cls(), *fields);
7475 } 7491 }
7476 } 7492 }
7477 7493
7478 7494
7479 } // namespace dart 7495 } // 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