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

Unified Diff: runtime/vm/object.h

Issue 254723003: Remember all deopt reasons in ic_data, not just the last one. (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/object.h
===================================================================
--- runtime/vm/object.h (revision 35415)
+++ runtime/vm/object.h (working copy)
@@ -3180,6 +3180,42 @@
};
+#define DEOPT_REASONS(V) \
Ivan Posva 2014/04/25 20:59:23 I would be more comfortable if this was within a c
regis 2014/04/25 23:38:28 Done. But I had to move class ICData before class
+ V(Unknown) \
+ V(InstanceGetter) \
+ V(PolymorphicInstanceCallTestFail) \
+ V(InstanceCallNoICData) \
+ V(IntegerToDouble) \
+ V(BinarySmiOp) \
+ V(BinaryMintOp) \
+ V(UnaryMintOp) \
+ V(ShiftMintOp) \
+ V(BinaryDoubleOp) \
+ V(InstanceSetter) \
+ V(Equality) \
+ V(RelationalOp) \
+ V(EqualityClassCheck) \
+ V(NoTypeFeedback) \
+ V(UnaryOp) \
+ V(UnboxInteger) \
+ V(CheckClass) \
+ V(HoistedCheckClass) \
+ V(CheckSmi) \
+ V(CheckArrayBound) \
+ V(AtCall) \
+ V(DoubleToSmi) \
+ V(Int32Load) \
+ V(Uint32Load) \
+ V(GuardField) \
+ V(NumReasons) \
+
+enum DeoptReasonId {
+#define DEFINE_ENUM_LIST(name) kDeopt##name,
+DEOPT_REASONS(DEFINE_ENUM_LIST)
+#undef DEFINE_ENUM_LIST
+};
+
+
class Code : public Object {
public:
RawInstructions* instructions() const { return raw_ptr()->instructions_; }
@@ -3257,7 +3293,7 @@
return raw_ptr()->static_calls_target_table_;
}
- RawDeoptInfo* GetDeoptInfoAtPc(uword pc, intptr_t* deopt_reason) const;
+ RawDeoptInfo* GetDeoptInfoAtPc(uword pc, DeoptReasonId* deopt_reason) const;
// Returns null if there is no static call at 'pc'.
RawFunction* GetStaticCallTargetFunctionAt(uword pc) const;
@@ -3608,8 +3644,8 @@
// corresponding targets.
class ICData : public Object {
public:
- RawFunction* function() const {
- return raw_ptr()->function_;
+ RawFunction* owner() const {
+ return raw_ptr()->owner_;
}
RawString* target_name() const {
@@ -3620,25 +3656,24 @@
return raw_ptr()->args_descriptor_;
}
- intptr_t num_args_tested() const {
- return raw_ptr()->num_args_tested_;
- }
+ intptr_t NumArgsTested() const;
intptr_t deopt_id() const {
return raw_ptr()->deopt_id_;
}
- intptr_t deopt_reason() const {
- return raw_ptr()->deopt_reason_;
- }
+ bool HasDeoptReasons() const { return DeoptReasons() > 0; }
srdjan 2014/04/25 20:54:16 != 0, since it cannot be negative.
regis 2014/04/25 23:38:28 Done.
+ uint32_t DeoptReasons() const;
+ void SetDeoptReasons(uint32_t reasons) const;
- void set_deopt_reason(intptr_t reason) const;
+ bool HasDeoptReason(DeoptReasonId reason) const;
+ void AddDeoptReason(DeoptReasonId reason) const;
- bool is_closure_call() const {
- return raw_ptr()->is_closure_call_ == 1;
- }
+ bool IssuedJSWarning() const;
+ void SetIssuedJSWarning() const;
- void set_is_closure_call(bool value) const;
+ bool IsClosureCall() const;
+ void SetIsClosureCall() const;
intptr_t NumberOfChecks() const;
@@ -3650,10 +3685,18 @@
return OFFSET_OF(RawICData, target_name_);
}
- static intptr_t num_args_tested_offset() {
- return OFFSET_OF(RawICData, num_args_tested_);
+ static intptr_t state_bits_offset() {
+ return OFFSET_OF(RawICData, state_bits_);
}
+ static intptr_t NumArgsTestedShift() {
+ return kNumArgsTestedBits;
+ }
+
+ static intptr_t NumArgsTestedMask() {
+ return (1 << kNumArgsTestedSize) - 1;
+ }
+
static intptr_t arguments_descriptor_offset() {
return OFFSET_OF(RawICData, args_descriptor_);
}
@@ -3662,14 +3705,10 @@
return OFFSET_OF(RawICData, ic_data_);
}
- static intptr_t function_offset() {
- return OFFSET_OF(RawICData, function_);
+ static intptr_t owner_offset() {
+ return OFFSET_OF(RawICData, owner_);
}
- static intptr_t is_closure_call_offset() {
- return OFFSET_OF(RawICData, is_closure_call_);
- }
-
// Used for unoptimized static calls when no class-ids are checked.
void AddTarget(const Function& target) const;
@@ -3720,7 +3759,7 @@
bool HasOneTarget() const;
bool HasReceiverClassId(intptr_t class_id) const;
- static RawICData* New(const Function& caller_function,
+ static RawICData* New(const Function& owner,
const String& target_name,
const Array& arguments_descriptor,
intptr_t deopt_id,
@@ -3741,13 +3780,30 @@
return raw_ptr()->ic_data_;
}
- void set_function(const Function& value) const;
+ void set_owner(const Function& value) const;
void set_target_name(const String& value) const;
void set_arguments_descriptor(const Array& value) const;
void set_deopt_id(intptr_t value) const;
- void set_num_args_tested(intptr_t value) const;
+ void SetNumArgsTested(intptr_t value) const;
void set_ic_data(const Array& value) const;
+ void set_state_bits(uint32_t bits) const;
+ enum {
+ kNumArgsTestedBits = 0,
Ivan Posva 2014/04/25 20:59:23 Pos and Size?
regis 2014/04/25 23:38:28 Done.
+ kNumArgsTestedSize = 2,
+ kDeoptReasonBits = kNumArgsTestedBits + kNumArgsTestedSize,
+ kDeoptReasonSize = kDeoptNumReasons,
+ kIssuedJSWarningBit = kDeoptReasonBits + kDeoptReasonSize,
+ kIsClosureCallBit = kIssuedJSWarningBit + 1,
+ };
+
+ class NumArgsTestedBits : public BitField<uint32_t,
+ kNumArgsTestedBits, kNumArgsTestedSize> {}; // NOLINT
+ class DeoptReasonBits : public BitField<uint32_t,
+ kDeoptReasonBits, kDeoptReasonSize> {}; // NOLINT
+ class IssuedJSWarningBit : public BitField<bool, kIssuedJSWarningBit, 1> {};
+ class IsClosureCallBit : public BitField<bool, kIsClosureCallBit, 1> {};
+
#if defined(DEBUG)
// Used in asserts to verify that a check is not added twice.
bool HasCheck(const GrowableArray<intptr_t>& cids) const;

Powered by Google App Engine
This is Rietveld 408576698