Chromium Code Reviews| Index: runtime/vm/intermediate_language.h |
| =================================================================== |
| --- runtime/vm/intermediate_language.h (revision 10101) |
| +++ runtime/vm/intermediate_language.h (working copy) |
| @@ -194,14 +194,17 @@ |
| virtual ComputationType computation_type() const = 0; |
| // Declare predicate for each computation. |
| -#define DECLARE_PREDICATE(ShortName, ClassName) \ |
| - inline bool Is##ShortName() const; \ |
| +#define DECLARE_PREDICATE(ShortName, ClassName) \ |
| + inline bool Is##ShortName() const; \ |
| inline ClassName* As##ShortName(); |
| FOR_EACH_COMPUTATION(DECLARE_PREDICATE) |
| #undef DECLARE_PREDICATE |
| private: |
| - friend class Instruction; |
| + friend class BranchInstr; |
| + friend class ReturnInstr; |
| + friend class ThrowInstr; |
| + friend class ReThrowInstr; |
|
srdjan
2012/08/01 15:07:36
This is all because of access to GetNextCiD and Ge
regis
2012/08/01 17:10:35
Done.
|
| static intptr_t GetNextCid(Isolate* isolate) { |
| intptr_t tmp = isolate->computation_id(); |
| isolate->set_computation_id(tmp + 1); |
| @@ -297,6 +300,8 @@ |
| public: |
| Value() { } |
| + bool StaticTypeIsMoreSpecificThan(const AbstractType& dst_type); |
|
srdjan
2012/08/01 15:07:36
const ?
regis
2012/08/01 17:10:35
Done. But I needed to overload AsConstant with a c
|
| + |
| private: |
| DISALLOW_COPY_AND_ASSIGN(Value); |
| }; |
| @@ -1724,26 +1729,8 @@ |
| class Instruction : public ZoneAllocated { |
| public: |
| Instruction() |
| - : cid_(-1), |
| - lifetime_position_(-1), |
| - ic_data_(NULL), |
| - previous_(NULL), |
| - next_(NULL), |
| - env_(NULL) { |
| - Isolate* isolate = Isolate::Current(); |
| - cid_ = Computation::GetNextCid(isolate); |
| - ic_data_ = Computation::GetICDataForCid(cid_, isolate); |
| - } |
| + : lifetime_position_(-1), previous_(NULL), next_(NULL), env_(NULL) { } |
| - // Unique computation/instruction id, used for deoptimization, e.g. for |
| - // ReturnInstr, ThrowInstr and ReThrowInstr. |
| - intptr_t cid() const { return cid_; } |
| - |
| - const ICData* ic_data() const { return ic_data_; } |
| - bool HasICData() const { |
| - return (ic_data() != NULL) && !ic_data()->IsNull(); |
| - } |
| - |
| virtual bool IsBlockEntry() const { return false; } |
| BlockEntryInstr* AsBlockEntry() { |
| return IsBlockEntry() ? reinterpret_cast<BlockEntryInstr*>(this) : NULL; |
| @@ -1855,9 +1842,7 @@ |
| } |
| private: |
| - intptr_t cid_; // Computation id. |
| intptr_t lifetime_position_; // Position used by register allocator. |
| - ICData* ic_data_; |
| Instruction* previous_; |
| Instruction* next_; |
| Environment* env_; |
| @@ -2398,20 +2383,27 @@ |
| class ReturnInstr : public InstructionWithInputs { |
| public: |
| ReturnInstr(intptr_t token_pos, Value* value) |
| - : InstructionWithInputs(), token_pos_(token_pos), value_(value) { |
| + : InstructionWithInputs(), |
| + cid_(-1), |
|
srdjan
2012/08/01 15:07:36
make cid_ const and initialize it here.
regis
2012/08/01 17:10:35
Done.
|
| + token_pos_(token_pos), |
| + value_(value) { |
| ASSERT(value_ != NULL); |
| + Isolate* isolate = Isolate::Current(); |
| + cid_ = Computation::GetNextCid(isolate); |
| } |
| DECLARE_INSTRUCTION(Return) |
| + intptr_t cid() const { return cid_; } |
| + intptr_t token_pos() const { return token_pos_; } |
| Value* value() const { return value_; } |
| - intptr_t token_pos() const { return token_pos_; } |
| virtual LocationSummary* MakeLocationSummary() const; |
| virtual void EmitNativeCode(FlowGraphCompiler* compiler); |
| private: |
| + intptr_t cid_; // Computation/instruction id. |
| const intptr_t token_pos_; |
| Value* value_; |
| @@ -2425,14 +2417,18 @@ |
| intptr_t try_index, |
| Value* exception) |
| : InstructionWithInputs(), |
| + cid_(-1), |
|
srdjan
2012/08/01 15:07:36
ditto
regis
2012/08/01 17:10:35
Done.
|
| token_pos_(token_pos), |
| try_index_(try_index), |
| exception_(exception) { |
| ASSERT(exception_ != NULL); |
| + Isolate* isolate = Isolate::Current(); |
| + cid_ = Computation::GetNextCid(isolate); |
| } |
| DECLARE_INSTRUCTION(Throw) |
| + intptr_t cid() const { return cid_; } |
| intptr_t token_pos() const { return token_pos_; } |
| intptr_t try_index() const { return try_index_; } |
| Value* exception() const { return exception_; } |
| @@ -2442,6 +2438,7 @@ |
| virtual void EmitNativeCode(FlowGraphCompiler* compiler); |
| private: |
| + intptr_t cid_; // Computation/instruction id. |
| const intptr_t token_pos_; |
| const intptr_t try_index_; |
| Value* exception_; |
| @@ -2457,16 +2454,20 @@ |
| Value* exception, |
| Value* stack_trace) |
| : InstructionWithInputs(), |
| + cid_(-1), |
|
srdjan
2012/08/01 15:07:36
ditto
regis
2012/08/01 17:10:35
Done.
|
| token_pos_(token_pos), |
| try_index_(try_index), |
| exception_(exception), |
| stack_trace_(stack_trace) { |
| ASSERT(exception_ != NULL); |
| ASSERT(stack_trace_ != NULL); |
| + Isolate* isolate = Isolate::Current(); |
| + cid_ = Computation::GetNextCid(isolate); |
| } |
| DECLARE_INSTRUCTION(ReThrow) |
| + intptr_t cid() const { return cid_; } |
| intptr_t token_pos() const { return token_pos_; } |
| intptr_t try_index() const { return try_index_; } |
| Value* exception() const { return exception_; } |
| @@ -2477,6 +2478,7 @@ |
| virtual void EmitNativeCode(FlowGraphCompiler* compiler); |
| private: |
| + intptr_t cid_; // Computation/instruction id. |
| const intptr_t token_pos_; |
| const intptr_t try_index_; |
| Value* exception_; |
| @@ -2532,10 +2534,12 @@ |
| public: |
| BranchInstr(intptr_t token_pos, |
| intptr_t try_index, |
| - Value* left, |
| - Value* right, |
| + Value* left, |
| + Value* right, |
| Token::Kind kind) |
| : InstructionWithInputs(), |
| + cid_(-1), |
| + ic_data_(NULL), |
| token_pos_(token_pos), |
| try_index_(try_index), |
| left_(left), |
| @@ -2548,6 +2552,9 @@ |
| ASSERT(Token::IsEqualityOperator(kind) || |
| Token::IsRelationalOperator(kind) || |
| Token::IsTypeTestOperator(kind)); |
| + Isolate* isolate = Isolate::Current(); |
| + cid_ = Computation::GetNextCid(isolate); |
| + ic_data_ = Computation::GetICDataForCid(cid_, isolate); |
| } |
| DECLARE_INSTRUCTION(Branch) |
| @@ -2561,6 +2568,14 @@ |
| Token::IsTypeTestOperator(kind)); |
| kind_ = kind; |
| } |
| + |
| + intptr_t cid() const { return cid_; } |
| + |
| + const ICData* ic_data() const { return ic_data_; } |
| + bool HasICData() const { |
| + return (ic_data() != NULL) && !ic_data()->IsNull(); |
| + } |
| + |
| intptr_t token_pos() const { return token_pos_;} |
| intptr_t try_index() const { return try_index_; } |
| @@ -2590,6 +2605,8 @@ |
| Condition true_condition); |
| private: |
| + intptr_t cid_; // Computation/instruction id. |
| + ICData* ic_data_; |
| const intptr_t token_pos_; |
| const intptr_t try_index_; |
| Value* left_; |