| 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 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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. | 403 // We have failed to find a suitable conversion instruction. |
| 404 // Insert two "dummy" conversion instructions with the correct | 404 // Insert two "dummy" conversion instructions with the correct |
| 405 // "from" and "to" representation. The inserted instructions will | 405 // "from" and "to" representation. The inserted instructions will |
| 406 // trigger a deoptimization if executed. See #12417 for a discussion. | 406 // trigger a deoptimization if executed. See #12417 for a discussion. |
| 407 const intptr_t deopt_id = (deopt_target != NULL) ? | 407 const intptr_t deopt_id = (deopt_target != NULL) ? |
| 408 deopt_target->DeoptimizationTarget() : Isolate::kNoDeoptId; | 408 deopt_target->DeoptimizationTarget() : Isolate::kNoDeoptId; |
| 409 ASSERT(from != kTagged); | 409 ASSERT(from != kTagged); |
| 410 ASSERT(to != kTagged); | 410 ASSERT(to != kTagged); |
| 411 Value* to_value = NULL; | 411 Definition* boxed = NULL; |
| 412 if (from == kUnboxedDouble) { | 412 if (from == kUnboxedDouble) { |
| 413 BoxDoubleInstr* boxed = new BoxDoubleInstr(use->CopyWithType()); | 413 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) { | 414 } else if (from == kUnboxedUint32x4) { |
| 418 BoxUint32x4Instr* boxed = new BoxUint32x4Instr(use->CopyWithType()); | 415 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) { | 416 } else if (from == kUnboxedFloat32x4) { |
| 423 BoxFloat32x4Instr* boxed = new BoxFloat32x4Instr(use->CopyWithType()); | 417 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) { | 418 } else if (from == kUnboxedMint) { |
| 428 BoxIntegerInstr* boxed = new BoxIntegerInstr(use->CopyWithType()); | 419 boxed = new BoxIntegerInstr(use->CopyWithType()); |
| 429 use->BindTo(boxed); | |
| 430 InsertBefore(insert_before, boxed, NULL, Definition::kValue); | |
| 431 to_value = new Value(boxed); | |
| 432 } else { | 420 } else { |
| 433 UNIMPLEMENTED(); | 421 UNIMPLEMENTED(); |
| 434 } | 422 } |
| 435 ASSERT(to_value != NULL); | 423 use->BindTo(boxed); |
| 424 InsertBefore(insert_before, boxed, NULL, Definition::kValue); |
| 425 Value* to_value = new Value(boxed); |
| 436 if (to == kUnboxedDouble) { | 426 if (to == kUnboxedDouble) { |
| 437 converted = new UnboxDoubleInstr(to_value, deopt_id); | 427 converted = new UnboxDoubleInstr(to_value, deopt_id); |
| 438 } else if (to == kUnboxedUint32x4) { | 428 } else if (to == kUnboxedUint32x4) { |
| 439 converted = new UnboxUint32x4Instr(to_value, deopt_id); | 429 converted = new UnboxUint32x4Instr(to_value, deopt_id); |
| 440 } else if (to == kUnboxedFloat32x4) { | 430 } else if (to == kUnboxedFloat32x4) { |
| 441 converted = new UnboxFloat32x4Instr(to_value, deopt_id); | 431 converted = new UnboxFloat32x4Instr(to_value, deopt_id); |
| 442 } else if (to == kUnboxedMint) { | 432 } else if (to == kUnboxedMint) { |
| 443 converted = new UnboxIntegerInstr(to_value, deopt_id); | 433 converted = new UnboxIntegerInstr(to_value, deopt_id); |
| 444 } else { | 434 } else { |
| 445 UNIMPLEMENTED(); | 435 UNIMPLEMENTED(); |
| (...skipping 7071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7517 } | 7507 } |
| 7518 | 7508 |
| 7519 // Insert materializations at environment uses. | 7509 // Insert materializations at environment uses. |
| 7520 for (intptr_t i = 0; i < exits.length(); i++) { | 7510 for (intptr_t i = 0; i < exits.length(); i++) { |
| 7521 CreateMaterializationAt(exits[i], alloc, alloc->cls(), *fields); | 7511 CreateMaterializationAt(exits[i], alloc, alloc->cls(), *fields); |
| 7522 } | 7512 } |
| 7523 } | 7513 } |
| 7524 | 7514 |
| 7525 | 7515 |
| 7526 } // namespace dart | 7516 } // namespace dart |
| OLD | NEW |