| 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 return !FLAG_use_ic || state == UNINITIALIZED || state == PREMONOMORPHIC; | 107 return !FLAG_use_ic || state == UNINITIALIZED || state == PREMONOMORPHIC; |
| 108 } | 108 } |
| 109 | 109 |
| 110 static bool IsCleared(FeedbackNexus* nexus) { | 110 static bool IsCleared(FeedbackNexus* nexus) { |
| 111 InlineCacheState state = nexus->StateFromFeedback(); | 111 InlineCacheState state = nexus->StateFromFeedback(); |
| 112 return !FLAG_use_ic || state == UNINITIALIZED || state == PREMONOMORPHIC; | 112 return !FLAG_use_ic || state == UNINITIALIZED || state == PREMONOMORPHIC; |
| 113 } | 113 } |
| 114 | 114 |
| 115 static bool ICUseVector(Code::Kind kind) { | 115 static bool ICUseVector(Code::Kind kind) { |
| 116 return kind == Code::LOAD_IC || kind == Code::KEYED_LOAD_IC || | 116 return kind == Code::LOAD_IC || kind == Code::KEYED_LOAD_IC || |
| 117 kind == Code::CALL_IC; | 117 kind == Code::CALL_IC || |
| 118 (FLAG_vector_stores && |
| 119 (kind == Code::STORE_IC || kind == Code::KEYED_STORE_IC)); |
| 118 } | 120 } |
| 119 | 121 |
| 120 protected: | 122 protected: |
| 121 // Get the call-site target; used for determining the state. | 123 // Get the call-site target; used for determining the state. |
| 122 Handle<Code> target() const { return target_; } | 124 Handle<Code> target() const { return target_; } |
| 123 | 125 |
| 124 Address fp() const { return fp_; } | 126 Address fp() const { return fp_; } |
| 125 Address pc() const { return *pc_address_; } | 127 Address pc() const { return *pc_address_; } |
| 126 Isolate* isolate() const { return isolate_; } | 128 Isolate* isolate() const { return isolate_; } |
| 127 | 129 |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 friend class IC; | 492 friend class IC; |
| 491 }; | 493 }; |
| 492 | 494 |
| 493 | 495 |
| 494 class StoreIC : public IC { | 496 class StoreIC : public IC { |
| 495 public: | 497 public: |
| 496 static ExtraICState ComputeExtraICState(LanguageMode flag) { | 498 static ExtraICState ComputeExtraICState(LanguageMode flag) { |
| 497 return StoreICState(flag).GetExtraICState(); | 499 return StoreICState(flag).GetExtraICState(); |
| 498 } | 500 } |
| 499 | 501 |
| 500 StoreIC(FrameDepth depth, Isolate* isolate) : IC(depth, isolate) { | 502 StoreIC(FrameDepth depth, Isolate* isolate, FeedbackNexus* nexus = NULL) |
| 503 : IC(depth, isolate, nexus) { |
| 501 DCHECK(IsStoreStub()); | 504 DCHECK(IsStoreStub()); |
| 502 } | 505 } |
| 503 | 506 |
| 504 LanguageMode language_mode() const { | 507 LanguageMode language_mode() const { |
| 505 return StoreICState::GetLanguageMode(extra_ic_state()); | 508 return StoreICState::GetLanguageMode(extra_ic_state()); |
| 506 } | 509 } |
| 507 | 510 |
| 508 // Code generators for stub routines. Only called once at startup. | 511 // Code generators for stub routines. Only called once at startup. |
| 509 static void GenerateSlow(MacroAssembler* masm); | 512 static void GenerateSlow(MacroAssembler* masm); |
| 510 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); } | 513 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 524 Isolate* isolate, LanguageMode language_mode, State initialization_state); | 527 Isolate* isolate, LanguageMode language_mode, State initialization_state); |
| 525 | 528 |
| 526 MUST_USE_RESULT MaybeHandle<Object> Store( | 529 MUST_USE_RESULT MaybeHandle<Object> Store( |
| 527 Handle<Object> object, Handle<Name> name, Handle<Object> value, | 530 Handle<Object> object, Handle<Name> name, Handle<Object> value, |
| 528 JSReceiver::StoreFromKeyed store_mode = | 531 JSReceiver::StoreFromKeyed store_mode = |
| 529 JSReceiver::CERTAINLY_NOT_STORE_FROM_KEYED); | 532 JSReceiver::CERTAINLY_NOT_STORE_FROM_KEYED); |
| 530 | 533 |
| 531 bool LookupForWrite(LookupIterator* it, Handle<Object> value, | 534 bool LookupForWrite(LookupIterator* it, Handle<Object> value, |
| 532 JSReceiver::StoreFromKeyed store_mode); | 535 JSReceiver::StoreFromKeyed store_mode); |
| 533 | 536 |
| 537 static void Clear(Isolate* isolate, Code* host, StoreICNexus* nexus); |
| 538 |
| 534 protected: | 539 protected: |
| 535 // Stub accessors. | 540 // Stub accessors. |
| 536 Handle<Code> megamorphic_stub() override; | 541 Handle<Code> megamorphic_stub() override; |
| 537 Handle<Code> slow_stub() const; | 542 Handle<Code> slow_stub() const; |
| 538 | 543 |
| 539 virtual Handle<Code> pre_monomorphic_stub() const { | 544 virtual Handle<Code> pre_monomorphic_stub() const { |
| 540 return pre_monomorphic_stub(isolate(), language_mode()); | 545 return pre_monomorphic_stub(isolate(), language_mode()); |
| 541 } | 546 } |
| 542 | 547 |
| 543 static Handle<Code> pre_monomorphic_stub(Isolate* isolate, | 548 static Handle<Code> pre_monomorphic_stub(Isolate* isolate, |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 | 592 |
| 588 static KeyedAccessStoreMode GetKeyedAccessStoreMode( | 593 static KeyedAccessStoreMode GetKeyedAccessStoreMode( |
| 589 ExtraICState extra_state) { | 594 ExtraICState extra_state) { |
| 590 return ExtraICStateKeyedAccessStoreMode::decode(extra_state); | 595 return ExtraICStateKeyedAccessStoreMode::decode(extra_state); |
| 591 } | 596 } |
| 592 | 597 |
| 593 static IcCheckType GetKeyType(ExtraICState extra_state) { | 598 static IcCheckType GetKeyType(ExtraICState extra_state) { |
| 594 return IcCheckTypeField::decode(extra_state); | 599 return IcCheckTypeField::decode(extra_state); |
| 595 } | 600 } |
| 596 | 601 |
| 597 KeyedStoreIC(FrameDepth depth, Isolate* isolate) : StoreIC(depth, isolate) { | 602 KeyedStoreIC(FrameDepth depth, Isolate* isolate, |
| 603 KeyedStoreICNexus* nexus = NULL) |
| 604 : StoreIC(depth, isolate, nexus) { |
| 598 DCHECK(target()->is_keyed_store_stub()); | 605 DCHECK(target()->is_keyed_store_stub()); |
| 599 } | 606 } |
| 600 | 607 |
| 601 MUST_USE_RESULT MaybeHandle<Object> Store(Handle<Object> object, | 608 MUST_USE_RESULT MaybeHandle<Object> Store(Handle<Object> object, |
| 602 Handle<Object> name, | 609 Handle<Object> name, |
| 603 Handle<Object> value); | 610 Handle<Object> value); |
| 604 | 611 |
| 605 // Code generators for stub routines. Only called once at startup. | 612 // Code generators for stub routines. Only called once at startup. |
| 606 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); } | 613 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); } |
| 607 static void GeneratePreMonomorphic(MacroAssembler* masm) { | 614 static void GeneratePreMonomorphic(MacroAssembler* masm) { |
| 608 GenerateMiss(masm); | 615 GenerateMiss(masm); |
| 609 } | 616 } |
| 610 static void GenerateMiss(MacroAssembler* masm); | 617 static void GenerateMiss(MacroAssembler* masm); |
| 611 static void GenerateSlow(MacroAssembler* masm); | 618 static void GenerateSlow(MacroAssembler* masm); |
| 612 static void GenerateMegamorphic(MacroAssembler* masm, | 619 static void GenerateMegamorphic(MacroAssembler* masm, |
| 613 LanguageMode language_mode); | 620 LanguageMode language_mode); |
| 614 | 621 |
| 615 static Handle<Code> initialize_stub(Isolate* isolate, | 622 static Handle<Code> initialize_stub(Isolate* isolate, |
| 616 LanguageMode language_mode, | 623 LanguageMode language_mode, |
| 617 State initialization_state); | 624 State initialization_state); |
| 618 | 625 |
| 619 static Handle<Code> initialize_stub_in_optimized_code( | 626 static Handle<Code> initialize_stub_in_optimized_code( |
| 620 Isolate* isolate, LanguageMode language_mode, State initialization_state); | 627 Isolate* isolate, LanguageMode language_mode, State initialization_state); |
| 621 | 628 |
| 629 static void Clear(Isolate* isolate, Code* host, KeyedStoreICNexus* nexus); |
| 630 |
| 622 protected: | 631 protected: |
| 623 virtual Handle<Code> pre_monomorphic_stub() const { | 632 virtual Handle<Code> pre_monomorphic_stub() const { |
| 624 return pre_monomorphic_stub(isolate(), language_mode()); | 633 return pre_monomorphic_stub(isolate(), language_mode()); |
| 625 } | 634 } |
| 626 static Handle<Code> pre_monomorphic_stub(Isolate* isolate, | 635 static Handle<Code> pre_monomorphic_stub(Isolate* isolate, |
| 627 LanguageMode language_mode) { | 636 LanguageMode language_mode) { |
| 628 if (is_strict(language_mode)) { | 637 if (is_strict(language_mode)) { |
| 629 return isolate->builtins()->KeyedStoreIC_PreMonomorphic_Strict(); | 638 return isolate->builtins()->KeyedStoreIC_PreMonomorphic_Strict(); |
| 630 } else { | 639 } else { |
| 631 return isolate->builtins()->KeyedStoreIC_PreMonomorphic(); | 640 return isolate->builtins()->KeyedStoreIC_PreMonomorphic(); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 741 | 750 |
| 742 // Support functions for interceptor handlers. | 751 // Support functions for interceptor handlers. |
| 743 DECLARE_RUNTIME_FUNCTION(LoadPropertyWithInterceptorOnly); | 752 DECLARE_RUNTIME_FUNCTION(LoadPropertyWithInterceptorOnly); |
| 744 DECLARE_RUNTIME_FUNCTION(LoadPropertyWithInterceptor); | 753 DECLARE_RUNTIME_FUNCTION(LoadPropertyWithInterceptor); |
| 745 DECLARE_RUNTIME_FUNCTION(LoadElementWithInterceptor); | 754 DECLARE_RUNTIME_FUNCTION(LoadElementWithInterceptor); |
| 746 DECLARE_RUNTIME_FUNCTION(StorePropertyWithInterceptor); | 755 DECLARE_RUNTIME_FUNCTION(StorePropertyWithInterceptor); |
| 747 } | 756 } |
| 748 } // namespace v8::internal | 757 } // namespace v8::internal |
| 749 | 758 |
| 750 #endif // V8_IC_H_ | 759 #endif // V8_IC_H_ |
| OLD | NEW |