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

Unified Diff: src/ic/ic-state.h

Issue 1168093002: [strong] Implement strong mode restrictions on property access (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix arm64 port Created 5 years, 6 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: src/ic/ic-state.h
diff --git a/src/ic/ic-state.h b/src/ic/ic-state.h
index dbc504bf6d79f9f95d6a86e14eca0514198507f5..4df355db9022a4c69d8709c68dab23c6d0e16bee 100644
--- a/src/ic/ic-state.h
+++ b/src/ic/ic-state.h
@@ -201,11 +201,20 @@ class CompareICState {
class LoadICState final BASE_EMBEDDED {
+ private:
+ class ContextualModeBits : public BitField<ContextualMode, 0, 1> {};
+ class StrengthBits : public BitField<bool, 1, 1> {};
+ STATIC_ASSERT(static_cast<int>(NOT_CONTEXTUAL) == 0);
+ const ExtraICState state_;
+
public:
+ static const ExtraICState kStrongModeState = 1 << StrengthBits::kShift;
+
explicit LoadICState(ExtraICState extra_ic_state) : state_(extra_ic_state) {}
- explicit LoadICState(ContextualMode mode)
- : state_(ContextualModeBits::encode(mode)) {}
+ explicit LoadICState(ContextualMode mode, Strength strength)
+ : state_(ContextualModeBits::encode(mode) |
+ StrengthBits::encode(is_strong(strength))) {}
ExtraICState GetExtraICState() const { return state_; }
@@ -213,15 +222,17 @@ class LoadICState final BASE_EMBEDDED {
return ContextualModeBits::decode(state_);
}
+ Strength strength() const {
+ return StrengthBits::decode(state_) ? Strength::STRONG : Strength::WEAK;
+ }
+
static ContextualMode GetContextualMode(ExtraICState state) {
return LoadICState(state).contextual_mode();
}
- private:
- class ContextualModeBits : public BitField<ContextualMode, 0, 1> {};
- STATIC_ASSERT(static_cast<int>(NOT_CONTEXTUAL) == 0);
-
- const ExtraICState state_;
+ static Strength GetStrength(ExtraICState state) {
+ return LoadICState(state).strength();
+ }
};

Powered by Google App Engine
This is Rietveld 408576698