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

Unified Diff: runtime/vm/flow_graph_optimizer.cc

Issue 10911214: Split array loads/stores for growable arrays into two IL instructions. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/vm/il_printer.cc » ('j') | runtime/vm/intermediate_language.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_optimizer.cc
===================================================================
--- runtime/vm/flow_graph_optimizer.cc (revision 12196)
+++ runtime/vm/flow_graph_optimizer.cc (working copy)
@@ -348,6 +348,16 @@
call),
call->env(),
Definition::kEffect);
+ if (class_id == kGrowableObjectArrayCid) {
+ // Insert data elements load.
+ // TODO(fschneider): type of load should be GrowableObjectArrayType.
+ LoadVMFieldInstr* elements =
+ new LoadVMFieldInstr(array->Copy(),
+ GrowableObjectArray::data_offset(),
+ AbstractType::ZoneHandle());
srdjan 2012/09/12 07:06:40 Add: elements->set_result_cid(kArrayCid); As
Florian Schneider 2012/09/12 08:27:29 Done.
+ InsertBefore(call, elements, NULL, Definition::kValue);
+ array = new Value(elements);
+ }
Definition* array_op = NULL;
if (op_kind == Token::kINDEX) {
array_op = new LoadIndexedInstr(array, index, class_id);
@@ -614,10 +624,12 @@
return false;
}
intptr_t length_offset = -1;
+ bool is_immutable = false;
switch (recognized_kind) {
case MethodRecognizer::kObjectArrayLength:
case MethodRecognizer::kImmutableArrayLength:
length_offset = Array::length_offset();
+ is_immutable = true;
break;
case MethodRecognizer::kGrowableArrayLength:
length_offset = GrowableObjectArray::length_offset();
@@ -631,7 +643,8 @@
LoadVMFieldInstr* load = new LoadVMFieldInstr(
call->ArgumentAt(0)->value(),
length_offset,
- Type::ZoneHandle(Type::SmiType()));
+ Type::ZoneHandle(Type::SmiType()),
+ is_immutable);
load->set_result_cid(kSmiCid);
call->ReplaceWith(load, current_iterator());
RemovePushArguments(call);
@@ -669,10 +682,12 @@
// Check receiver class.
AddCheckClass(call, call->ArgumentAt(0)->value()->Copy());
+ const bool is_immutable = true; // String length is immutable.
LoadVMFieldInstr* load = new LoadVMFieldInstr(
call->ArgumentAt(0)->value(),
String::length_offset(),
- Type::ZoneHandle(Type::SmiType()));
+ Type::ZoneHandle(Type::SmiType()),
+ is_immutable);
load->set_result_cid(kSmiCid);
call->ReplaceWith(load, current_iterator());
RemovePushArguments(call);
@@ -1308,7 +1323,7 @@
Definition* current = it.Current()->AsDefinition();
if (current != NULL &&
!current->IsPushArgument() &&
- !current->HasSideEffect()) {
+ !current->AffectedBySideEffect()) {
bool inputs_loop_invariant = true;
for (int i = 0; i < current->InputCount(); ++i) {
Definition* input_def = current->InputAt(i)->definition();
@@ -1342,7 +1357,7 @@
DirectChainedHashMap<Definition*>* map) {
for (ForwardInstructionIterator it(block); !it.Done(); it.Advance()) {
Definition* defn = it.Current()->AsDefinition();
- if ((defn == NULL) || defn->HasSideEffect()) continue;
+ if ((defn == NULL) || defn->AffectedBySideEffect()) continue;
Definition* result = map->Lookup(defn);
if (result == NULL) {
map->Insert(defn);
« no previous file with comments | « no previous file | runtime/vm/il_printer.cc » ('j') | runtime/vm/intermediate_language.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698