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

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
« no previous file with comments | « runtime/vm/flow_graph_type_propagator.cc ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language.h
===================================================================
--- runtime/vm/intermediate_language.h (revision 35591)
+++ 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 Scanner::kNoSourcePos; }
+
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.
@@ -2767,7 +2771,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();
@@ -2806,7 +2810,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;
@@ -2861,7 +2865,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 {
@@ -2928,7 +2932,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(); }
@@ -2977,6 +2981,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();
@@ -3400,7 +3405,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 {
@@ -3616,7 +3621,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(); }
@@ -3660,7 +3665,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 @@
StoreInstanceFieldInstr(const Field& field,
Value* instance,
Value* value,
- StoreBarrierType emit_store_barrier)
+ StoreBarrierType emit_store_barrier,
+ intptr_t token_pos)
: field_(field),
offset_in_bytes_(field.Offset()),
emit_store_barrier_(emit_store_barrier),
+ token_pos_(token_pos),
is_initialization_(false) {
SetInputAt(kInstancePos, instance);
SetInputAt(kValuePos, value);
@@ -3698,10 +3705,12 @@
StoreInstanceFieldInstr(intptr_t offset_in_bytes,
Value* instance,
Value* value,
- StoreBarrierType emit_store_barrier)
+ StoreBarrierType emit_store_barrier,
+ intptr_t token_pos)
: field_(Field::Handle()),
offset_in_bytes_(offset_in_bytes),
emit_store_barrier_(emit_store_barrier),
+ token_pos_(token_pos),
is_initialization_(false) {
SetInputAt(kInstancePos, instance);
SetInputAt(kValuePos, value);
@@ -3718,6 +3727,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;
@@ -3764,6 +3774,7 @@
const Field& field_;
intptr_t offset_in_bytes_;
const StoreBarrierType emit_store_barrier_;
+ const intptr_t token_pos_;
bool is_initialization_; // Marks stores in the constructor.
DISALLOW_COPY_AND_ASSIGN(StoreInstanceFieldInstr);
@@ -3887,13 +3898,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;
@@ -3931,6 +3947,7 @@
private:
const intptr_t index_scale_;
const intptr_t class_id_;
+ const intptr_t token_pos_;
DISALLOW_COPY_AND_ASSIGN(LoadIndexedInstr);
};
@@ -4007,7 +4024,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.
@@ -4037,10 +4054,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);
@@ -4089,6 +4108,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);
};
@@ -4147,7 +4167,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;
@@ -4192,7 +4212,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) {
@@ -4312,7 +4332,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]; }
@@ -4399,17 +4419,21 @@
};
+
+
class LoadFieldInstr : public TemplateDefinition<1> {
public:
LoadFieldInstr(Value* instance,
intptr_t offset_in_bytes,
- const AbstractType& type)
+ const AbstractType& type,
+ intptr_t token_pos)
: offset_in_bytes_(offset_in_bytes),
type_(type),
result_cid_(kDynamicCid),
immutable_(false),
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);
@@ -4417,13 +4441,15 @@
LoadFieldInstr(Value* instance,
const Field* field,
- const AbstractType& type)
+ const AbstractType& type,
+ intptr_t token_pos)
: offset_in_bytes_(field->Offset()),
type_(type),
result_cid_(kDynamicCid),
immutable_(false),
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);
@@ -4436,6 +4462,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_; }
@@ -4484,8 +4511,8 @@
bool immutable_;
MethodRecognizer::Kind recognized_kind_;
-
const Field* field_;
+ const intptr_t token_pos_;
DISALLOW_COPY_AND_ASSIGN(LoadFieldInstr);
};
@@ -4510,7 +4537,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;
@@ -4549,7 +4576,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;
@@ -4580,7 +4607,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;
@@ -4606,7 +4633,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)
@@ -5129,8 +5156,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.
@@ -5142,6 +5170,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; }
@@ -5177,6 +5207,7 @@
private:
const Token::Kind op_kind_;
+ const intptr_t token_pos_;
DISALLOW_COPY_AND_ASSIGN(BinaryDoubleOpInstr);
};
@@ -6909,10 +6940,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.
@@ -6922,6 +6955,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; }
@@ -6957,6 +6991,7 @@
const Token::Kind op_kind_;
bool overflow_;
bool is_truncating_;
+ const intptr_t token_pos_;
DISALLOW_COPY_AND_ASSIGN(BinarySmiOpInstr);
};
@@ -7058,7 +7093,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_; }
@@ -7084,11 +7119,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;
@@ -7109,6 +7146,8 @@
virtual bool MayThrow() const { return false; }
private:
+ const intptr_t token_pos_;
+
DISALLOW_COPY_AND_ASSIGN(SmiToDoubleInstr);
};
@@ -7312,7 +7351,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_);
@@ -7320,6 +7360,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;
@@ -7364,8 +7406,8 @@
}
ZoneGrowableArray<Value*>* inputs_;
-
const MethodRecognizer::Kind recognized_kind_;
+ const intptr_t token_pos_;
DISALLOW_COPY_AND_ASSIGN(InvokeMathCFunctionInstr);
};
@@ -7533,7 +7575,8 @@
public:
CheckClassInstr(Value* value,
intptr_t deopt_id,
- const ICData& unary_checks);
+ const ICData& unary_checks,
+ intptr_t token_pos);
DECLARE_INSTRUCTION(CheckClass)
@@ -7541,6 +7584,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_; }
@@ -7563,6 +7608,7 @@
private:
const ICData& unary_checks_;
bool licm_hoisted_;
+ const intptr_t token_pos_;
DISALLOW_COPY_AND_ASSIGN(CheckClassInstr);
};
@@ -7570,13 +7616,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)
@@ -7594,6 +7642,8 @@
virtual bool MayThrow() const { return false; }
private:
+ const intptr_t token_pos_;
+
DISALLOW_COPY_AND_ASSIGN(CheckSmiInstr);
};
« no previous file with comments | « runtime/vm/flow_graph_type_propagator.cc ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698