Chromium Code Reviews| Index: runtime/vm/intermediate_language.h |
| diff --git a/runtime/vm/intermediate_language.h b/runtime/vm/intermediate_language.h |
| index 27f533fc9e69b56065825fdfa0f1fa2e19d4a0ae..e76f7055e8a81efe3043c055dd7348188f6c1602 100644 |
| --- a/runtime/vm/intermediate_language.h |
| +++ b/runtime/vm/intermediate_language.h |
| @@ -328,9 +328,7 @@ enum Representation { |
| template<typename T, intptr_t N> |
| class EmbeddedArray { |
| public: |
| - EmbeddedArray() { |
| - for (intptr_t i = 0; i < N; i++) elements_[i] = NULL; |
| - } |
| + EmbeddedArray() : elements_() { } |
| intptr_t length() const { return N; } |
| @@ -502,7 +500,12 @@ class Instruction : public ZoneAllocated { |
| virtual intptr_t InputCount() const = 0; |
| virtual Value* InputAt(intptr_t i) const = 0; |
| - virtual void SetInputAt(intptr_t i, Value* value) = 0; |
| + void SetInputAt(intptr_t i, Value* value) { |
| + ASSERT(value != NULL); |
| + value->set_instruction(this); |
| + value->set_use_index(i); |
| + RawSetInputAt(i, value); |
| + } |
| // Remove all inputs (including in the environment) from their |
| // definition's use lists. |
| @@ -700,6 +703,8 @@ FOR_EACH_INSTRUCTION(INSTRUCTION_TYPE_CHECK) |
| friend class FlowGraphOptimizer; |
| friend class LoadIndexedInstr; |
| + virtual void RawSetInputAt(intptr_t i, Value* value) = 0; |
| + |
| intptr_t deopt_id_; |
| intptr_t lifetime_position_; // Position used by register allocator. |
| Instruction* previous_; |
| @@ -718,10 +723,6 @@ class TemplateInstruction: public Instruction { |
| virtual intptr_t InputCount() const { return N; } |
| virtual Value* InputAt(intptr_t i) const { return inputs_[i]; } |
| - virtual void SetInputAt(intptr_t i, Value* value) { |
| - ASSERT(value != NULL); |
| - inputs_[i] = value; |
| - } |
| virtual LocationSummary* locs() { |
| if (locs_ == NULL) { |
| @@ -734,6 +735,10 @@ class TemplateInstruction: public Instruction { |
| EmbeddedArray<Value*, N> inputs_; |
| private: |
| + virtual void RawSetInputAt(intptr_t i, Value* value) { |
| + inputs_[i] = value; |
| + } |
| + |
| LocationSummary* locs_; |
| }; |
| @@ -915,7 +920,6 @@ class BlockEntryInstr : public Instruction { |
| UNREACHABLE(); |
| return NULL; |
| } |
| - virtual void SetInputAt(intptr_t i, Value* value) { UNREACHABLE(); } |
| virtual intptr_t ArgumentCount() const { return 0; } |
| @@ -952,6 +956,8 @@ class BlockEntryInstr : public Instruction { |
| loop_info_(NULL) { } |
| private: |
| + virtual void RawSetInputAt(intptr_t i, Value* value) { UNREACHABLE(); } |
| + |
| virtual void ClearPredecessors() = 0; |
| virtual void AddPredecessor(BlockEntryInstr* predecessor) = 0; |
| @@ -1345,7 +1351,7 @@ class Definition : public Instruction { |
| class PhiInstr : public Definition { |
| public: |
| - explicit PhiInstr(JoinEntryInstr* block, intptr_t num_inputs) |
| + PhiInstr(JoinEntryInstr* block, intptr_t num_inputs) |
| : block_(block), |
| inputs_(num_inputs), |
| is_alive_(false), |
| @@ -1369,8 +1375,6 @@ class PhiInstr : public Definition { |
| Value* InputAt(intptr_t i) const { return inputs_[i]; } |
| - void SetInputAt(intptr_t i, Value* value) { inputs_[i] = value; } |
| - |
| virtual bool CanDeoptimize() const { return false; } |
| virtual bool HasSideEffect() const { return false; } |
| @@ -1411,7 +1415,11 @@ class PhiInstr : public Definition { |
| } |
| private: |
| - friend class ConstantPropagator; // Direct access to inputs_. |
| + // Direct access to inputs_ in order to resize it due to unreachable |
| + // predecessors. |
| + friend class ConstantPropagator; |
|
Vyacheslav Egorov (Google)
2013/02/22 16:13:36
Comment does not match implementation. ConstantPro
Kevin Millikin (Google)
2013/02/25 11:08:07
It uses friend access to call inputs_.Truncate(...
|
| + |
| + void RawSetInputAt(intptr_t i, Value* value) { inputs_[i] = value; } |
| JoinEntryInstr* block_; |
| GrowableArray<Value*> inputs_; |
| @@ -1426,7 +1434,7 @@ class PhiInstr : public Definition { |
| class ParameterInstr : public Definition { |
| public: |
| - explicit ParameterInstr(intptr_t index, GraphEntryInstr* block) |
| + ParameterInstr(intptr_t index, GraphEntryInstr* block) |
| : index_(index), block_(block) { } |
| DECLARE_INSTRUCTION(Parameter) |
| @@ -1443,7 +1451,6 @@ class ParameterInstr : public Definition { |
| UNREACHABLE(); |
| return NULL; |
| } |
| - void SetInputAt(intptr_t i, Value* value) { UNREACHABLE(); } |
| virtual bool CanDeoptimize() const { return false; } |
| @@ -1459,6 +1466,8 @@ class ParameterInstr : public Definition { |
| virtual CompileType* ComputeInitialType() const; |
| private: |
| + virtual void RawSetInputAt(intptr_t i, Value* value) { UNREACHABLE(); } |
| + |
| const intptr_t index_; |
| GraphEntryInstr* block_; |
| @@ -1468,8 +1477,8 @@ class ParameterInstr : public Definition { |
| class PushArgumentInstr : public Definition { |
| public: |
| - explicit PushArgumentInstr(Value* value) : value_(value), locs_(NULL) { |
| - ASSERT(value != NULL); |
| + explicit PushArgumentInstr(Value* value) : locs_(NULL) { |
| + SetInputAt(0, value); |
| set_use_kind(kEffect); // Override the default. |
| } |
| @@ -1480,10 +1489,6 @@ class PushArgumentInstr : public Definition { |
| ASSERT(i == 0); |
| return value_; |
| } |
| - void SetInputAt(intptr_t i, Value* value) { |
| - ASSERT(i == 0); |
| - value_ = value; |
| - } |
| virtual intptr_t ArgumentCount() const { return 0; } |
| @@ -1510,6 +1515,11 @@ class PushArgumentInstr : public Definition { |
| virtual void PrintOperandsTo(BufferFormatter* f) const; |
| private: |
| + virtual void RawSetInputAt(intptr_t i, Value* value) { |
| + ASSERT(i == 0); |
| + value_ = value; |
| + } |
| + |
| Value* value_; |
| LocationSummary* locs_; |
| @@ -1526,8 +1536,7 @@ class ReturnInstr : public TemplateInstruction<1> { |
| public: |
| ReturnInstr(intptr_t token_pos, Value* value) |
| : token_pos_(token_pos) { |
| - ASSERT(value != NULL); |
| - inputs_[0] = value; |
| + SetInputAt(0, value); |
| } |
| DECLARE_INSTRUCTION(Return) |
| @@ -1665,15 +1674,13 @@ class ControlInstruction : public Instruction { |
| class BranchInstr : public ControlInstruction { |
| public: |
| - explicit BranchInstr(ComparisonInstr* comparison, bool is_checked = false) |
| - : comparison_(comparison), is_checked_(is_checked) { } |
| + explicit BranchInstr(ComparisonInstr* comparison, bool is_checked = false); |
| DECLARE_INSTRUCTION(Branch) |
| virtual intptr_t ArgumentCount() const; |
| intptr_t InputCount() const; |
| Value* InputAt(intptr_t i) const; |
| - void SetInputAt(intptr_t i, Value* value); |
| virtual bool CanDeoptimize() const; |
| virtual bool HasSideEffect() const; |
| @@ -1700,6 +1707,8 @@ class BranchInstr : public ControlInstruction { |
| virtual void PrintTo(BufferFormatter* f) const; |
| private: |
| + virtual void RawSetInputAt(intptr_t i, Value* value); |
| + |
| ComparisonInstr* comparison_; |
| const bool is_checked_; |
| @@ -1710,8 +1719,7 @@ class BranchInstr : public ControlInstruction { |
| class StoreContextInstr : public TemplateInstruction<1> { |
| public: |
| explicit StoreContextInstr(Value* value) { |
| - ASSERT(value != NULL); |
| - inputs_[0] = value; |
| + SetInputAt(0, value); |
| } |
| DECLARE_INSTRUCTION(StoreContext); |
| @@ -1736,10 +1744,6 @@ class TemplateDefinition : public Definition { |
| virtual intptr_t InputCount() const { return N; } |
| virtual Value* InputAt(intptr_t i) const { return inputs_[i]; } |
| - virtual void SetInputAt(intptr_t i, Value* value) { |
| - ASSERT(value != NULL); |
| - inputs_[i] = value; |
| - } |
| // Returns a structure describing the location constraints required |
| // to emit native code for this definition. |
| @@ -1756,6 +1760,10 @@ class TemplateDefinition : public Definition { |
| private: |
| friend class BranchInstr; |
| + virtual void RawSetInputAt(intptr_t i, Value* value) { |
| + inputs_[i] = value; |
| + } |
| + |
| LocationSummary* locs_; |
| }; |
| @@ -1923,8 +1931,7 @@ class ConstraintInstr : public TemplateDefinition<2> { |
| public: |
| ConstraintInstr(Value* value, Range* constraint) |
| : constraint_(constraint) { |
| - inputs_[0] = value; |
| - inputs_[1] = NULL; // Dependency. |
| + SetInputAt(0, value); |
| } |
| DECLARE_INSTRUCTION(Constraint) |
| @@ -1953,10 +1960,8 @@ class ConstraintInstr : public TemplateDefinition<2> { |
| void AddDependency(Definition* defn) { |
| Value* val = new Value(defn); |
| - val->set_use_index(1); |
| - val->set_instruction(this); |
| defn->AddInputUse(val); |
| - set_dependency(val); |
| + SetInputAt(1, val); |
| } |
| private: |
| @@ -1964,10 +1969,6 @@ class ConstraintInstr : public TemplateDefinition<2> { |
| return inputs_[1]; |
| } |
| - void set_dependency(Value* value) { |
| - inputs_[1] = value; |
| - } |
| - |
| Range* constraint_; |
| DISALLOW_COPY_AND_ASSIGN(ConstraintInstr); |
| @@ -2013,14 +2014,11 @@ class AssertAssignableInstr : public TemplateDefinition<3> { |
| : token_pos_(token_pos), |
| dst_type_(AbstractType::ZoneHandle(dst_type.raw())), |
| dst_name_(dst_name) { |
| - ASSERT(value != NULL); |
| - ASSERT(instantiator != NULL); |
| - ASSERT(instantiator_type_arguments != NULL); |
| ASSERT(!dst_type.IsNull()); |
| ASSERT(!dst_name.IsNull()); |
| - inputs_[0] = value; |
| - inputs_[1] = instantiator; |
| - inputs_[2] = instantiator_type_arguments; |
| + SetInputAt(0, value); |
| + SetInputAt(1, instantiator); |
| + SetInputAt(2, instantiator_type_arguments); |
| } |
| DECLARE_INSTRUCTION(AssertAssignable) |
| @@ -2062,8 +2060,7 @@ class AssertBooleanInstr : public TemplateDefinition<1> { |
| public: |
| AssertBooleanInstr(intptr_t token_pos, Value* value) |
| : token_pos_(token_pos) { |
| - ASSERT(value != NULL); |
| - inputs_[0] = value; |
| + SetInputAt(0, value); |
| } |
| DECLARE_INSTRUCTION(AssertBoolean) |
| @@ -2095,8 +2092,7 @@ class ArgumentDefinitionTestInstr : public TemplateDefinition<1> { |
| ArgumentDefinitionTestInstr(ArgumentDefinitionTestNode* node, |
| Value* saved_arguments_descriptor) |
| : ast_node_(*node) { |
| - ASSERT(saved_arguments_descriptor != NULL); |
| - inputs_[0] = saved_arguments_descriptor; |
| + SetInputAt(0, saved_arguments_descriptor); |
| } |
| DECLARE_INSTRUCTION(ArgumentDefinitionTest) |
| @@ -2288,10 +2284,8 @@ class ComparisonInstr : public TemplateDefinition<2> { |
| public: |
| ComparisonInstr(Token::Kind kind, Value* left, Value* right) |
| : kind_(kind) { |
| - ASSERT(left != NULL); |
| - ASSERT(right != NULL); |
| - inputs_[0] = left; |
| - inputs_[1] = right; |
| + SetInputAt(0, left); |
| + SetInputAt(1, right); |
| } |
| Value* left() const { return inputs_[0]; } |
| @@ -2325,11 +2319,6 @@ inline Value* BranchInstr::InputAt(intptr_t i) const { |
| } |
| -inline void BranchInstr::SetInputAt(intptr_t i, Value* value) { |
| - comparison()->SetInputAt(i, value); |
| -} |
| - |
| - |
| inline bool BranchInstr::CanDeoptimize() const { |
| // Branches need a deoptimization info in checked mode if they |
| // can throw a type check error. |
| @@ -2629,8 +2618,7 @@ class StoreLocalInstr : public TemplateDefinition<1> { |
| intptr_t context_level) |
| : local_(local), |
| context_level_(context_level) { |
| - ASSERT(value != NULL); |
| - inputs_[0] = value; |
| + SetInputAt(0, value); |
| } |
| DECLARE_INSTRUCTION(StoreLocal) |
| @@ -2699,10 +2687,8 @@ class StoreInstanceFieldInstr : public TemplateDefinition<2> { |
| Value* value, |
| bool emit_store_barrier) |
| : field_(field), emit_store_barrier_(emit_store_barrier) { |
| - ASSERT(instance != NULL); |
| - ASSERT(value != NULL); |
| - inputs_[0] = instance; |
| - inputs_[1] = value; |
| + SetInputAt(0, instance); |
| + SetInputAt(1, value); |
| } |
| DECLARE_INSTRUCTION(StoreInstanceField) |
| @@ -2760,8 +2746,7 @@ class StoreStaticFieldInstr : public TemplateDefinition<1> { |
| StoreStaticFieldInstr(const Field& field, Value* value) |
| : field_(field) { |
| ASSERT(field.IsZoneHandle()); |
| - ASSERT(value != NULL); |
| - inputs_[0] = value; |
| + SetInputAt(0, value); |
| } |
| DECLARE_INSTRUCTION(StoreStaticField); |
| @@ -2791,10 +2776,8 @@ class LoadIndexedInstr : public TemplateDefinition<2> { |
| intptr_t class_id, |
| intptr_t deopt_id) |
| : index_scale_(index_scale), class_id_(class_id) { |
| - ASSERT(array != NULL); |
| - ASSERT(index != NULL); |
| - inputs_[0] = array; |
| - inputs_[1] = index; |
| + SetInputAt(0, array); |
| + SetInputAt(1, index); |
| deopt_id_ = deopt_id; |
| } |
| @@ -2830,13 +2813,12 @@ class LoadIndexedInstr : public TemplateDefinition<2> { |
| class StringFromCharCodeInstr : public TemplateDefinition<1> { |
| public: |
| - explicit StringFromCharCodeInstr(Value* char_code, |
| - intptr_t cid) : cid_(cid) { |
| + StringFromCharCodeInstr(Value* char_code, intptr_t cid) : cid_(cid) { |
| ASSERT(char_code != NULL); |
| ASSERT(char_code->definition()->IsLoadIndexed() && |
| (char_code->definition()->AsLoadIndexed()->class_id() == |
| kOneByteStringCid)); |
| - inputs_[0] = char_code; |
| + SetInputAt(0, char_code); |
| } |
| DECLARE_INSTRUCTION(StringFromCharCode) |
| @@ -2870,12 +2852,9 @@ class StoreIndexedInstr : public TemplateDefinition<3> { |
| : emit_store_barrier_(emit_store_barrier), |
| class_id_(class_id), |
| deopt_id_(deopt_id) { |
| - ASSERT(array != NULL); |
| - ASSERT(index != NULL); |
| - ASSERT(value != NULL); |
| - inputs_[0] = array; |
| - inputs_[1] = index; |
| - inputs_[2] = value; |
| + SetInputAt(0, array); |
| + SetInputAt(1, index); |
| + SetInputAt(2, value); |
| } |
| DECLARE_INSTRUCTION(StoreIndexed) |
| @@ -2914,8 +2893,7 @@ class StoreIndexedInstr : public TemplateDefinition<3> { |
| class BooleanNegateInstr : public TemplateDefinition<1> { |
| public: |
| explicit BooleanNegateInstr(Value* value) { |
| - ASSERT(value != NULL); |
| - inputs_[0] = value; |
| + SetInputAt(0, value); |
| } |
| DECLARE_INSTRUCTION(BooleanNegate) |
| @@ -2943,13 +2921,10 @@ class InstanceOfInstr : public TemplateDefinition<3> { |
| : token_pos_(token_pos), |
| type_(type), |
| negate_result_(negate_result) { |
| - ASSERT(value != NULL); |
| - ASSERT(instantiator != NULL); |
| - ASSERT(instantiator_type_arguments != NULL); |
| ASSERT(!type.IsNull()); |
| - inputs_[0] = value; |
| - inputs_[1] = instantiator; |
| - inputs_[2] = instantiator_type_arguments; |
| + SetInputAt(0, value); |
| + SetInputAt(1, instantiator); |
| + SetInputAt(2, instantiator_type_arguments); |
| } |
| DECLARE_INSTRUCTION(InstanceOf) |
| @@ -3024,10 +2999,8 @@ class AllocateObjectWithBoundsCheckInstr : public TemplateDefinition<2> { |
| Value* type_arguments, |
| Value* instantiator) |
| : ast_node_(*node) { |
| - ASSERT(type_arguments != NULL); |
| - ASSERT(instantiator != NULL); |
| - inputs_[0] = type_arguments; |
| - inputs_[1] = instantiator; |
| + SetInputAt(0, type_arguments); |
| + SetInputAt(1, instantiator); |
| } |
| DECLARE_INSTRUCTION(AllocateObjectWithBoundsCheck) |
| @@ -3057,13 +3030,10 @@ class CreateArrayInstr : public TemplateDefinition<1> { |
| : token_pos_(token_pos), |
| num_elements_(num_elements), |
| type_(type) { |
| -#if defined(DEBUG) |
| - ASSERT(element_type != NULL); |
| ASSERT(type_.IsZoneHandle()); |
| ASSERT(!type_.IsNull()); |
| ASSERT(type_.IsFinalized()); |
| -#endif |
| - inputs_[0] = element_type; |
| + SetInputAt(0, element_type); |
| } |
| DECLARE_INSTRUCTION(CreateArray) |
| @@ -3136,9 +3106,8 @@ class LoadFieldInstr : public TemplateDefinition<1> { |
| result_cid_(kDynamicCid), |
| immutable_(immutable), |
| recognized_kind_(MethodRecognizer::kUnknown) { |
| - ASSERT(value != NULL); |
| ASSERT(type.IsZoneHandle()); // May be null if field is not an instance. |
| - inputs_[0] = value; |
| + SetInputAt(0, value); |
| } |
| DECLARE_INSTRUCTION(LoadField) |
| @@ -3194,11 +3163,9 @@ class StoreVMFieldInstr : public TemplateDefinition<2> { |
| Value* value, |
| const AbstractType& type) |
| : offset_in_bytes_(offset_in_bytes), type_(type) { |
| - ASSERT(value != NULL); |
| - ASSERT(dest != NULL); |
| ASSERT(type.IsZoneHandle()); // May be null if field is not an instance. |
| - inputs_[0] = value; |
| - inputs_[1] = dest; |
| + SetInputAt(0, value); |
| + SetInputAt(1, dest); |
| } |
| DECLARE_INSTRUCTION(StoreVMField) |
| @@ -3231,8 +3198,7 @@ class InstantiateTypeArgumentsInstr : public TemplateDefinition<1> { |
| : token_pos_(token_pos), |
| type_arguments_(type_arguments) { |
| ASSERT(type_arguments.IsZoneHandle()); |
| - ASSERT(instantiator != NULL); |
| - inputs_[0] = instantiator; |
| + SetInputAt(0, instantiator); |
| } |
| DECLARE_INSTRUCTION(InstantiateTypeArguments) |
| @@ -3265,8 +3231,7 @@ class ExtractConstructorTypeArgumentsInstr : public TemplateDefinition<1> { |
| Value* instantiator) |
| : token_pos_(token_pos), |
| type_arguments_(type_arguments) { |
| - ASSERT(instantiator != NULL); |
| - inputs_[0] = instantiator; |
| + SetInputAt(0, instantiator); |
| } |
| DECLARE_INSTRUCTION(ExtractConstructorTypeArguments) |
| @@ -3296,8 +3261,7 @@ class ExtractConstructorInstantiatorInstr : public TemplateDefinition<1> { |
| ExtractConstructorInstantiatorInstr(ConstructorCallNode* ast_node, |
| Value* instantiator) |
| : ast_node_(*ast_node) { |
| - ASSERT(instantiator != NULL); |
| - inputs_[0] = instantiator; |
| + SetInputAt(0, instantiator); |
| } |
| DECLARE_INSTRUCTION(ExtractConstructorInstantiator) |
| @@ -3350,8 +3314,7 @@ class AllocateContextInstr : public TemplateDefinition<0> { |
| class ChainContextInstr : public TemplateInstruction<1> { |
| public: |
| explicit ChainContextInstr(Value* context_value) { |
| - ASSERT(context_value != NULL); |
| - inputs_[0] = context_value; |
| + SetInputAt(0, context_value); |
| } |
| DECLARE_INSTRUCTION(ChainContext) |
| @@ -3373,8 +3336,7 @@ class CloneContextInstr : public TemplateDefinition<1> { |
| public: |
| CloneContextInstr(intptr_t token_pos, Value* context_value) |
| : token_pos_(token_pos) { |
| - ASSERT(context_value != NULL); |
| - inputs_[0] = context_value; |
| + SetInputAt(0, context_value); |
| } |
| intptr_t token_pos() const { return token_pos_; } |
| @@ -3426,10 +3388,8 @@ class CheckEitherNonSmiInstr : public TemplateInstruction<2> { |
| CheckEitherNonSmiInstr(Value* left, |
| Value* right, |
| InstanceCallInstr* instance_call) { |
| - ASSERT(left != NULL); |
| - ASSERT(right != NULL); |
| - inputs_[0] = left; |
| - inputs_[1] = right; |
| + SetInputAt(0, left); |
| + SetInputAt(1, right); |
| deopt_id_ = instance_call->deopt_id(); |
| } |
| @@ -3460,8 +3420,7 @@ class BoxDoubleInstr : public TemplateDefinition<1> { |
| public: |
| BoxDoubleInstr(Value* value, InstanceCallInstr* instance_call) |
| : token_pos_((instance_call != NULL) ? instance_call->token_pos() : 0) { |
| - ASSERT(value != NULL); |
| - inputs_[0] = value; |
| + SetInputAt(0, value); |
| } |
| Value* value() const { return inputs_[0]; } |
| @@ -3493,8 +3452,7 @@ class BoxDoubleInstr : public TemplateDefinition<1> { |
| class BoxIntegerInstr : public TemplateDefinition<1> { |
| public: |
| explicit BoxIntegerInstr(Value* value) { |
| - ASSERT(value != NULL); |
| - inputs_[0] = value; |
| + SetInputAt(0, value); |
| } |
| Value* value() const { return inputs_[0]; } |
| @@ -3522,8 +3480,7 @@ class BoxIntegerInstr : public TemplateDefinition<1> { |
| class UnboxDoubleInstr : public TemplateDefinition<1> { |
| public: |
| UnboxDoubleInstr(Value* value, intptr_t deopt_id) { |
| - ASSERT(value != NULL); |
| - inputs_[0] = value; |
| + SetInputAt(0, value); |
| deopt_id_ = deopt_id; |
| } |
| @@ -3554,8 +3511,7 @@ class UnboxDoubleInstr : public TemplateDefinition<1> { |
| class UnboxIntegerInstr : public TemplateDefinition<1> { |
| public: |
| UnboxIntegerInstr(Value* value, intptr_t deopt_id) { |
| - ASSERT(value != NULL); |
| - inputs_[0] = value; |
| + SetInputAt(0, value); |
| deopt_id_ = deopt_id; |
| } |
| @@ -3588,8 +3544,7 @@ class UnboxIntegerInstr : public TemplateDefinition<1> { |
| class MathSqrtInstr : public TemplateDefinition<1> { |
| public: |
| MathSqrtInstr(Value* value, StaticCallInstr* instance_call) { |
| - ASSERT(value != NULL); |
| - inputs_[0] = value; |
| + SetInputAt(0, value); |
| deopt_id_ = instance_call->deopt_id(); |
| } |
| @@ -3633,10 +3588,8 @@ class BinaryDoubleOpInstr : public TemplateDefinition<2> { |
| Value* right, |
| InstanceCallInstr* instance_call) |
| : op_kind_(op_kind) { |
| - ASSERT(left != NULL); |
| - ASSERT(right != NULL); |
| - inputs_[0] = left; |
| - inputs_[1] = right; |
| + SetInputAt(0, left); |
| + SetInputAt(1, right); |
| deopt_id_ = instance_call->deopt_id(); |
| } |
| @@ -3692,10 +3645,8 @@ class BinaryMintOpInstr : public TemplateDefinition<2> { |
| InstanceCallInstr* instance_call) |
| : op_kind_(op_kind), |
| instance_call_(instance_call) { |
| - ASSERT(left != NULL); |
| - ASSERT(right != NULL); |
| - inputs_[0] = left; |
| - inputs_[1] = right; |
| + SetInputAt(0, left); |
| + SetInputAt(1, right); |
| deopt_id_ = instance_call->deopt_id(); |
| } |
| @@ -3757,11 +3708,9 @@ class ShiftMintOpInstr : public TemplateDefinition<2> { |
| Value* right, |
| InstanceCallInstr* instance_call) |
| : op_kind_(op_kind) { |
| - ASSERT(left != NULL); |
| - ASSERT(right != NULL); |
| ASSERT(op_kind == Token::kSHR || op_kind == Token::kSHL); |
| - inputs_[0] = left; |
| - inputs_[1] = right; |
| + SetInputAt(0, left); |
| + SetInputAt(1, right); |
| deopt_id_ = instance_call->deopt_id(); |
| } |
| @@ -3814,9 +3763,8 @@ class UnaryMintOpInstr : public TemplateDefinition<1> { |
| Value* value, |
| InstanceCallInstr* instance_call) |
| : op_kind_(op_kind) { |
| - ASSERT(value != NULL); |
| ASSERT(op_kind == Token::kBIT_NOT); |
| - inputs_[0] = value; |
| + SetInputAt(0, value); |
| deopt_id_ = instance_call->deopt_id(); |
| } |
| @@ -3872,10 +3820,8 @@ class BinarySmiOpInstr : public TemplateDefinition<2> { |
| instance_call_(instance_call), |
| overflow_(true), |
| is_truncating_(false) { |
| - ASSERT(left != NULL); |
| - ASSERT(right != NULL); |
| - inputs_[0] = left; |
| - inputs_[1] = right; |
| + SetInputAt(0, left); |
| + SetInputAt(1, right); |
| deopt_id_ = instance_call->deopt_id(); |
| } |
| @@ -3938,8 +3884,7 @@ class UnarySmiOpInstr : public TemplateDefinition<1> { |
| Value* value) |
| : op_kind_(op_kind) { |
| ASSERT((op_kind == Token::kNEGATE) || (op_kind == Token::kBIT_NOT)); |
| - ASSERT(value != NULL); |
| - inputs_[0] = value; |
| + SetInputAt(0, value); |
| deopt_id_ = instance_call->deopt_id(); |
| } |
| @@ -4011,8 +3956,7 @@ class DoubleToIntegerInstr : public TemplateDefinition<1> { |
| public: |
| DoubleToIntegerInstr(Value* value, InstanceCallInstr* instance_call) |
| : instance_call_(instance_call) { |
| - ASSERT(value != NULL); |
| - inputs_[0] = value; |
| + SetInputAt(0, value); |
| } |
| Value* value() const { return inputs_[0]; } |
| @@ -4039,8 +3983,7 @@ class DoubleToIntegerInstr : public TemplateDefinition<1> { |
| class DoubleToSmiInstr : public TemplateDefinition<1> { |
| public: |
| DoubleToSmiInstr(Value* value, InstanceCallInstr* instance_call) { |
| - ASSERT(value != NULL); |
| - inputs_[0] = value; |
| + SetInputAt(0, value); |
| deopt_id_ = instance_call->deopt_id(); |
| } |
| @@ -4071,8 +4014,7 @@ class DoubleToDoubleInstr : public TemplateDefinition<1> { |
| InstanceCallInstr* instance_call, |
| MethodRecognizer::Kind recognized_kind) |
| : recognized_kind_(recognized_kind) { |
| - ASSERT(value != NULL); |
| - inputs_[0] = value; |
| + SetInputAt(0, value); |
| deopt_id_ = instance_call->deopt_id(); |
| } |
| @@ -4109,11 +4051,7 @@ class InvokeMathCFunctionInstr : public Definition { |
| public: |
| InvokeMathCFunctionInstr(ZoneGrowableArray<Value*>* inputs, |
| InstanceCallInstr* instance_call, |
| - MethodRecognizer::Kind recognized_kind) |
| - : inputs_(inputs), locs_(NULL), recognized_kind_(recognized_kind) { |
| - ASSERT(inputs_->length() == ArgumentCountFor(recognized_kind_)); |
| - deopt_id_ = instance_call->deopt_id(); |
| - } |
| + MethodRecognizer::Kind recognized_kind); |
| static intptr_t ArgumentCountFor(MethodRecognizer::Kind recognized_kind_); |
| @@ -4148,11 +4086,6 @@ class InvokeMathCFunctionInstr : public Definition { |
| return (*inputs_)[i]; |
| } |
| - virtual void SetInputAt(intptr_t i, Value* value) { |
| - ASSERT(value != NULL); |
| - (*inputs_)[i] = value; |
| - } |
| - |
| // Returns a structure describing the location constraints required |
| // to emit native code for this definition. |
| LocationSummary* locs() { |
| @@ -4163,6 +4096,10 @@ class InvokeMathCFunctionInstr : public Definition { |
| } |
| private: |
| + virtual void RawSetInputAt(intptr_t i, Value* value) { |
| + (*inputs_)[i] = value; |
| + } |
| + |
| ZoneGrowableArray<Value*>* inputs_; |
| LocationSummary* locs_; |
| @@ -4209,9 +4146,8 @@ class CheckClassInstr : public TemplateInstruction<1> { |
| class CheckSmiInstr : public TemplateInstruction<1> { |
| public: |
| CheckSmiInstr(Value* value, intptr_t original_deopt_id) { |
| - ASSERT(value != NULL); |
| ASSERT(original_deopt_id != Isolate::kNoDeoptId); |
| - inputs_[0] = value; |
| + SetInputAt(0, value); |
| deopt_id_ = original_deopt_id; |
| } |
| @@ -4243,10 +4179,8 @@ class CheckArrayBoundInstr : public TemplateInstruction<2> { |
| intptr_t array_type, |
| InstanceCallInstr* instance_call) |
| : array_type_(array_type) { |
| - ASSERT(length != NULL); |
| - ASSERT(index != NULL); |
| - inputs_[0] = length; |
| - inputs_[1] = index; |
| + SetInputAt(0, length); |
| + SetInputAt(1, index); |
| deopt_id_ = instance_call->deopt_id(); |
| } |