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

Side by Side Diff: src/ic/ic.h

Issue 1185343005: Revert of Revert of [strong] Implement strong mode restrictions on property access (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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
« no previous file with comments | « src/ic/ia32/ic-ia32.cc ('k') | src/ic/ic.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_H_ 5 #ifndef V8_IC_H_
6 #define V8_IC_H_ 6 #define V8_IC_H_
7 7
8 #include "src/ic/ic-state.h" 8 #include "src/ic/ic-state.h"
9 #include "src/macro-assembler.h" 9 #include "src/macro-assembler.h"
10 #include "src/messages.h" 10 #include "src/messages.h"
11 11
12 namespace v8 { 12 namespace v8 {
13 namespace internal { 13 namespace internal {
14 14
15 15
16 // IC_UTIL_LIST defines all utility functions called from generated 16 // IC_UTIL_LIST defines all utility functions called from generated
17 // inline caching code. The argument for the macro, ICU, is the function name. 17 // inline caching code. The argument for the macro, ICU, is the function name.
18 #define IC_UTIL_LIST(ICU) \ 18 #define IC_UTIL_LIST(ICU) \
19 ICU(LoadIC_Miss) \ 19 ICU(LoadIC_Miss) \
20 ICU(KeyedLoadIC_Miss) \ 20 ICU(KeyedLoadIC_Miss) \
21 ICU(LoadIC_Slow) \
22 ICU(KeyedLoadIC_Slow) \
21 ICU(CallIC_Miss) \ 23 ICU(CallIC_Miss) \
22 ICU(CallIC_Customization_Miss) \ 24 ICU(CallIC_Customization_Miss) \
23 ICU(StoreIC_Miss) \ 25 ICU(StoreIC_Miss) \
24 ICU(StoreIC_Slow) \ 26 ICU(StoreIC_Slow) \
25 ICU(KeyedStoreIC_Miss) \ 27 ICU(KeyedStoreIC_Miss) \
26 ICU(KeyedStoreIC_Slow) \ 28 ICU(KeyedStoreIC_Slow) \
27 /* Utilities for IC stubs. */ \ 29 /* Utilities for IC stubs. */ \
28 ICU(StoreCallbackProperty) \ 30 ICU(StoreCallbackProperty) \
29 ICU(LoadPropertyWithInterceptorOnly) \ 31 ICU(LoadPropertyWithInterceptorOnly) \
30 ICU(LoadPropertyWithInterceptor) \ 32 ICU(LoadPropertyWithInterceptor) \
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 CallICState::CallType call_type); 347 CallICState::CallType call_type);
346 static Handle<Code> initialize_stub_in_optimized_code( 348 static Handle<Code> initialize_stub_in_optimized_code(
347 Isolate* isolate, int argc, CallICState::CallType call_type); 349 Isolate* isolate, int argc, CallICState::CallType call_type);
348 350
349 static void Clear(Isolate* isolate, Code* host, CallICNexus* nexus); 351 static void Clear(Isolate* isolate, Code* host, CallICNexus* nexus);
350 }; 352 };
351 353
352 354
353 class LoadIC : public IC { 355 class LoadIC : public IC {
354 public: 356 public:
355 static ExtraICState ComputeExtraICState(ContextualMode contextual_mode) { 357 static ExtraICState ComputeExtraICState(ContextualMode contextual_mode,
356 return LoadICState(contextual_mode).GetExtraICState(); 358 LanguageMode language_mode) {
359 return LoadICState(contextual_mode, language_mode).GetExtraICState();
357 } 360 }
358 361
359 ContextualMode contextual_mode() const { 362 ContextualMode contextual_mode() const {
360 return LoadICState::GetContextualMode(extra_ic_state()); 363 return LoadICState::GetContextualMode(extra_ic_state());
361 } 364 }
362 365
366 LanguageMode language_mode() const {
367 return LoadICState::GetLanguageMode(extra_ic_state());
368 }
369
363 LoadIC(FrameDepth depth, Isolate* isolate, FeedbackNexus* nexus = NULL) 370 LoadIC(FrameDepth depth, Isolate* isolate, FeedbackNexus* nexus = NULL)
364 : IC(depth, isolate, nexus) { 371 : IC(depth, isolate, nexus) {
365 DCHECK(nexus != NULL); 372 DCHECK(nexus != NULL);
366 DCHECK(IsLoadStub()); 373 DCHECK(IsLoadStub());
367 } 374 }
368 375
369 // TODO(mvstanton): The for_queries_only is because we have a case where we 376 // TODO(mvstanton): The for_queries_only is because we have a case where we
370 // construct an IC only to gather the contextual mode, and we don't have 377 // construct an IC only to gather the contextual mode, and we don't have
371 // vector/slot information. for_queries_only is a temporary hack to enable the 378 // vector/slot information. for_queries_only is a temporary hack to enable the
372 // strong DCHECK protection around vector/slot. 379 // strong DCHECK protection around vector/slot.
(...skipping 10 matching lines...) Expand all
383 } else { 390 } else {
384 DCHECK(contextual_mode() != CONTEXTUAL); 391 DCHECK(contextual_mode() != CONTEXTUAL);
385 return false; 392 return false;
386 } 393 }
387 } 394 }
388 395
389 // Code generator routines. 396 // Code generator routines.
390 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); } 397 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); }
391 static void GenerateMiss(MacroAssembler* masm); 398 static void GenerateMiss(MacroAssembler* masm);
392 static void GenerateNormal(MacroAssembler* masm); 399 static void GenerateNormal(MacroAssembler* masm);
393 static void GenerateRuntimeGetProperty(MacroAssembler* masm); 400 static void GenerateSlow(MacroAssembler* masm);
394 401
395 static Handle<Code> initialize_stub(Isolate* isolate, 402 static Handle<Code> initialize_stub(Isolate* isolate,
396 ExtraICState extra_state); 403 ExtraICState extra_state);
397 static Handle<Code> initialize_stub_in_optimized_code( 404 static Handle<Code> initialize_stub_in_optimized_code(
398 Isolate* isolate, ExtraICState extra_state, State initialization_state); 405 Isolate* isolate, ExtraICState extra_state, State initialization_state);
399 406
400 MUST_USE_RESULT MaybeHandle<Object> Load(Handle<Object> object, 407 MUST_USE_RESULT MaybeHandle<Object> Load(Handle<Object> object,
401 Handle<Name> name); 408 Handle<Name> name);
402 409
403 static void Clear(Isolate* isolate, Code* host, LoadICNexus* nexus); 410 static void Clear(Isolate* isolate, Code* host, LoadICNexus* nexus);
(...skipping 26 matching lines...) Expand all
430 static void Clear(Isolate* isolate, Address address, Code* target, 437 static void Clear(Isolate* isolate, Address address, Code* target,
431 Address constant_pool); 438 Address constant_pool);
432 439
433 friend class IC; 440 friend class IC;
434 }; 441 };
435 442
436 443
437 class KeyedLoadIC : public LoadIC { 444 class KeyedLoadIC : public LoadIC {
438 public: 445 public:
439 // ExtraICState bits (building on IC) 446 // ExtraICState bits (building on IC)
440 class IcCheckTypeField : public BitField<IcCheckType, 1, 1> {}; 447 class IcCheckTypeField : public BitField<IcCheckType, 2, 1> {};
441 448
442 static ExtraICState ComputeExtraICState(ContextualMode contextual_mode, 449 static ExtraICState ComputeExtraICState(ContextualMode contextual_mode,
450 LanguageMode language_mode,
443 IcCheckType key_type) { 451 IcCheckType key_type) {
444 return LoadICState(contextual_mode).GetExtraICState() | 452 return LoadICState(contextual_mode, language_mode).GetExtraICState() |
445 IcCheckTypeField::encode(key_type); 453 IcCheckTypeField::encode(key_type);
446 } 454 }
447 455
448 static IcCheckType GetKeyType(ExtraICState extra_state) { 456 static IcCheckType GetKeyType(ExtraICState extra_state) {
449 return IcCheckTypeField::decode(extra_state); 457 return IcCheckTypeField::decode(extra_state);
450 } 458 }
451 459
452 KeyedLoadIC(FrameDepth depth, Isolate* isolate, 460 KeyedLoadIC(FrameDepth depth, Isolate* isolate,
453 KeyedLoadICNexus* nexus = NULL) 461 KeyedLoadICNexus* nexus = NULL)
454 : LoadIC(depth, isolate, nexus) { 462 : LoadIC(depth, isolate, nexus) {
455 DCHECK(nexus != NULL); 463 DCHECK(nexus != NULL);
456 DCHECK(target()->is_keyed_load_stub()); 464 DCHECK(target()->is_keyed_load_stub());
457 } 465 }
458 466
459 MUST_USE_RESULT MaybeHandle<Object> Load(Handle<Object> object, 467 MUST_USE_RESULT MaybeHandle<Object> Load(Handle<Object> object,
460 Handle<Object> key); 468 Handle<Object> key);
461 469
462 // Code generator routines. 470 // Code generator routines.
463 static void GenerateMiss(MacroAssembler* masm); 471 static void GenerateMiss(MacroAssembler* masm);
464 static void GenerateRuntimeGetProperty(MacroAssembler* masm); 472 static void GenerateSlow(MacroAssembler* masm);
465 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); } 473 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); }
466 static void GenerateMegamorphic(MacroAssembler* masm); 474 static void GenerateMegamorphic(MacroAssembler* masm,
475 LanguageMode languageMode);
467 476
468 // Bit mask to be tested against bit field for the cases when 477 // Bit mask to be tested against bit field for the cases when
469 // generic stub should go into slow case. 478 // generic stub should go into slow case.
470 // Access check is necessary explicitly since generic stub does not perform 479 // Access check is necessary explicitly since generic stub does not perform
471 // map checks. 480 // map checks.
472 static const int kSlowCaseBitFieldMask = 481 static const int kSlowCaseBitFieldMask =
473 (1 << Map::kIsAccessCheckNeeded) | (1 << Map::kHasIndexedInterceptor); 482 (1 << Map::kIsAccessCheckNeeded) | (1 << Map::kHasIndexedInterceptor);
474 483
475 static Handle<Code> initialize_stub(Isolate* isolate); 484 static Handle<Code> initialize_stub(Isolate* isolate,
485 ExtraICState extra_state);
476 static Handle<Code> initialize_stub_in_optimized_code( 486 static Handle<Code> initialize_stub_in_optimized_code(
477 Isolate* isolate, State initialization_state); 487 Isolate* isolate, State initialization_state, ExtraICState extra_state);
478 static Handle<Code> ChooseMegamorphicStub(Isolate* isolate); 488 static Handle<Code> ChooseMegamorphicStub(Isolate* isolate,
489 ExtraICState extra_state);
479 490
480 static void Clear(Isolate* isolate, Code* host, KeyedLoadICNexus* nexus); 491 static void Clear(Isolate* isolate, Code* host, KeyedLoadICNexus* nexus);
481 492
482 protected: 493 protected:
483 // receiver is HeapObject because it could be a String or a JSObject 494 // receiver is HeapObject because it could be a String or a JSObject
484 Handle<Code> LoadElementStub(Handle<HeapObject> receiver); 495 Handle<Code> LoadElementStub(Handle<HeapObject> receiver);
485 496
486 private: 497 private:
487 static void Clear(Isolate* isolate, Address address, Code* target, 498 static void Clear(Isolate* isolate, Address address, Code* target,
488 Address constant_pool); 499 Address constant_pool);
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 747
737 // Support functions for interceptor handlers. 748 // Support functions for interceptor handlers.
738 DECLARE_RUNTIME_FUNCTION(LoadPropertyWithInterceptorOnly); 749 DECLARE_RUNTIME_FUNCTION(LoadPropertyWithInterceptorOnly);
739 DECLARE_RUNTIME_FUNCTION(LoadPropertyWithInterceptor); 750 DECLARE_RUNTIME_FUNCTION(LoadPropertyWithInterceptor);
740 DECLARE_RUNTIME_FUNCTION(LoadElementWithInterceptor); 751 DECLARE_RUNTIME_FUNCTION(LoadElementWithInterceptor);
741 DECLARE_RUNTIME_FUNCTION(StorePropertyWithInterceptor); 752 DECLARE_RUNTIME_FUNCTION(StorePropertyWithInterceptor);
742 } 753 }
743 } // namespace v8::internal 754 } // namespace v8::internal
744 755
745 #endif // V8_IC_H_ 756 #endif // V8_IC_H_
OLDNEW
« no previous file with comments | « src/ic/ia32/ic-ia32.cc ('k') | src/ic/ic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698