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

Unified Diff: runtime/vm/intermediate_language.h

Issue 10280007: Check upper bounds of type arguments when allocating objects of a generic type (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/flow_graph_compiler_x64.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language.h
===================================================================
--- runtime/vm/intermediate_language.h (revision 7210)
+++ runtime/vm/intermediate_language.h (working copy)
@@ -52,6 +52,7 @@
M(CreateArray, CreateArrayComp) \
M(CreateClosure, CreateClosureComp) \
M(AllocateObject, AllocateObjectComp) \
+ M(AllocateObjectWithBoundsCheck, AllocateObjectWithBoundsCheckComp) \
M(NativeLoadField, NativeLoadFieldComp) \
M(ExtractFactoryTypeArguments, ExtractFactoryTypeArgumentsComp) \
M(ExtractConstructorTypeArguments, ExtractConstructorTypeArgumentsComp) \
@@ -769,6 +770,31 @@
};
+class AllocateObjectWithBoundsCheckComp : public Computation {
+ public:
+ AllocateObjectWithBoundsCheckComp(ConstructorCallNode* node,
+ intptr_t try_index,
+ ZoneGrowableArray<Value*>* arguments)
+ : ast_node_(*node), try_index_(try_index), arguments_(arguments) {
+ // One type-argument and one instantiator.
+ ASSERT(arguments->length() == 2);
+ }
+
+ DECLARE_COMPUTATION(AllocateObjectWithBoundsCheck)
+
+ const Function& constructor() const { return ast_node_.constructor(); }
+ intptr_t token_index() const { return ast_node_.token_index(); }
+ intptr_t try_index() const { return try_index_; }
+ const ZoneGrowableArray<Value*>& arguments() const { return *arguments_; }
+
+ private:
+ const ConstructorCallNode& ast_node_;
+ const intptr_t try_index_;
+ ZoneGrowableArray<Value*>* const arguments_;
+ DISALLOW_COPY_AND_ASSIGN(AllocateObjectWithBoundsCheckComp);
+};
+
+
class CreateArrayComp : public Computation {
public:
CreateArrayComp(ArrayNode* node,
« no previous file with comments | « runtime/vm/flow_graph_compiler_x64.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698