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

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

Issue 14386011: Fix recognition of factories (for setting result cid) and add them to checks. (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 | « runtime/vm/flow_graph_builder.h ('k') | runtime/vm/object.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 2028 matching lines...) Expand 10 before | Expand all | Expand 10 after
2039 arguments->Add(push_ctor_arg); 2039 arguments->Add(push_ctor_arg);
2040 2040
2041 BuildPushArguments(*node->arguments(), arguments); 2041 BuildPushArguments(*node->arguments(), arguments);
2042 Do(new StaticCallInstr(node->token_pos(), 2042 Do(new StaticCallInstr(node->token_pos(),
2043 node->constructor(), 2043 node->constructor(),
2044 node->arguments()->names(), 2044 node->arguments()->names(),
2045 arguments)); 2045 arguments));
2046 } 2046 }
2047 2047
2048 2048
2049 // List of recognized list factories in core lib:
2050 // (factory-name-symbol, result-cid, fingerprint).
2051 // TODO(srdjan): Store the values in the snapshot instead.
2052 #define RECOGNIZED_LIST_FACTORY_LIST(V) \
2053 V(ObjectArrayFactory, kArrayCid, 97987288) \
2054 V(GrowableObjectArrayWithData, kGrowableObjectArrayCid, 816132033) \
2055 V(GrowableObjectArrayFactory, kGrowableObjectArrayCid, 552407276) \
2056 V(Int8ListFactory, kTypedDataInt8ArrayCid, 1299195009) \
2057 V(Uint8ListFactory, kTypedDataUint8ArrayCid, 1493118613) \
2058 V(Uint8ClampedListFactory, kTypedDataUint8ClampedArrayCid, 642014193) \
2059 V(Int16ListFactory, kTypedDataInt16ArrayCid, 1346619471) \
2060 V(Uint16ListFactory, kTypedDataUint16ArrayCid, 1374024153) \
2061 V(Int32ListFactory, kTypedDataInt32ArrayCid, 1583592980) \
2062 V(Uint32ListFactory, kTypedDataUint32ArrayCid, 1940214615) \
2063 V(Int64ListFactory, kTypedDataInt64ArrayCid, 108181413) \
2064 V(Uint64ListFactory, kTypedDataUint64ArrayCid, 375587484) \
2065 V(Float64ListFactory, kTypedDataFloat64ArrayCid, 919047725) \
2066 V(Float32ListFactory, kTypedDataFloat32ArrayCid, 1038684997) \
2067 V(Float32x4ListFactory, kTypedDataFloat32x4ArrayCid, 801641591) \
2068
2069
2070 // Class that recognizes factories and returns corresponding result cid. 2049 // Class that recognizes factories and returns corresponding result cid.
2071 class FactoryRecognizer : public AllStatic { 2050 class FactoryRecognizer : public AllStatic {
2072 public: 2051 public:
2073 // Return kDynamicCid if factory is not recognized. 2052 // Return kDynamicCid if factory is not recognized.
2074 static intptr_t ResultCid(const Function& factory) { 2053 static intptr_t ResultCid(const Function& factory) {
2075 ASSERT(factory.IsFactory()); 2054 ASSERT(factory.IsFactory());
2076 const Class& function_class = Class::Handle(factory.Owner()); 2055 const Class& function_class = Class::Handle(factory.Owner());
2077 const Library& lib = Library::Handle(function_class.library()); 2056 const Library& lib = Library::Handle(function_class.library());
2078 ASSERT((lib.raw() == Library::CoreLibrary()) || 2057 ASSERT((lib.raw() == Library::CoreLibrary()) ||
2079 (lib.raw() == Library::TypedDataLibrary())); 2058 (lib.raw() == Library::TypedDataLibrary()));
(...skipping 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after
3381 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; 3360 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1;
3382 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 3361 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
3383 OS::SNPrint(chars, len, kFormat, function_name, reason); 3362 OS::SNPrint(chars, len, kFormat, function_name, reason);
3384 const Error& error = Error::Handle( 3363 const Error& error = Error::Handle(
3385 LanguageError::New(String::Handle(String::New(chars)))); 3364 LanguageError::New(String::Handle(String::New(chars))));
3386 Isolate::Current()->long_jump_base()->Jump(1, error); 3365 Isolate::Current()->long_jump_base()->Jump(1, error);
3387 } 3366 }
3388 3367
3389 3368
3390 } // namespace dart 3369 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_builder.h ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698