OLD | NEW |
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" |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 private: | 485 private: |
486 static void Clear(Isolate* isolate, Address address, Code* target, | 486 static void Clear(Isolate* isolate, Address address, Code* target, |
487 ConstantPoolArray* constant_pool); | 487 ConstantPoolArray* constant_pool); |
488 | 488 |
489 friend class IC; | 489 friend class IC; |
490 }; | 490 }; |
491 | 491 |
492 | 492 |
493 class StoreIC : public IC { | 493 class StoreIC : public IC { |
494 public: | 494 public: |
495 STATIC_ASSERT(i::LANGUAGE_END == 3); | |
496 class LanguageModeState : public BitField<LanguageMode, 1, 2> {}; | |
497 static ExtraICState ComputeExtraICState(LanguageMode flag) { | 495 static ExtraICState ComputeExtraICState(LanguageMode flag) { |
498 return LanguageModeState::encode(flag); | 496 return StoreICState(flag).GetExtraICState(); |
499 } | 497 } |
500 static LanguageMode GetLanguageMode(ExtraICState state) { | |
501 return LanguageModeState::decode(state); | |
502 } | |
503 | |
504 // For convenience, a statically declared encoding of strict mode extra | |
505 // IC state. | |
506 static const ExtraICState kStrictModeState = STRICT | |
507 << LanguageModeState::kShift; | |
508 | 498 |
509 StoreIC(FrameDepth depth, Isolate* isolate) : IC(depth, isolate) { | 499 StoreIC(FrameDepth depth, Isolate* isolate) : IC(depth, isolate) { |
510 DCHECK(IsStoreStub()); | 500 DCHECK(IsStoreStub()); |
511 } | 501 } |
512 | 502 |
513 LanguageMode language_mode() const { | 503 LanguageMode language_mode() const { |
514 return LanguageModeState::decode(extra_ic_state()); | 504 return StoreICState::GetLanguageMode(extra_ic_state()); |
515 } | 505 } |
516 | 506 |
517 // Code generators for stub routines. Only called once at startup. | 507 // Code generators for stub routines. Only called once at startup. |
518 static void GenerateSlow(MacroAssembler* masm); | 508 static void GenerateSlow(MacroAssembler* masm); |
519 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); } | 509 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); } |
520 static void GeneratePreMonomorphic(MacroAssembler* masm) { | 510 static void GeneratePreMonomorphic(MacroAssembler* masm) { |
521 GenerateMiss(masm); | 511 GenerateMiss(masm); |
522 } | 512 } |
523 static void GenerateMiss(MacroAssembler* masm); | 513 static void GenerateMiss(MacroAssembler* masm); |
524 static void GenerateMegamorphic(MacroAssembler* masm); | 514 static void GenerateMegamorphic(MacroAssembler* masm); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 // ExtraICState bits | 570 // ExtraICState bits |
581 // When more language modes are added, these BitFields need to move too. | 571 // When more language modes are added, these BitFields need to move too. |
582 STATIC_ASSERT(i::LANGUAGE_END == 3); | 572 STATIC_ASSERT(i::LANGUAGE_END == 3); |
583 class ExtraICStateKeyedAccessStoreMode | 573 class ExtraICStateKeyedAccessStoreMode |
584 : public BitField<KeyedAccessStoreMode, 3, 4> {}; // NOLINT | 574 : public BitField<KeyedAccessStoreMode, 3, 4> {}; // NOLINT |
585 | 575 |
586 class IcCheckTypeField : public BitField<IcCheckType, 7, 1> {}; | 576 class IcCheckTypeField : public BitField<IcCheckType, 7, 1> {}; |
587 | 577 |
588 static ExtraICState ComputeExtraICState(LanguageMode flag, | 578 static ExtraICState ComputeExtraICState(LanguageMode flag, |
589 KeyedAccessStoreMode mode) { | 579 KeyedAccessStoreMode mode) { |
590 return LanguageModeState::encode(flag) | | 580 return StoreICState(flag).GetExtraICState() | |
591 ExtraICStateKeyedAccessStoreMode::encode(mode) | | 581 ExtraICStateKeyedAccessStoreMode::encode(mode) | |
592 IcCheckTypeField::encode(ELEMENT); | 582 IcCheckTypeField::encode(ELEMENT); |
593 } | 583 } |
594 | 584 |
595 static KeyedAccessStoreMode GetKeyedAccessStoreMode( | 585 static KeyedAccessStoreMode GetKeyedAccessStoreMode( |
596 ExtraICState extra_state) { | 586 ExtraICState extra_state) { |
597 return ExtraICStateKeyedAccessStoreMode::decode(extra_state); | 587 return ExtraICStateKeyedAccessStoreMode::decode(extra_state); |
598 } | 588 } |
599 | 589 |
600 static IcCheckType GetKeyType(ExtraICState extra_state) { | 590 static IcCheckType GetKeyType(ExtraICState extra_state) { |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
752 | 742 |
753 // Support functions for interceptor handlers. | 743 // Support functions for interceptor handlers. |
754 DECLARE_RUNTIME_FUNCTION(LoadPropertyWithInterceptorOnly); | 744 DECLARE_RUNTIME_FUNCTION(LoadPropertyWithInterceptorOnly); |
755 DECLARE_RUNTIME_FUNCTION(LoadPropertyWithInterceptor); | 745 DECLARE_RUNTIME_FUNCTION(LoadPropertyWithInterceptor); |
756 DECLARE_RUNTIME_FUNCTION(LoadElementWithInterceptor); | 746 DECLARE_RUNTIME_FUNCTION(LoadElementWithInterceptor); |
757 DECLARE_RUNTIME_FUNCTION(StorePropertyWithInterceptor); | 747 DECLARE_RUNTIME_FUNCTION(StorePropertyWithInterceptor); |
758 } | 748 } |
759 } // namespace v8::internal | 749 } // namespace v8::internal |
760 | 750 |
761 #endif // V8_IC_H_ | 751 #endif // V8_IC_H_ |
OLD | NEW |