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

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

Issue 13004017: More preparation for removal of dart:scalarlist (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 8 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/flow_graph_compiler.cc » ('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 "lib/invocation_mirror.h" 7 #include "lib/invocation_mirror.h"
8 #include "vm/ast_printer.h" 8 #include "vm/ast_printer.h"
9 #include "vm/code_descriptors.h" 9 #include "vm/code_descriptors.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 1784 matching lines...) Expand 10 before | Expand all | Expand 10 after
1795 InstanceCallInstr* call = new InstanceCallInstr( 1795 InstanceCallInstr* call = new InstanceCallInstr(
1796 node->token_pos(), 1796 node->token_pos(),
1797 node->function_name(), Token::kILLEGAL, arguments, 1797 node->function_name(), Token::kILLEGAL, arguments,
1798 node->arguments()->names(), 1); 1798 node->arguments()->names(), 1);
1799 ReturnDefinition(call); 1799 ReturnDefinition(call);
1800 } 1800 }
1801 1801
1802 1802
1803 static intptr_t GetResultCidOfNative(const Function& function) { 1803 static intptr_t GetResultCidOfNative(const Function& function) {
1804 const Class& function_class = Class::Handle(function.Owner()); 1804 const Class& function_class = Class::Handle(function.Owner());
1805 if (function_class.library() == Library::ScalarlistLibrary()) { 1805 if (function_class.library() == Library::TypedDataLibrary()) {
1806 const String& function_name = String::Handle(function.name()); 1806 const String& function_name = String::Handle(function.name());
1807 if (!String::EqualsIgnoringPrivateKey(function_name, Symbols::_New())) { 1807 if (!String::EqualsIgnoringPrivateKey(function_name, Symbols::_New())) {
1808 return kDynamicCid; 1808 return kDynamicCid;
1809 } 1809 }
1810 switch (function_class.id()) { 1810 switch (function_class.id()) {
1811 case kInt8ArrayCid: 1811 case kTypedDataInt8ArrayCid:
1812 case kUint8ArrayCid: 1812 case kTypedDataUint8ArrayCid:
1813 case kUint8ClampedArrayCid: 1813 case kTypedDataUint8ClampedArrayCid:
1814 case kInt16ArrayCid: 1814 case kTypedDataInt16ArrayCid:
1815 case kUint16ArrayCid: 1815 case kTypedDataUint16ArrayCid:
1816 case kInt32ArrayCid: 1816 case kTypedDataInt32ArrayCid:
1817 case kUint32ArrayCid: 1817 case kTypedDataUint32ArrayCid:
1818 case kInt64ArrayCid: 1818 case kTypedDataInt64ArrayCid:
1819 case kUint64ArrayCid: 1819 case kTypedDataUint64ArrayCid:
1820 case kFloat32ArrayCid: 1820 case kTypedDataFloat32ArrayCid:
1821 case kFloat64ArrayCid: 1821 case kTypedDataFloat64ArrayCid:
1822 return function_class.id(); 1822 return function_class.id();
1823 default: 1823 default:
1824 return kDynamicCid; // Unknown. 1824 return kDynamicCid; // Unknown.
1825 } 1825 }
1826 } 1826 }
1827 return kDynamicCid; 1827 return kDynamicCid;
1828 } 1828 }
1829 1829
1830 1830
1831 // <Expression> ::= StaticCall { function: Function 1831 // <Expression> ::= StaticCall { function: Function
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
1972 1972
1973 1973
1974 // List of recognized list factories in core lib: 1974 // List of recognized list factories in core lib:
1975 // (factory-name-symbol, result-cid, fingerprint). 1975 // (factory-name-symbol, result-cid, fingerprint).
1976 // TODO(srdjan): Store the values in the snapshot instead. 1976 // TODO(srdjan): Store the values in the snapshot instead.
1977 // TODO(srdjan): Add Float32x4List. 1977 // TODO(srdjan): Add Float32x4List.
1978 #define RECOGNIZED_LIST_FACTORY_LIST(V) \ 1978 #define RECOGNIZED_LIST_FACTORY_LIST(V) \
1979 V(ObjectArrayFactory, kArrayCid, 97987288) \ 1979 V(ObjectArrayFactory, kArrayCid, 97987288) \
1980 V(GrowableObjectArrayWithData, kGrowableObjectArrayCid, 816132033) \ 1980 V(GrowableObjectArrayWithData, kGrowableObjectArrayCid, 816132033) \
1981 V(GrowableObjectArrayFactory, kGrowableObjectArrayCid, 224791427) \ 1981 V(GrowableObjectArrayFactory, kGrowableObjectArrayCid, 224791427) \
1982 V(Int8ListFactory, kInt8ArrayCid, 216496111) \ 1982 V(Int8ListFactory, kTypedDataInt8ArrayCid, 1178498933) \
1983 V(Uint8ListFactory, kUint8ArrayCid, 1767464978) \ 1983 V(Uint8ListFactory, kTypedDataUint8ArrayCid, 996047641) \
1984 V(Uint8ClampedListFactory, kUint8ClampedArrayCid, 1968602860) \ 1984 V(Uint8ClampedListFactory, kTypedDataUint8ClampedArrayCid, 1504313643) \
1985 V(Int16ListFactory, kInt16ArrayCid, 1760814825) \ 1985 V(Int16ListFactory, kTypedDataInt16ArrayCid, 1595869856) \
1986 V(Uint16ListFactory, kUint16ArrayCid, 1684498763) \ 1986 V(Uint16ListFactory, kTypedDataUint16ArrayCid, 665298027) \
1987 V(Int32ListFactory, kInt32ArrayCid, 1376656162) \ 1987 V(Int32ListFactory, kTypedDataInt32ArrayCid, 728173538) \
1988 V(Uint32ListFactory, kUint32ArrayCid, 1954207744) \ 1988 V(Uint32ListFactory, kTypedDataUint32ArrayCid, 352036624) \
1989 V(Int64ListFactory, kInt64ArrayCid, 284215425) \ 1989 V(Int64ListFactory, kTypedDataInt64ArrayCid, 105935265) \
1990 V(Uint64ListFactory, kUint64ArrayCid, 870102373) \ 1990 V(Uint64ListFactory, kTypedDataUint64ArrayCid, 943403644) \
1991 V(Float64ListFactory, kFloat64ArrayCid, 436526211) \ 1991 V(Float64ListFactory, kTypedDataFloat64ArrayCid, 348533743) \
1992 V(Float32ListFactory, kFloat32ArrayCid, 1434337247) \ 1992 V(Float32ListFactory, kTypedDataFloat32ArrayCid, 1830794379) \
1993 1993
1994 1994
1995 // Class that recognizes factories and returns corresponding result cid. 1995 // Class that recognizes factories and returns corresponding result cid.
1996 class FactoryRecognizer : public AllStatic { 1996 class FactoryRecognizer : public AllStatic {
1997 public: 1997 public:
1998 // Return kDynamicCid if factory is not recognized. 1998 // Return kDynamicCid if factory is not recognized.
1999 static intptr_t ResultCid(const Function& factory) { 1999 static intptr_t ResultCid(const Function& factory) {
2000 ASSERT(factory.IsFactory()); 2000 ASSERT(factory.IsFactory());
2001 const Class& function_class = Class::Handle(factory.Owner()); 2001 const Class& function_class = Class::Handle(factory.Owner());
2002 const Library& lib = Library::Handle(function_class.library()); 2002 const Library& lib = Library::Handle(function_class.library());
2003 ASSERT((lib.raw() == Library::CoreLibrary()) || 2003 ASSERT((lib.raw() == Library::CoreLibrary()) ||
2004 (lib.raw() == Library::ScalarlistLibrary())); 2004 (lib.raw() == Library::TypedDataLibrary()));
2005 const String& factory_name = String::Handle(factory.name()); 2005 const String& factory_name = String::Handle(factory.name());
2006 #define RECOGNIZE_FACTORY(test_factory_symbol, cid, fp) \ 2006 #define RECOGNIZE_FACTORY(test_factory_symbol, cid, fp) \
2007 if (String::EqualsIgnoringPrivateKey( \ 2007 if (String::EqualsIgnoringPrivateKey( \
2008 factory_name, Symbols::test_factory_symbol())) { \ 2008 factory_name, Symbols::test_factory_symbol())) { \
2009 ASSERT(factory.CheckSourceFingerprint(fp)); \ 2009 ASSERT(factory.CheckSourceFingerprint(fp)); \
2010 return cid; \ 2010 return cid; \
2011 } \ 2011 } \
2012 2012
2013 RECOGNIZED_LIST_FACTORY_LIST(RECOGNIZE_FACTORY); 2013 RECOGNIZED_LIST_FACTORY_LIST(RECOGNIZE_FACTORY);
2014 #undef RECOGNIZE_FACTORY 2014 #undef RECOGNIZE_FACTORY
2015 2015
2016 return kDynamicCid; 2016 return kDynamicCid;
2017 } 2017 }
2018 }; 2018 };
2019 2019
2020 2020
2021 static intptr_t GetResultCidOfListFactory(ConstructorCallNode* node) { 2021 static intptr_t GetResultCidOfListFactory(ConstructorCallNode* node) {
2022 const Function& function = node->constructor(); 2022 const Function& function = node->constructor();
2023 const Class& function_class = Class::Handle(function.Owner()); 2023 const Class& function_class = Class::Handle(function.Owner());
2024 2024
2025 if ((function_class.library() != Library::CoreLibrary()) && 2025 if ((function_class.library() != Library::CoreLibrary()) &&
2026 (function_class.library() != Library::ScalarlistLibrary())) { 2026 (function_class.library() != Library::TypedDataLibrary())) {
2027 return kDynamicCid; 2027 return kDynamicCid;
2028 } 2028 }
2029 2029
2030 if (node->constructor().IsFactory()) { 2030 if (node->constructor().IsFactory()) {
2031 if ((function_class.Name() == Symbols::List().raw()) && 2031 if ((function_class.Name() == Symbols::List().raw()) &&
2032 (function.name() == Symbols::ListFactory().raw())) { 2032 (function.name() == Symbols::ListFactory().raw())) {
2033 // Special recognition of 'new List()' vs 'new List(n)'. 2033 // Special recognition of 'new List()' vs 'new List(n)'.
2034 if (node->arguments()->length() == 0) { 2034 if (node->arguments()->length() == 0) {
2035 return kGrowableObjectArrayCid; 2035 return kGrowableObjectArrayCid;
2036 } 2036 }
(...skipping 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after
3306 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; 3306 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1;
3307 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 3307 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
3308 OS::SNPrint(chars, len, kFormat, function_name, reason); 3308 OS::SNPrint(chars, len, kFormat, function_name, reason);
3309 const Error& error = Error::Handle( 3309 const Error& error = Error::Handle(
3310 LanguageError::New(String::Handle(String::New(chars)))); 3310 LanguageError::New(String::Handle(String::New(chars))));
3311 Isolate::Current()->long_jump_base()->Jump(1, error); 3311 Isolate::Current()->long_jump_base()->Jump(1, error);
3312 } 3312 }
3313 3313
3314 3314
3315 } // namespace dart 3315 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/flow_graph_compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698