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

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

Issue 616873003: Use UnboxedInt32 and UnboxedUint32 representation for LoadIndexedInstr (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 return true; 68 return true;
69 #else 69 #else
70 // ARM does not have a short instruction sequence for converting int64 to 70 // ARM does not have a short instruction sequence for converting int64 to
71 // double. 71 // double.
72 // TODO(johnmccutchan): Investigate possibility on MIPS once 72 // TODO(johnmccutchan): Investigate possibility on MIPS once
73 // mints are implemented there. 73 // mints are implemented there.
74 return false; 74 return false;
75 #endif 75 #endif
76 } 76 }
77 77
78
78 // Optimize instance calls using ICData. 79 // Optimize instance calls using ICData.
79 void FlowGraphOptimizer::ApplyICData() { 80 void FlowGraphOptimizer::ApplyICData() {
80 VisitBlocks(); 81 VisitBlocks();
81 } 82 }
82 83
83 84
84 // Optimize instance calls using cid. This is called after optimizer 85 // Optimize instance calls using cid. This is called after optimizer
85 // converted instance calls to instructions. Any remaining 86 // converted instance calls to instructions. Any remaining
86 // instance calls are either megamorphic calls, cannot be optimized or 87 // instance calls are either megamorphic calls, cannot be optimized or
87 // have no runtime type feedback collected. 88 // have no runtime type feedback collected.
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 622
622 Definition* converted = NULL; 623 Definition* converted = NULL;
623 if ((from == kTagged) && (to == kUnboxedMint)) { 624 if ((from == kTagged) && (to == kUnboxedMint)) {
624 ASSERT((deopt_target != NULL) || 625 ASSERT((deopt_target != NULL) ||
625 (use->Type()->ToCid() == kUnboxedMint)); 626 (use->Type()->ToCid() == kUnboxedMint));
626 const intptr_t deopt_id = (deopt_target != NULL) ? 627 const intptr_t deopt_id = (deopt_target != NULL) ?
627 deopt_target->DeoptimizationTarget() : Isolate::kNoDeoptId; 628 deopt_target->DeoptimizationTarget() : Isolate::kNoDeoptId;
628 converted = new(I) UnboxIntegerInstr(use->CopyWithType(), deopt_id); 629 converted = new(I) UnboxIntegerInstr(use->CopyWithType(), deopt_id);
629 } else if ((from == kUnboxedMint) && (to == kTagged)) { 630 } else if ((from == kUnboxedMint) && (to == kTagged)) {
630 converted = new(I) BoxIntegerInstr(use->CopyWithType()); 631 converted = new(I) BoxIntegerInstr(use->CopyWithType());
632 } else if ((from == kUnboxedUint32) && (to == kTagged)) {
633 converted = new(I) BoxUint32Instr(use->CopyWithType());
631 } else if (IsUnboxedInteger(from) && IsUnboxedInteger(to)) { 634 } else if (IsUnboxedInteger(from) && IsUnboxedInteger(to)) {
632 const intptr_t deopt_id = (to == kUnboxedInt32) && (deopt_target != NULL) ? 635 const intptr_t deopt_id = (to == kUnboxedInt32) && (deopt_target != NULL) ?
633 deopt_target->DeoptimizationTarget() : Isolate::kNoDeoptId; 636 deopt_target->DeoptimizationTarget() : Isolate::kNoDeoptId;
634 converted = new(I) UnboxedIntConverterInstr(from, 637 converted = new(I) UnboxedIntConverterInstr(from,
635 to, 638 to,
636 use->CopyWithType(), 639 use->CopyWithType(),
637 deopt_id); 640 deopt_id);
638 } else if ((from == kUnboxedInt32) && (to == kUnboxedDouble)) { 641 } else if ((from == kUnboxedInt32) && (to == kUnboxedDouble)) {
639 converted = new Int32ToDoubleInstr(use->CopyWithType()); 642 converted = new Int32ToDoubleInstr(use->CopyWithType());
640 } else if ((from == kTagged) && (to == kUnboxedInt32)) { 643 } else if ((from == kTagged) && (to == kUnboxedInt32)) {
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after
1348 &array, 1351 &array,
1349 index, 1352 index,
1350 &cursor); 1353 &cursor);
1351 1354
1352 // Check if store barrier is needed. Byte arrays don't need a store barrier. 1355 // Check if store barrier is needed. Byte arrays don't need a store barrier.
1353 StoreBarrierType needs_store_barrier = 1356 StoreBarrierType needs_store_barrier =
1354 (RawObject::IsTypedDataClassId(array_cid) || 1357 (RawObject::IsTypedDataClassId(array_cid) ||
1355 RawObject::IsTypedDataViewClassId(array_cid) || 1358 RawObject::IsTypedDataViewClassId(array_cid) ||
1356 RawObject::IsExternalTypedDataClassId(array_cid)) ? kNoStoreBarrier 1359 RawObject::IsExternalTypedDataClassId(array_cid)) ? kNoStoreBarrier
1357 : kEmitStoreBarrier; 1360 : kEmitStoreBarrier;
1358 if (!value_check.IsNull()) { 1361
1362 // No need to class check stores to Int32 and Uint32 arrays because
1363 // we insert unboxing instructions below which include a class check.
1364 if ((array_cid != kTypedDataUint32ArrayCid) &&
1365 (array_cid != kTypedDataInt32ArrayCid) &&
1366 !value_check.IsNull()) {
1359 // No store barrier needed because checked value is a smi, an unboxed mint, 1367 // No store barrier needed because checked value is a smi, an unboxed mint,
1360 // an unboxed double, an unboxed Float32x4, or unboxed Int32x4. 1368 // an unboxed double, an unboxed Float32x4, or unboxed Int32x4.
1361 needs_store_barrier = kNoStoreBarrier; 1369 needs_store_barrier = kNoStoreBarrier;
1362 Instruction* check = GetCheckClass( 1370 Instruction* check = GetCheckClass(
1363 stored_value, value_check, call->deopt_id(), call->token_pos()); 1371 stored_value, value_check, call->deopt_id(), call->token_pos());
1364 cursor = flow_graph()->AppendTo(cursor, 1372 cursor = flow_graph()->AppendTo(cursor,
1365 check, 1373 check,
1366 call->env(), 1374 call->env(),
1367 FlowGraph::kEffect); 1375 FlowGraph::kEffect);
1368 } 1376 }
(...skipping 8726 matching lines...) Expand 10 before | Expand all | Expand 10 after
10095 10103
10096 // Insert materializations at environment uses. 10104 // Insert materializations at environment uses.
10097 for (intptr_t i = 0; i < exits_collector_.exits().length(); i++) { 10105 for (intptr_t i = 0; i < exits_collector_.exits().length(); i++) {
10098 CreateMaterializationAt( 10106 CreateMaterializationAt(
10099 exits_collector_.exits()[i], alloc, alloc->cls(), *slots); 10107 exits_collector_.exits()[i], alloc, alloc->cls(), *slots);
10100 } 10108 }
10101 } 10109 }
10102 10110
10103 10111
10104 } // namespace dart 10112 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698