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

Unified Diff: runtime/vm/intermediate_language.h

Issue 10541135: Some cleanups, started implementing checked instance calls, better equality operation. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 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
Index: runtime/vm/intermediate_language.h
===================================================================
--- runtime/vm/intermediate_language.h (revision 8588)
+++ runtime/vm/intermediate_language.h (working copy)
@@ -36,6 +36,7 @@
M(StoreContext, StoreContextComp) \
M(ClosureCall, ClosureCallComp) \
M(InstanceCall, InstanceCallComp) \
+ M(CheckedInstanceCall, CheckedInstanceCallComp) \
M(StaticCall, StaticCallComp) \
M(LoadLocal, LoadLocalComp) \
M(StoreLocal, StoreLocalComp) \
@@ -145,6 +146,8 @@
static LocationSummary* MakeCallSummary();
+ void ReplaceWith(Computation* other);
+
// Declare an enum value used to define type-test predicates.
enum ComputationType {
#define DECLARE_COMPUTATION_TYPE(ShortName, ClassName) k##ShortName,
@@ -497,6 +500,41 @@
};
+class CheckedInstanceCallComp : public Computation {
Vyacheslav Egorov (Google) 2012/06/13 09:02:27 Should not this be PolymorphicInstanceCall or some
srdjan 2012/06/13 18:34:24 Renaming to PolymorphicInstanceCall.
+ public:
+ CheckedInstanceCallComp(InstanceCallComp* comp,
+ const ZoneGrowableArray<intptr_t>& class_ids,
+ const ZoneGrowableArray<Function*>& targets)
+ : instance_call_(comp),
+ class_ids_(class_ids),
+ targets_(targets) {
+ ASSERT(instance_call_ != NULL);
+ }
+
+ InstanceCallComp* instance_call() const { return instance_call_; }
+ const ZoneGrowableArray<intptr_t>& class_ids() const { return class_ids_; }
+ const ZoneGrowableArray<Function*>& targets() const { return targets_; }
+
+ virtual intptr_t InputCount() const { return instance_call()->InputCount(); }
+ virtual Value* InputAt(intptr_t i) const {
+ return instance_call()->ArgumentAt(i);
+ }
+
+ virtual void PrintOperandsTo(BufferFormatter* f) const {
+ instance_call()->PrintOperandsTo(f);
+ }
+
+ DECLARE_COMPUTATION(CheckedInstanceCall)
+
+ private:
+ InstanceCallComp* instance_call_;
+ const ZoneGrowableArray<intptr_t>& class_ids_;
+ const ZoneGrowableArray<Function*>& targets_;
+
+ DISALLOW_COPY_AND_ASSIGN(CheckedInstanceCallComp);
+};
+
+
class StrictCompareComp : public TemplateComputation<2> {
public:
StrictCompareComp(Token::Kind kind, Value* left, Value* right)
@@ -528,7 +566,8 @@
Value* left,
Value* right)
: token_index_(token_index),
- try_index_(try_index) {
+ try_index_(try_index),
+ operands_class_id_(kObject) {
ASSERT(left != NULL);
ASSERT(right != NULL);
inputs_[0] = left;
@@ -541,12 +580,17 @@
intptr_t try_index() const { return try_index_; }
Value* left() const { return inputs_[0]; }
Value* right() const { return inputs_[1]; }
+ void set_operands_class_id(intptr_t value) {
+ operands_class_id_ = value;
+ }
+ intptr_t operands_class_id() const { return operands_class_id_; }
virtual void PrintOperandsTo(BufferFormatter* f) const;
private:
const intptr_t token_index_;
const intptr_t try_index_;
+ intptr_t operands_class_id_; // class id of both operands.
DISALLOW_COPY_AND_ASSIGN(EqualityCompareComp);
};

Powered by Google App Engine
This is Rietveld 408576698