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

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

Issue 23584002: Replace guarded list length field loads with constants (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 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 | « runtime/vm/flow_graph_optimizer.cc ('k') | 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/intermediate_language.h" 5 #include "vm/intermediate_language.h"
6 6
7 #include "vm/bigint_operations.h" 7 #include "vm/bigint_operations.h"
8 #include "vm/bit_vector.h" 8 #include "vm/bit_vector.h"
9 #include "vm/dart_entry.h" 9 #include "vm/dart_entry.h"
10 #include "vm/flow_graph_allocator.h" 10 #include "vm/flow_graph_allocator.h"
(...skipping 1348 matching lines...) Expand 10 before | Expand all | Expand 10 after
1359 1359
1360 // For fixed length arrays if the array is the result of a known constructor 1360 // For fixed length arrays if the array is the result of a known constructor
1361 // call we can replace the length load with the length argument passed to 1361 // call we can replace the length load with the length argument passed to
1362 // the constructor. 1362 // the constructor.
1363 StaticCallInstr* call = instance()->definition()->AsStaticCall(); 1363 StaticCallInstr* call = instance()->definition()->AsStaticCall();
1364 if ((call != NULL) && 1364 if ((call != NULL) &&
1365 call->is_known_list_constructor() && 1365 call->is_known_list_constructor() &&
1366 IsFixedLengthArrayCid(call->Type()->ToCid())) { 1366 IsFixedLengthArrayCid(call->Type()->ToCid())) {
1367 return call->ArgumentAt(1); 1367 return call->ArgumentAt(1);
1368 } 1368 }
1369 // For arrays with guarded lengths, replace the length load
1370 // with a constant.
1371 LoadFieldInstr* load_array = instance()->definition()->AsLoadField();
1372 if (load_array != NULL) {
1373 const Field* field = load_array->field();
srdjan 2013/08/28 15:15:08 'field' can be null, do you need to check?
Cutch 2013/08/29 07:23:26 Done. Conceptual/context question: What does a Loa
1374 if (field->guarded_list_length() >= 0) {
1375 return flow_graph->GetConstant(
1376 Smi::Handle(Smi::New(field->guarded_list_length())));
1377 }
1378 }
1369 return this; 1379 return this;
1370 } 1380 }
1371 1381
1372 1382
1373 Definition* AssertBooleanInstr::Canonicalize(FlowGraph* flow_graph) { 1383 Definition* AssertBooleanInstr::Canonicalize(FlowGraph* flow_graph) {
1374 if (FLAG_eliminate_type_checks && (value()->Type()->ToCid() == kBoolCid)) { 1384 if (FLAG_eliminate_type_checks && (value()->Type()->ToCid() == kBoolCid)) {
1375 return value()->definition(); 1385 return value()->definition();
1376 } 1386 }
1377 1387
1378 return this; 1388 return this;
(...skipping 1272 matching lines...) Expand 10 before | Expand all | Expand 10 after
2651 default: 2661 default:
2652 UNREACHABLE(); 2662 UNREACHABLE();
2653 } 2663 }
2654 return kPowRuntimeEntry; 2664 return kPowRuntimeEntry;
2655 } 2665 }
2656 2666
2657 2667
2658 #undef __ 2668 #undef __
2659 2669
2660 } // namespace dart 2670 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_optimizer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698