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

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

Issue 18292003: Inline native setters for length and data in the optimizer. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 5 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_builder.h ('k') | runtime/vm/intermediate_language.h » ('j') | 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/flow_graph_builder.h" 9 #include "vm/flow_graph_builder.h"
10 #include "vm/flow_graph_compiler.h" 10 #include "vm/flow_graph_compiler.h"
(...skipping 1659 matching lines...) Expand 10 before | Expand all | Expand 10 after
1670 // No type feedback collected or multiple targets found. 1670 // No type feedback collected or multiple targets found.
1671 return false; 1671 return false;
1672 } 1672 }
1673 1673
1674 Function& target = Function::Handle(); 1674 Function& target = Function::Handle();
1675 GrowableArray<intptr_t> class_ids; 1675 GrowableArray<intptr_t> class_ids;
1676 ic_data.GetCheckAt(0, &class_ids, &target); 1676 ic_data.GetCheckAt(0, &class_ids, &target);
1677 MethodRecognizer::Kind recognized_kind = 1677 MethodRecognizer::Kind recognized_kind =
1678 MethodRecognizer::RecognizeKind(target); 1678 MethodRecognizer::RecognizeKind(target);
1679 1679
1680 if (recognized_kind == MethodRecognizer::kGrowableArraySetData &&
1681 (ic_data.NumberOfChecks() == 1) &&
1682 class_ids[0] == kGrowableObjectArrayCid) {
srdjan 2013/07/08 16:19:06 Add parentheses
Florian Schneider 2013/07/08 16:24:58 Done.
1683 // This is an internal method, no need to check argument types.
1684 Definition* array = call->ArgumentAt(0);
1685 Definition* value = call->ArgumentAt(1);
1686 StoreVMFieldInstr* store = new StoreVMFieldInstr(
1687 new Value(array),
1688 GrowableObjectArray::data_offset(),
1689 new Value(value),
1690 Type::ZoneHandle());
1691 ReplaceCall(call, store);
1692 return true;
1693 }
1694
1695 if (recognized_kind == MethodRecognizer::kGrowableArraySetLength &&
1696 (ic_data.NumberOfChecks() == 1) &&
1697 class_ids[0] == kGrowableObjectArrayCid) {
1698 // This is an internal method, no need to check argument types nor
1699 // range.
1700 Definition* array = call->ArgumentAt(0);
1701 Definition* value = call->ArgumentAt(1);
1702 StoreVMFieldInstr* store = new StoreVMFieldInstr(
1703 new Value(array),
1704 GrowableObjectArray::length_offset(),
1705 new Value(value),
1706 Type::ZoneHandle());
1707 ReplaceCall(call, store);
1708 return true;
1709 }
1710
1680 if ((recognized_kind == MethodRecognizer::kStringBaseCodeUnitAt) && 1711 if ((recognized_kind == MethodRecognizer::kStringBaseCodeUnitAt) &&
1681 (ic_data.NumberOfChecks() == 1) && 1712 (ic_data.NumberOfChecks() == 1) &&
1682 ((class_ids[0] == kOneByteStringCid) || 1713 ((class_ids[0] == kOneByteStringCid) ||
1683 (class_ids[0] == kTwoByteStringCid))) { 1714 (class_ids[0] == kTwoByteStringCid))) {
1684 LoadIndexedInstr* instr = BuildStringCodeUnitAt(call, class_ids[0]); 1715 LoadIndexedInstr* instr = BuildStringCodeUnitAt(call, class_ids[0]);
1685 ReplaceCall(call, instr); 1716 ReplaceCall(call, instr);
1686 return true; 1717 return true;
1687 } 1718 }
1688 if ((class_ids[0] == kOneByteStringCid) && (ic_data.NumberOfChecks() == 1)) { 1719 if ((class_ids[0] == kOneByteStringCid) && (ic_data.NumberOfChecks() == 1)) {
1689 if (recognized_kind == MethodRecognizer::kStringBaseCharAt) { 1720 if (recognized_kind == MethodRecognizer::kStringBaseCharAt) {
(...skipping 5439 matching lines...) Expand 10 before | Expand all | Expand 10 after
7129 7160
7130 // Insert materializations at environment uses. 7161 // Insert materializations at environment uses.
7131 const Class& cls = Class::Handle(alloc->constructor().Owner()); 7162 const Class& cls = Class::Handle(alloc->constructor().Owner());
7132 for (intptr_t i = 0; i < exits.length(); i++) { 7163 for (intptr_t i = 0; i < exits.length(); i++) {
7133 CreateMaterializationAt(exits[i], alloc, cls, *fields); 7164 CreateMaterializationAt(exits[i], alloc, cls, *fields);
7134 } 7165 }
7135 } 7166 }
7136 7167
7137 7168
7138 } // namespace dart 7169 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_builder.h ('k') | runtime/vm/intermediate_language.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698