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

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

Issue 11788018: Recognize List.fixedLength factory constructor. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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 | « no previous file | runtime/vm/symbols.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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_builder.h" 5 #include "vm/flow_graph_builder.h"
6 6
7 #include "vm/ast_printer.h" 7 #include "vm/ast_printer.h"
8 #include "vm/code_descriptors.h" 8 #include "vm/code_descriptors.h"
9 #include "vm/dart_entry.h" 9 #include "vm/dart_entry.h"
10 #include "vm/flags.h" 10 #include "vm/flags.h"
(...skipping 1797 matching lines...) Expand 10 before | Expand all | Expand 10 after
1808 const Class& function_class = Class::Handle(function.Owner()); 1808 const Class& function_class = Class::Handle(function.Owner());
1809 const Library& core_lib = Library::Handle(Library::CoreLibrary()); 1809 const Library& core_lib = Library::Handle(Library::CoreLibrary());
1810 1810
1811 if (function_class.library() != core_lib.raw()) { 1811 if (function_class.library() != core_lib.raw()) {
1812 return kDynamicCid; 1812 return kDynamicCid;
1813 } 1813 }
1814 1814
1815 if (node->constructor().IsFactory()) { 1815 if (node->constructor().IsFactory()) {
1816 if ((function_class.Name() == Symbols::List().raw()) && 1816 if ((function_class.Name() == Symbols::List().raw()) &&
1817 (function.name() == Symbols::ListFactory().raw())) { 1817 (function.name() == Symbols::ListFactory().raw())) {
1818 // If there are no arguments then the result is guaranteed to be a
1819 // GrowableObjectArray. However if there is an argument the result
1820 // is not guaranteed to be a fixed size array because the argument
1821 // can be null.
1822 return kGrowableObjectArrayCid; 1818 return kGrowableObjectArrayCid;
1819 } else if ((function_class.Name() == Symbols::List().raw()) &&
1820 (function.name() == Symbols::ListFixedLengthFactory().raw())) {
1821 return kArrayCid;
1823 } else { 1822 } else {
1824 if (IsRecognizedConstructor(function, Symbols::ObjectArray()) && 1823 if (IsRecognizedConstructor(function, Symbols::ObjectArray()) &&
1825 (node->arguments()->length() == 1)) { 1824 (node->arguments()->length() == 1)) {
1826 return kArrayCid; 1825 return kArrayCid;
1827 } else if (IsRecognizedConstructor(function, 1826 } else if (IsRecognizedConstructor(function,
1828 Symbols::GrowableObjectArray()) && 1827 Symbols::GrowableObjectArray()) &&
1829 (node->arguments()->length() == 0)) { 1828 (node->arguments()->length() == 0)) {
1830 return kGrowableObjectArrayCid; 1829 return kGrowableObjectArrayCid;
1831 } 1830 }
1832 } 1831 }
(...skipping 1236 matching lines...) Expand 10 before | Expand all | Expand 10 after
3069 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; 3068 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1;
3070 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 3069 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
3071 OS::SNPrint(chars, len, kFormat, function_name, reason); 3070 OS::SNPrint(chars, len, kFormat, function_name, reason);
3072 const Error& error = Error::Handle( 3071 const Error& error = Error::Handle(
3073 LanguageError::New(String::Handle(String::New(chars)))); 3072 LanguageError::New(String::Handle(String::New(chars))));
3074 Isolate::Current()->long_jump_base()->Jump(1, error); 3073 Isolate::Current()->long_jump_base()->Jump(1, error);
3075 } 3074 }
3076 3075
3077 3076
3078 } // namespace dart 3077 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/symbols.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698