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

Unified Diff: runtime/vm/intermediate_language.h

Issue 253013006: Add flag —source-lines which emits appropriate source lines as code comments. Added token_pos to … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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
Index: runtime/vm/intermediate_language.h
===================================================================
--- runtime/vm/intermediate_language.h (revision 35511)
+++ runtime/vm/intermediate_language.h (working copy)
@@ -830,6 +830,8 @@
bool IsDefinition() { return (AsDefinition() != NULL); }
virtual Definition* AsDefinition() { return NULL; }
+ virtual intptr_t token_pos() const { return kNoTokenPos; }
+
virtual intptr_t InputCount() const = 0;
virtual Value* InputAt(intptr_t i) const = 0;
void SetInputAt(intptr_t i, Value* value) {
@@ -2115,7 +2117,7 @@
virtual intptr_t ArgumentCount() const { return 0; }
- intptr_t token_pos() const { return token_pos_; }
+ virtual intptr_t token_pos() const { return token_pos_; }
Value* value() const { return inputs_[0]; }
virtual bool CanBecomeDeoptimizationTarget() const {
@@ -2145,7 +2147,7 @@
virtual intptr_t ArgumentCount() const { return 1; }
- intptr_t token_pos() const { return token_pos_; }
+ virtual intptr_t token_pos() const { return token_pos_; }
virtual bool CanDeoptimize() const { return true; }
@@ -2171,7 +2173,7 @@
virtual intptr_t ArgumentCount() const { return 2; }
- intptr_t token_pos() const { return token_pos_; }
+ virtual intptr_t token_pos() const { return token_pos_; }
intptr_t catch_try_index() const { return catch_try_index_; }
virtual bool CanDeoptimize() const { return true; }
@@ -2283,7 +2285,7 @@
virtual ComparisonInstr* AsComparison() { return this; }
- intptr_t token_pos() const { return token_pos_; }
+ virtual intptr_t token_pos() const { return token_pos_; }
Token::Kind kind() const { return kind_; }
virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right) = 0;
@@ -2350,6 +2352,8 @@
Value* InputAt(intptr_t i) const { return comparison()->InputAt(i); }
+ virtual intptr_t token_pos() const { return comparison_->token_pos(); }
+
virtual bool CanDeoptimize() const {
// Branches need a deoptimization info in checked mode if they
// can throw a type check error.
@@ -2766,7 +2770,7 @@
Value* instantiator() const { return inputs_[1]; }
Value* instantiator_type_arguments() const { return inputs_[2]; }
- intptr_t token_pos() const { return token_pos_; }
+ virtual intptr_t token_pos() const { return token_pos_; }
const AbstractType& dst_type() const { return dst_type_; }
void set_dst_type(const AbstractType& dst_type) {
dst_type_ = dst_type.raw();
@@ -2805,7 +2809,7 @@
DECLARE_INSTRUCTION(AssertBoolean)
virtual CompileType ComputeType() const;
- intptr_t token_pos() const { return token_pos_; }
+ virtual intptr_t token_pos() const { return token_pos_; }
Value* value() const { return inputs_[0]; }
virtual void PrintOperandsTo(BufferFormatter* f) const;
@@ -2860,7 +2864,7 @@
DECLARE_INSTRUCTION(ClosureCall)
const Array& argument_names() const { return ast_node_.arguments()->names(); }
- intptr_t token_pos() const { return ast_node_.token_pos(); }
+ virtual intptr_t token_pos() const { return ast_node_.token_pos(); }
virtual intptr_t ArgumentCount() const { return arguments_->length(); }
virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const {
@@ -2927,7 +2931,7 @@
// ICData can be replaced by optimizer.
void set_ic_data(const ICData* value) { ic_data_ = value; }
- intptr_t token_pos() const { return token_pos_; }
+ virtual intptr_t token_pos() const { return token_pos_; }
const String& function_name() const { return function_name_; }
Token::Kind token_kind() const { return token_kind_; }
virtual intptr_t ArgumentCount() const { return arguments_->length(); }
@@ -2976,6 +2980,7 @@
InstanceCallInstr* instance_call() const { return instance_call_; }
bool with_checks() const { return with_checks_; }
+ virtual intptr_t token_pos() const { return instance_call_->token_pos(); }
virtual intptr_t ArgumentCount() const {
return instance_call()->ArgumentCount();
@@ -3399,7 +3404,7 @@
// Accessors forwarded to the AST node.
const Function& function() const { return function_; }
const Array& argument_names() const { return argument_names_; }
- intptr_t token_pos() const { return token_pos_; }
+ virtual intptr_t token_pos() const { return token_pos_; }
virtual intptr_t ArgumentCount() const { return arguments_->length(); }
virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const {
@@ -3615,7 +3620,7 @@
DECLARE_INSTRUCTION(NativeCall)
- intptr_t token_pos() const { return ast_node_.token_pos(); }
+ virtual intptr_t token_pos() const { return ast_node_.token_pos(); }
const Function& function() const { return ast_node_.function(); }
@@ -3659,7 +3664,7 @@
DECLARE_INSTRUCTION(DebugStepCheck)
- intptr_t token_pos() const { return token_pos_; }
+ virtual intptr_t token_pos() const { return token_pos_; }
virtual bool MayThrow() const { return false; }
virtual bool CanDeoptimize() const { return false; }
virtual EffectSet Effects() const { return EffectSet::All(); }
@@ -3686,10 +3691,12 @@
Value* instance,
Value* value,
StoreBarrierType emit_store_barrier,
+ intptr_t token_pos,
bool is_initialization = false)
: field_(field),
offset_in_bytes_(field.Offset()),
emit_store_barrier_(emit_store_barrier),
+ token_pos_(token_pos),
is_initialization_(is_initialization) {
SetInputAt(kInstancePos, instance);
SetInputAt(kValuePos, value);
@@ -3699,10 +3706,12 @@
Value* instance,
Value* value,
StoreBarrierType emit_store_barrier,
+ intptr_t token_pos,
bool is_initialization = false)
: field_(Field::Handle()),
offset_in_bytes_(offset_in_bytes),
emit_store_barrier_(emit_store_barrier),
+ token_pos_(token_pos),
is_initialization_(is_initialization) {
SetInputAt(kInstancePos, instance);
SetInputAt(kValuePos, value);
@@ -3717,6 +3726,7 @@
Value* instance() const { return inputs_[kInstancePos]; }
Value* value() const { return inputs_[kValuePos]; }
+ virtual intptr_t token_pos() const { return token_pos_; }
virtual CompileType* ComputeInitialType() const;
@@ -3763,6 +3773,7 @@
const Field& field_;
intptr_t offset_in_bytes_;
const StoreBarrierType emit_store_barrier_;
+ const intptr_t token_pos_;
const bool is_initialization_; // Marks stores in the constructor.
DISALLOW_COPY_AND_ASSIGN(StoreInstanceFieldInstr);
@@ -3886,13 +3897,18 @@
Value* index,
intptr_t index_scale,
intptr_t class_id,
- intptr_t deopt_id)
- : index_scale_(index_scale), class_id_(class_id) {
+ intptr_t deopt_id,
+ intptr_t token_pos)
+ : index_scale_(index_scale),
+ class_id_(class_id),
+ token_pos_(token_pos) {
SetInputAt(0, array);
SetInputAt(1, index);
deopt_id_ = deopt_id;
}
+ intptr_t token_pos() const { return token_pos_; }
+
DECLARE_INSTRUCTION(LoadIndexed)
virtual CompileType ComputeType() const;
@@ -3930,6 +3946,7 @@
private:
const intptr_t index_scale_;
const intptr_t class_id_;
+ const intptr_t token_pos_;
DISALLOW_COPY_AND_ASSIGN(LoadIndexedInstr);
};
@@ -4006,7 +4023,7 @@
}
Value* value() const { return inputs_[0]; }
- intptr_t token_pos() const { return token_pos_; }
+ virtual intptr_t token_pos() const { return token_pos_; }
virtual CompileType ComputeType() const;
// Issues a static call to Dart code whihc calls toString on objects.
@@ -4036,10 +4053,12 @@
StoreBarrierType emit_store_barrier,
intptr_t index_scale,
intptr_t class_id,
- intptr_t deopt_id)
+ intptr_t deopt_id,
+ intptr_t token_pos)
: emit_store_barrier_(emit_store_barrier),
index_scale_(index_scale),
- class_id_(class_id) {
+ class_id_(class_id),
+ token_pos_(token_pos) {
SetInputAt(kArrayPos, array);
SetInputAt(kIndexPos, index);
SetInputAt(kValuePos, value);
@@ -4088,6 +4107,7 @@
const StoreBarrierType emit_store_barrier_;
const intptr_t index_scale_;
const intptr_t class_id_;
+ const intptr_t token_pos_;
DISALLOW_COPY_AND_ASSIGN(StoreIndexedInstr);
};
@@ -4146,7 +4166,7 @@
bool negate_result() const { return negate_result_; }
const AbstractType& type() const { return type_; }
- intptr_t token_pos() const { return token_pos_; }
+ virtual intptr_t token_pos() const { return token_pos_; }
virtual void PrintOperandsTo(BufferFormatter* f) const;
@@ -4191,7 +4211,7 @@
}
const Class& cls() const { return cls_; }
- intptr_t token_pos() const { return token_pos_; }
+ virtual intptr_t token_pos() const { return token_pos_; }
const Function& closure_function() const { return closure_function_; }
void set_closure_function(const Function& function) {
@@ -4311,7 +4331,7 @@
virtual CompileType ComputeType() const;
- intptr_t token_pos() const { return token_pos_; }
+ virtual intptr_t token_pos() const { return token_pos_; }
Value* element_type() const { return inputs_[kElementTypePos]; }
Value* num_elements() const { return inputs_[kLengthPos]; }
@@ -4403,13 +4423,15 @@
LoadFieldInstr(Value* instance,
intptr_t offset_in_bytes,
const AbstractType& type,
+ intptr_t token_pos,
bool immutable = false)
: offset_in_bytes_(offset_in_bytes),
type_(type),
result_cid_(kDynamicCid),
immutable_(immutable),
recognized_kind_(MethodRecognizer::kUnknown),
- field_(NULL) {
+ field_(NULL),
+ token_pos_(token_pos) {
ASSERT(offset_in_bytes >= 0);
ASSERT(type.IsZoneHandle()); // May be null if field is not an instance.
SetInputAt(0, instance);
@@ -4418,13 +4440,15 @@
LoadFieldInstr(Value* instance,
const Field* field,
const AbstractType& type,
+ intptr_t token_pos,
bool immutable = false)
: offset_in_bytes_(field->Offset()),
type_(type),
result_cid_(kDynamicCid),
immutable_(immutable),
recognized_kind_(MethodRecognizer::kUnknown),
- field_(field) {
+ field_(field),
+ token_pos_(token_pos) {
ASSERT(field->IsZoneHandle());
ASSERT(type.IsZoneHandle()); // May be null if field is not an instance.
SetInputAt(0, instance);
@@ -4435,6 +4459,7 @@
const AbstractType& type() const { return type_; }
void set_result_cid(intptr_t value) { result_cid_ = value; }
intptr_t result_cid() const { return result_cid_; }
+ virtual intptr_t token_pos() const { return token_pos_; }
const Field* field() const { return field_; }
@@ -4481,10 +4506,9 @@
const AbstractType& type_;
intptr_t result_cid_;
const bool immutable_;
-
MethodRecognizer::Kind recognized_kind_;
-
const Field* field_;
+ const intptr_t token_pos_;
DISALLOW_COPY_AND_ASSIGN(LoadFieldInstr);
};
@@ -4509,7 +4533,7 @@
const AbstractType& type() const { return type_;
}
const Class& instantiator_class() const { return instantiator_class_; }
- intptr_t token_pos() const { return token_pos_; }
+ virtual intptr_t token_pos() const { return token_pos_; }
virtual void PrintOperandsTo(BufferFormatter* f) const;
@@ -4548,7 +4572,7 @@
return type_arguments_;
}
const Class& instantiator_class() const { return instantiator_class_; }
- intptr_t token_pos() const { return token_pos_; }
+ virtual intptr_t token_pos() const { return token_pos_; }
virtual void PrintOperandsTo(BufferFormatter* f) const;
@@ -4579,7 +4603,7 @@
DECLARE_INSTRUCTION(AllocateContext)
virtual CompileType ComputeType() const;
- intptr_t token_pos() const { return token_pos_; }
+ virtual intptr_t token_pos() const { return token_pos_; }
intptr_t num_context_variables() const { return num_context_variables_; }
virtual void PrintOperandsTo(BufferFormatter* f) const;
@@ -4605,7 +4629,7 @@
SetInputAt(0, context_value);
}
- intptr_t token_pos() const { return token_pos_; }
+ virtual intptr_t token_pos() const { return token_pos_; }
Value* context_value() const { return inputs_[0]; }
DECLARE_INSTRUCTION(CloneContext)
@@ -5128,8 +5152,9 @@
BinaryDoubleOpInstr(Token::Kind op_kind,
Value* left,
Value* right,
- intptr_t deopt_id)
- : op_kind_(op_kind) {
+ intptr_t deopt_id,
+ intptr_t token_pos)
+ : op_kind_(op_kind), token_pos_(token_pos) {
SetInputAt(0, left);
SetInputAt(1, right);
// Overriden generated deopt_id.
@@ -5141,6 +5166,8 @@
Token::Kind op_kind() const { return op_kind_; }
+ virtual intptr_t token_pos() const { return token_pos_; }
+
virtual void PrintOperandsTo(BufferFormatter* f) const;
virtual bool CanDeoptimize() const { return false; }
@@ -5176,6 +5203,7 @@
private:
const Token::Kind op_kind_;
+ const intptr_t token_pos_;
DISALLOW_COPY_AND_ASSIGN(BinaryDoubleOpInstr);
};
@@ -6908,10 +6936,12 @@
BinarySmiOpInstr(Token::Kind op_kind,
Value* left,
Value* right,
- intptr_t deopt_id)
+ intptr_t deopt_id,
+ intptr_t token_pos)
: op_kind_(op_kind),
overflow_(true),
- is_truncating_(false) {
+ is_truncating_(false),
+ token_pos_(token_pos) {
SetInputAt(0, left);
SetInputAt(1, right);
// Override generated deopt-id.
@@ -6921,6 +6951,7 @@
Value* left() const { return inputs_[0]; }
Value* right() const { return inputs_[1]; }
+ virtual intptr_t token_pos() const { return token_pos_; }
Token::Kind op_kind() const { return op_kind_; }
void set_overflow(bool overflow) { overflow_ = overflow; }
@@ -6956,6 +6987,7 @@
const Token::Kind op_kind_;
bool overflow_;
bool is_truncating_;
+ const intptr_t token_pos_;
DISALLOW_COPY_AND_ASSIGN(BinarySmiOpInstr);
};
@@ -7057,7 +7089,7 @@
CheckStackOverflowInstr(intptr_t token_pos, intptr_t loop_depth)
: token_pos_(token_pos), loop_depth_(loop_depth) {}
- intptr_t token_pos() const { return token_pos_; }
+ virtual intptr_t token_pos() const { return token_pos_; }
bool in_loop() const { return loop_depth_ > 0; }
intptr_t loop_depth() const { return loop_depth_; }
@@ -7083,11 +7115,13 @@
class SmiToDoubleInstr : public TemplateDefinition<1> {
public:
- explicit SmiToDoubleInstr(Value* value) {
+ SmiToDoubleInstr(Value* value, intptr_t token_pos)
+ : token_pos_(token_pos) {
SetInputAt(0, value);
}
Value* value() const { return inputs_[0]; }
+ virtual intptr_t token_pos() const { return token_pos_; }
DECLARE_INSTRUCTION(SmiToDouble)
virtual CompileType ComputeType() const;
@@ -7108,6 +7142,8 @@
virtual bool MayThrow() const { return false; }
private:
+ const intptr_t token_pos_;
+
DISALLOW_COPY_AND_ASSIGN(SmiToDoubleInstr);
};
@@ -7311,7 +7347,8 @@
public:
InvokeMathCFunctionInstr(ZoneGrowableArray<Value*>* inputs,
intptr_t original_deopt_id,
- MethodRecognizer::Kind recognized_kind);
+ MethodRecognizer::Kind recognized_kind,
+ intptr_t token_pos);
static intptr_t ArgumentCountFor(MethodRecognizer::Kind recognized_kind_);
@@ -7319,6 +7356,8 @@
MethodRecognizer::Kind recognized_kind() const { return recognized_kind_; }
+ virtual intptr_t token_pos() const { return token_pos_; }
+
DECLARE_INSTRUCTION(InvokeMathCFunction)
virtual CompileType ComputeType() const;
virtual void PrintOperandsTo(BufferFormatter* f) const;
@@ -7363,8 +7402,8 @@
}
ZoneGrowableArray<Value*>* inputs_;
-
const MethodRecognizer::Kind recognized_kind_;
+ const intptr_t token_pos_;
DISALLOW_COPY_AND_ASSIGN(InvokeMathCFunctionInstr);
};
@@ -7532,7 +7571,8 @@
public:
CheckClassInstr(Value* value,
intptr_t deopt_id,
- const ICData& unary_checks);
+ const ICData& unary_checks,
+ intptr_t token_pos);
DECLARE_INSTRUCTION(CheckClass)
@@ -7540,6 +7580,8 @@
virtual bool CanDeoptimize() const { return true; }
+ virtual intptr_t token_pos() const { return token_pos_; }
+
Value* value() const { return inputs_[0]; }
const ICData& unary_checks() const { return unary_checks_; }
@@ -7562,6 +7604,7 @@
private:
const ICData& unary_checks_;
bool licm_hoisted_;
+ const intptr_t token_pos_;
DISALLOW_COPY_AND_ASSIGN(CheckClassInstr);
};
@@ -7569,13 +7612,15 @@
class CheckSmiInstr : public TemplateInstruction<1> {
public:
- CheckSmiInstr(Value* value, intptr_t original_deopt_id) {
+ CheckSmiInstr(Value* value, intptr_t original_deopt_id, intptr_t token_pos)
+ : token_pos_(token_pos) {
ASSERT(original_deopt_id != Isolate::kNoDeoptId);
SetInputAt(0, value);
deopt_id_ = original_deopt_id;
}
Value* value() const { return inputs_[0]; }
+ virtual intptr_t token_pos() const { return token_pos_; }
DECLARE_INSTRUCTION(CheckSmi)
@@ -7593,6 +7638,8 @@
virtual bool MayThrow() const { return false; }
private:
+ const intptr_t token_pos_;
+
DISALLOW_COPY_AND_ASSIGN(CheckSmiInstr);
};

Powered by Google App Engine
This is Rietveld 408576698