| 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 } | 115 } |
| 116 | 116 |
| 117 // Configure for most states. | 117 // Configure for most states. |
| 118 void ConfigureVectorState(IC::State new_state); | 118 void ConfigureVectorState(IC::State new_state); |
| 119 // Configure the vector for MONOMORPHIC. | 119 // Configure the vector for MONOMORPHIC. |
| 120 void ConfigureVectorState(Handle<Name> name, Handle<Map> map, | 120 void ConfigureVectorState(Handle<Name> name, Handle<Map> map, |
| 121 Handle<Code> handler); | 121 Handle<Code> handler); |
| 122 // Configure the vector for POLYMORPHIC. | 122 // Configure the vector for POLYMORPHIC. |
| 123 void ConfigureVectorState(Handle<Name> name, MapHandleList* maps, | 123 void ConfigureVectorState(Handle<Name> name, MapHandleList* maps, |
| 124 CodeHandleList* handlers); | 124 CodeHandleList* handlers); |
| 125 // Configure the vector for POLYMORPHIC with transitions (only for element |
| 126 // keyed stores). |
| 127 void ConfigureVectorState(MapHandleList* maps, |
| 128 MapHandleList* transitioned_maps, |
| 129 CodeHandleList* handlers); |
| 125 | 130 |
| 126 char TransitionMarkFromState(IC::State state); | 131 char TransitionMarkFromState(IC::State state); |
| 127 void TraceIC(const char* type, Handle<Object> name); | 132 void TraceIC(const char* type, Handle<Object> name); |
| 128 void TraceIC(const char* type, Handle<Object> name, State old_state, | 133 void TraceIC(const char* type, Handle<Object> name, State old_state, |
| 129 State new_state); | 134 State new_state); |
| 130 | 135 |
| 131 MaybeHandle<Object> TypeError(MessageTemplate::Template, | 136 MaybeHandle<Object> TypeError(MessageTemplate::Template, |
| 132 Handle<Object> object, Handle<Object> key); | 137 Handle<Object> object, Handle<Object> key); |
| 133 MaybeHandle<Object> ReferenceError(Handle<Name> name); | 138 MaybeHandle<Object> ReferenceError(Handle<Name> name); |
| 134 | 139 |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 | 536 |
| 532 static ExtraICState ComputeExtraICState(LanguageMode flag, | 537 static ExtraICState ComputeExtraICState(LanguageMode flag, |
| 533 KeyedAccessStoreMode mode) { | 538 KeyedAccessStoreMode mode) { |
| 534 return StoreICState(flag).GetExtraICState() | | 539 return StoreICState(flag).GetExtraICState() | |
| 535 ExtraICStateKeyedAccessStoreMode::encode(mode) | | 540 ExtraICStateKeyedAccessStoreMode::encode(mode) | |
| 536 IcCheckTypeField::encode(ELEMENT); | 541 IcCheckTypeField::encode(ELEMENT); |
| 537 } | 542 } |
| 538 | 543 |
| 539 static KeyedAccessStoreMode GetKeyedAccessStoreMode( | 544 static KeyedAccessStoreMode GetKeyedAccessStoreMode( |
| 540 ExtraICState extra_state) { | 545 ExtraICState extra_state) { |
| 546 DCHECK(!FLAG_vector_stores); |
| 541 return ExtraICStateKeyedAccessStoreMode::decode(extra_state); | 547 return ExtraICStateKeyedAccessStoreMode::decode(extra_state); |
| 542 } | 548 } |
| 543 | 549 |
| 550 KeyedAccessStoreMode GetKeyedAccessStoreMode() { |
| 551 DCHECK(FLAG_vector_stores); |
| 552 return casted_nexus<KeyedStoreICNexus>()->GetKeyedAccessStoreMode(); |
| 553 } |
| 554 |
| 544 static IcCheckType GetKeyType(ExtraICState extra_state) { | 555 static IcCheckType GetKeyType(ExtraICState extra_state) { |
| 556 DCHECK(!FLAG_vector_stores); |
| 545 return IcCheckTypeField::decode(extra_state); | 557 return IcCheckTypeField::decode(extra_state); |
| 546 } | 558 } |
| 547 | 559 |
| 548 KeyedStoreIC(FrameDepth depth, Isolate* isolate, | 560 KeyedStoreIC(FrameDepth depth, Isolate* isolate, |
| 549 KeyedStoreICNexus* nexus = NULL) | 561 KeyedStoreICNexus* nexus = NULL) |
| 550 : StoreIC(depth, isolate, nexus) { | 562 : StoreIC(depth, isolate, nexus) { |
| 551 DCHECK(target()->is_keyed_store_stub()); | 563 DCHECK(target()->is_keyed_store_stub()); |
| 552 } | 564 } |
| 553 | 565 |
| 554 MUST_USE_RESULT MaybeHandle<Object> Store(Handle<Object> object, | 566 MUST_USE_RESULT MaybeHandle<Object> Store(Handle<Object> object, |
| 555 Handle<Object> name, | 567 Handle<Object> name, |
| 556 Handle<Object> value); | 568 Handle<Object> value); |
| 557 | 569 |
| 558 // Code generators for stub routines. Only called once at startup. | 570 // Code generators for stub routines. Only called once at startup. |
| 559 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); } | 571 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); } |
| 560 static void GeneratePreMonomorphic(MacroAssembler* masm) { | 572 static void GeneratePreMonomorphic(MacroAssembler* masm) { |
| 561 GenerateMiss(masm); | 573 GenerateMiss(masm); |
| 562 } | 574 } |
| 563 static void GenerateMiss(MacroAssembler* masm); | 575 static void GenerateMiss(MacroAssembler* masm); |
| 564 static void GenerateSlow(MacroAssembler* masm); | 576 static void GenerateSlow(MacroAssembler* masm); |
| 565 static void GenerateMegamorphic(MacroAssembler* masm, | 577 static void GenerateMegamorphic(MacroAssembler* masm, |
| 566 LanguageMode language_mode); | 578 LanguageMode language_mode); |
| 567 | 579 |
| 568 static Handle<Code> initialize_stub(Isolate* isolate, | 580 static Handle<Code> initialize_stub(Isolate* isolate, |
| 569 LanguageMode language_mode, | 581 LanguageMode language_mode, |
| 570 State initialization_state); | 582 State initialization_state); |
| 571 | 583 |
| 572 static Handle<Code> initialize_stub_in_optimized_code( | 584 static Handle<Code> initialize_stub_in_optimized_code( |
| 573 Isolate* isolate, LanguageMode language_mode, State initialization_state); | 585 Isolate* isolate, LanguageMode language_mode, State initialization_state); |
| 586 static Handle<Code> ChooseMegamorphicStub(Isolate* isolate, |
| 587 ExtraICState extra_state); |
| 574 | 588 |
| 575 static void Clear(Isolate* isolate, Code* host, KeyedStoreICNexus* nexus); | 589 static void Clear(Isolate* isolate, Code* host, KeyedStoreICNexus* nexus); |
| 576 | 590 |
| 577 protected: | 591 protected: |
| 578 virtual Handle<Code> pre_monomorphic_stub() const { | 592 virtual Handle<Code> pre_monomorphic_stub() const { |
| 579 return pre_monomorphic_stub(isolate(), language_mode()); | 593 return pre_monomorphic_stub(isolate(), language_mode()); |
| 580 } | 594 } |
| 581 static Handle<Code> pre_monomorphic_stub(Isolate* isolate, | 595 static Handle<Code> pre_monomorphic_stub(Isolate* isolate, |
| 582 LanguageMode language_mode) { | 596 LanguageMode language_mode) { |
| 583 if (is_strict(language_mode)) { | 597 if (is_strict(language_mode)) { |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 675 | 689 |
| 676 | 690 |
| 677 // Helper for BinaryOpIC and CompareIC. | 691 // Helper for BinaryOpIC and CompareIC. |
| 678 enum InlinedSmiCheck { ENABLE_INLINED_SMI_CHECK, DISABLE_INLINED_SMI_CHECK }; | 692 enum InlinedSmiCheck { ENABLE_INLINED_SMI_CHECK, DISABLE_INLINED_SMI_CHECK }; |
| 679 void PatchInlinedSmiCode(Address address, InlinedSmiCheck check); | 693 void PatchInlinedSmiCode(Address address, InlinedSmiCheck check); |
| 680 | 694 |
| 681 } | 695 } |
| 682 } // namespace v8::internal | 696 } // namespace v8::internal |
| 683 | 697 |
| 684 #endif // V8_IC_H_ | 698 #endif // V8_IC_H_ |
| OLD | NEW |