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

Unified Diff: runtime/vm/flow_graph_optimizer.cc

Issue 285543002: Recognize List constructor and turn it into CreateArray ... (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 7 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 | « runtime/vm/code_generator.cc ('k') | runtime/vm/intermediate_language.h » ('j') | no next file with comments »
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 36136)
+++ runtime/vm/flow_graph_optimizer.cc (working copy)
@@ -4228,6 +4228,12 @@
recognized_kind,
call->token_pos());
ReplaceCall(call, invoke);
+ } else if (recognized_kind == MethodRecognizer::kObjectArrayConstructor) {
+ Value* type = new Value(call->ArgumentAt(0));
+ Value* num_elements = new Value(call->ArgumentAt(1));
+ CreateArrayInstr* create_array =
+ new CreateArrayInstr(call->token_pos(), type, num_elements);
+ ReplaceCall(call, create_array);
} else if (Library::PrivateCoreLibName(Symbols::ClassId()).Equals(
String::Handle(call->function().name()))) {
// Check for core library get:_classId.
@@ -4239,9 +4245,7 @@
(cid == kImmutableArrayCid) || (cid == kArrayCid));
ConstantInstr* cid_instr = new ConstantInstr(Smi::Handle(Smi::New(cid)));
ReplaceCall(call, cid_instr);
- }
-
- if (call->function().IsFactory()) {
+ } else if (call->function().IsFactory()) {
const Class& function_class = Class::Handle(call->function().Owner());
if ((function_class.library() == Library::CoreLibrary()) ||
(function_class.library() == Library::TypedDataLibrary())) {
@@ -5017,6 +5021,7 @@
Instruction* current = instr_it.Current();
if (current->MayThrow()) {
Environment* env = current->env();
+ ASSERT(env != NULL);
for (intptr_t env_idx = 0; env_idx < cdefs.length(); ++env_idx) {
if (cdefs[env_idx] != NULL &&
env->ValueAt(env_idx)->BindsToConstant()) {
« no previous file with comments | « runtime/vm/code_generator.cc ('k') | runtime/vm/intermediate_language.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698