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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_IC_STATE_H_ 5 #ifndef V8_IC_STATE_H_
6 #define V8_IC_STATE_H_ 6 #define V8_IC_STATE_H_
7 7
8 #include "src/macro-assembler.h" 8 #include "src/macro-assembler.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 194
195 static const char* GetStateName(CompareICState::State state); 195 static const char* GetStateName(CompareICState::State state);
196 196
197 static State TargetState(State old_state, State old_left, State old_right, 197 static State TargetState(State old_state, State old_left, State old_right,
198 Token::Value op, bool has_inlined_smi_code, 198 Token::Value op, bool has_inlined_smi_code,
199 Handle<Object> x, Handle<Object> y); 199 Handle<Object> x, Handle<Object> y);
200 }; 200 };
201 201
202 202
203 class LoadICState final BASE_EMBEDDED { 203 class LoadICState final BASE_EMBEDDED {
204 private:
205 class ContextualModeBits : public BitField<ContextualMode, 0, 1> {};
206 class StrengthBits : public BitField<bool, 1, 1> {};
207 STATIC_ASSERT(static_cast<int>(NOT_CONTEXTUAL) == 0);
208 const ExtraICState state_;
209
204 public: 210 public:
211 static const ExtraICState kStrongModeState = 1 << StrengthBits::kShift;
212
205 explicit LoadICState(ExtraICState extra_ic_state) : state_(extra_ic_state) {} 213 explicit LoadICState(ExtraICState extra_ic_state) : state_(extra_ic_state) {}
206 214
207 explicit LoadICState(ContextualMode mode) 215 explicit LoadICState(ContextualMode mode, Strength strength)
208 : state_(ContextualModeBits::encode(mode)) {} 216 : state_(ContextualModeBits::encode(mode) |
217 StrengthBits::encode(is_strong(strength))) {}
209 218
210 ExtraICState GetExtraICState() const { return state_; } 219 ExtraICState GetExtraICState() const { return state_; }
211 220
212 ContextualMode contextual_mode() const { 221 ContextualMode contextual_mode() const {
213 return ContextualModeBits::decode(state_); 222 return ContextualModeBits::decode(state_);
214 } 223 }
215 224
225 Strength strength() const {
226 return StrengthBits::decode(state_) ? Strength::STRONG : Strength::WEAK;
227 }
228
216 static ContextualMode GetContextualMode(ExtraICState state) { 229 static ContextualMode GetContextualMode(ExtraICState state) {
217 return LoadICState(state).contextual_mode(); 230 return LoadICState(state).contextual_mode();
218 } 231 }
219 232
220 private: 233 static Strength GetStrength(ExtraICState state) {
221 class ContextualModeBits : public BitField<ContextualMode, 0, 1> {}; 234 return LoadICState(state).strength();
222 STATIC_ASSERT(static_cast<int>(NOT_CONTEXTUAL) == 0); 235 }
223
224 const ExtraICState state_;
225 }; 236 };
226 237
227 238
228 class StoreICState final BASE_EMBEDDED { 239 class StoreICState final BASE_EMBEDDED {
229 public: 240 public:
230 explicit StoreICState(ExtraICState extra_ic_state) : state_(extra_ic_state) {} 241 explicit StoreICState(ExtraICState extra_ic_state) : state_(extra_ic_state) {}
231 242
232 explicit StoreICState(LanguageMode mode) 243 explicit StoreICState(LanguageMode mode)
233 : state_(LanguageModeState::encode(mode)) {} 244 : state_(LanguageModeState::encode(mode)) {}
234 245
(...skipping 15 matching lines...) Expand all
250 static const ExtraICState kStrictModeState = STRICT 261 static const ExtraICState kStrictModeState = STRICT
251 << LanguageModeState::kShift; 262 << LanguageModeState::kShift;
252 263
253 private: 264 private:
254 const ExtraICState state_; 265 const ExtraICState state_;
255 }; 266 };
256 } 267 }
257 } 268 }
258 269
259 #endif // V8_IC_STATE_H_ 270 #endif // V8_IC_STATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698