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

Side by Side Diff: runtime/vm/intermediate_language.h

Issue 11886044: Set statically known ResultCid for AllocateObject. (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
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 #ifndef VM_INTERMEDIATE_LANGUAGE_H_ 5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_
6 #define VM_INTERMEDIATE_LANGUAGE_H_ 6 #define VM_INTERMEDIATE_LANGUAGE_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 #include "vm/ast.h" 9 #include "vm/ast.h"
10 #include "vm/growable_array.h" 10 #include "vm/growable_array.h"
(...skipping 2894 matching lines...) Expand 10 before | Expand all | Expand 10 after
2905 const bool negate_result_; 2905 const bool negate_result_;
2906 2906
2907 DISALLOW_COPY_AND_ASSIGN(InstanceOfInstr); 2907 DISALLOW_COPY_AND_ASSIGN(InstanceOfInstr);
2908 }; 2908 };
2909 2909
2910 2910
2911 class AllocateObjectInstr : public TemplateDefinition<0> { 2911 class AllocateObjectInstr : public TemplateDefinition<0> {
2912 public: 2912 public:
2913 AllocateObjectInstr(ConstructorCallNode* node, 2913 AllocateObjectInstr(ConstructorCallNode* node,
2914 ZoneGrowableArray<PushArgumentInstr*>* arguments) 2914 ZoneGrowableArray<PushArgumentInstr*>* arguments)
2915 : ast_node_(*node), arguments_(arguments) { 2915 : ast_node_(*node),
2916 arguments_(arguments),
2917 cid_(Class::Handle(node->constructor().Owner()).id()) {
2916 // Either no arguments or one type-argument and one instantiator. 2918 // Either no arguments or one type-argument and one instantiator.
2917 ASSERT(arguments->is_empty() || (arguments->length() == 2)); 2919 ASSERT(arguments->is_empty() || (arguments->length() == 2));
2918 } 2920 }
2919 2921
2920 DECLARE_INSTRUCTION(AllocateObject) 2922 DECLARE_INSTRUCTION(AllocateObject)
2921 virtual RawAbstractType* CompileType() const; 2923 virtual RawAbstractType* CompileType() const;
2922 2924
2923 virtual intptr_t ArgumentCount() const { return arguments_->length(); } 2925 virtual intptr_t ArgumentCount() const { return arguments_->length(); }
2924 PushArgumentInstr* ArgumentAt(intptr_t index) const { 2926 PushArgumentInstr* ArgumentAt(intptr_t index) const {
2925 return (*arguments_)[index]; 2927 return (*arguments_)[index];
2926 } 2928 }
2927 2929
2928 const Function& constructor() const { return ast_node_.constructor(); } 2930 const Function& constructor() const { return ast_node_.constructor(); }
2929 intptr_t token_pos() const { return ast_node_.token_pos(); } 2931 intptr_t token_pos() const { return ast_node_.token_pos(); }
2930 2932
2931 virtual void PrintOperandsTo(BufferFormatter* f) const; 2933 virtual void PrintOperandsTo(BufferFormatter* f) const;
2932 2934
2933 virtual bool CanDeoptimize() const { return false; } 2935 virtual bool CanDeoptimize() const { return false; }
2934 2936
2935 virtual bool HasSideEffect() const { return true; } 2937 virtual bool HasSideEffect() const { return true; }
2936 2938
2937 virtual intptr_t ResultCid() const { return kDynamicCid; } 2939 virtual intptr_t ResultCid() const { return cid_; }
2938 2940
2939 private: 2941 private:
2940 const ConstructorCallNode& ast_node_; 2942 const ConstructorCallNode& ast_node_;
2941 ZoneGrowableArray<PushArgumentInstr*>* const arguments_; 2943 ZoneGrowableArray<PushArgumentInstr*>* const arguments_;
2944 const intptr_t cid_;
2942 2945
2943 DISALLOW_COPY_AND_ASSIGN(AllocateObjectInstr); 2946 DISALLOW_COPY_AND_ASSIGN(AllocateObjectInstr);
2944 }; 2947 };
2945 2948
2946 2949
2947 class AllocateObjectWithBoundsCheckInstr : public TemplateDefinition<2> { 2950 class AllocateObjectWithBoundsCheckInstr : public TemplateDefinition<2> {
2948 public: 2951 public:
2949 AllocateObjectWithBoundsCheckInstr(ConstructorCallNode* node, 2952 AllocateObjectWithBoundsCheckInstr(ConstructorCallNode* node,
2950 Value* type_arguments, 2953 Value* type_arguments,
2951 Value* instantiator) 2954 Value* instantiator)
(...skipping 1434 matching lines...) Expand 10 before | Expand all | Expand 10 after
4386 ForwardInstructionIterator* current_iterator_; 4389 ForwardInstructionIterator* current_iterator_;
4387 4390
4388 private: 4391 private:
4389 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 4392 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
4390 }; 4393 };
4391 4394
4392 4395
4393 } // namespace dart 4396 } // namespace dart
4394 4397
4395 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 4398 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698