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_CODE_STUBS_H_ | 5 #ifndef V8_CODE_STUBS_H_ |
6 #define V8_CODE_STUBS_H_ | 6 #define V8_CODE_STUBS_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/assembler.h" | 9 #include "src/assembler.h" |
| 10 #include "src/code-stub-assembler.h" |
10 #include "src/codegen.h" | 11 #include "src/codegen.h" |
11 #include "src/compiler/code-stub-assembler.h" | |
12 #include "src/globals.h" | 12 #include "src/globals.h" |
13 #include "src/ic/ic-state.h" | 13 #include "src/ic/ic-state.h" |
14 #include "src/interface-descriptors.h" | 14 #include "src/interface-descriptors.h" |
15 #include "src/macro-assembler.h" | 15 #include "src/macro-assembler.h" |
16 #include "src/ostreams.h" | 16 #include "src/ostreams.h" |
17 | 17 |
18 namespace v8 { | 18 namespace v8 { |
19 namespace internal { | 19 namespace internal { |
20 | 20 |
21 // List of code stubs used on all platforms. | 21 // List of code stubs used on all platforms. |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 void Generate(MacroAssembler* masm) override; \ | 389 void Generate(MacroAssembler* masm) override; \ |
390 DEFINE_CODE_STUB(NAME, SUPER) | 390 DEFINE_CODE_STUB(NAME, SUPER) |
391 | 391 |
392 | 392 |
393 #define DEFINE_HYDROGEN_CODE_STUB(NAME, SUPER) \ | 393 #define DEFINE_HYDROGEN_CODE_STUB(NAME, SUPER) \ |
394 public: \ | 394 public: \ |
395 void InitializeDescriptor(CodeStubDescriptor* descriptor) override; \ | 395 void InitializeDescriptor(CodeStubDescriptor* descriptor) override; \ |
396 Handle<Code> GenerateCode() override; \ | 396 Handle<Code> GenerateCode() override; \ |
397 DEFINE_CODE_STUB(NAME, SUPER) | 397 DEFINE_CODE_STUB(NAME, SUPER) |
398 | 398 |
399 #define DEFINE_TURBOFAN_CODE_STUB(NAME, SUPER) \ | 399 #define DEFINE_TURBOFAN_CODE_STUB(NAME, SUPER) \ |
400 public: \ | 400 public: \ |
401 void GenerateAssembly(compiler::CodeStubAssembler* assembler) \ | 401 void GenerateAssembly(CodeStubAssembler* assembler) const override; \ |
402 const override; \ | |
403 DEFINE_CODE_STUB(NAME, SUPER) | 402 DEFINE_CODE_STUB(NAME, SUPER) |
404 | 403 |
405 #define DEFINE_HANDLER_CODE_STUB(NAME, SUPER) \ | 404 #define DEFINE_HANDLER_CODE_STUB(NAME, SUPER) \ |
406 public: \ | 405 public: \ |
407 Handle<Code> GenerateCode() override; \ | 406 Handle<Code> GenerateCode() override; \ |
408 DEFINE_CODE_STUB(NAME, SUPER) | 407 DEFINE_CODE_STUB(NAME, SUPER) |
409 | 408 |
410 #define DEFINE_CALL_INTERFACE_DESCRIPTOR(NAME) \ | 409 #define DEFINE_CALL_INTERFACE_DESCRIPTOR(NAME) \ |
411 public: \ | 410 public: \ |
412 CallInterfaceDescriptor GetCallInterfaceDescriptor() const override { \ | 411 CallInterfaceDescriptor GetCallInterfaceDescriptor() const override { \ |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 // Retrieve the code for the stub. Generate the code if needed. | 580 // Retrieve the code for the stub. Generate the code if needed. |
582 Handle<Code> GenerateCode() override; | 581 Handle<Code> GenerateCode() override; |
583 | 582 |
584 int GetStackParameterCount() const override { | 583 int GetStackParameterCount() const override { |
585 return GetCallInterfaceDescriptor().GetStackParameterCount(); | 584 return GetCallInterfaceDescriptor().GetStackParameterCount(); |
586 } | 585 } |
587 | 586 |
588 protected: | 587 protected: |
589 explicit TurboFanCodeStub(Isolate* isolate) : CodeStub(isolate) {} | 588 explicit TurboFanCodeStub(Isolate* isolate) : CodeStub(isolate) {} |
590 | 589 |
591 virtual void GenerateAssembly( | 590 virtual void GenerateAssembly(CodeStubAssembler* assembler) const = 0; |
592 compiler::CodeStubAssembler* assembler) const = 0; | |
593 | 591 |
594 private: | 592 private: |
595 DEFINE_CODE_STUB_BASE(TurboFanCodeStub, CodeStub); | 593 DEFINE_CODE_STUB_BASE(TurboFanCodeStub, CodeStub); |
596 }; | 594 }; |
597 | 595 |
598 | 596 |
599 // Helper interface to prepare to/restore after making runtime calls. | 597 // Helper interface to prepare to/restore after making runtime calls. |
600 class RuntimeCallHelper { | 598 class RuntimeCallHelper { |
601 public: | 599 public: |
602 virtual ~RuntimeCallHelper() {} | 600 virtual ~RuntimeCallHelper() {} |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
903 explicit ToLengthStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} | 901 explicit ToLengthStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} |
904 | 902 |
905 DEFINE_CALL_INTERFACE_DESCRIPTOR(TypeConversion); | 903 DEFINE_CALL_INTERFACE_DESCRIPTOR(TypeConversion); |
906 DEFINE_TURBOFAN_CODE_STUB(ToLength, TurboFanCodeStub); | 904 DEFINE_TURBOFAN_CODE_STUB(ToLength, TurboFanCodeStub); |
907 }; | 905 }; |
908 | 906 |
909 class StoreInterceptorStub : public TurboFanCodeStub { | 907 class StoreInterceptorStub : public TurboFanCodeStub { |
910 public: | 908 public: |
911 explicit StoreInterceptorStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} | 909 explicit StoreInterceptorStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} |
912 | 910 |
913 void GenerateAssembly(compiler::CodeStubAssembler* assember) const override; | 911 void GenerateAssembly(CodeStubAssembler* assember) const override; |
914 | 912 |
915 Code::Kind GetCodeKind() const override { return Code::HANDLER; } | 913 Code::Kind GetCodeKind() const override { return Code::HANDLER; } |
916 ExtraICState GetExtraICState() const override { return Code::STORE_IC; } | 914 ExtraICState GetExtraICState() const override { return Code::STORE_IC; } |
917 InlineCacheState GetICState() const override { return MONOMORPHIC; } | 915 InlineCacheState GetICState() const override { return MONOMORPHIC; } |
918 | 916 |
919 DEFINE_CALL_INTERFACE_DESCRIPTOR(Store); | 917 DEFINE_CALL_INTERFACE_DESCRIPTOR(Store); |
920 DEFINE_CODE_STUB(StoreInterceptor, TurboFanCodeStub); | 918 DEFINE_CODE_STUB(StoreInterceptor, TurboFanCodeStub); |
921 }; | 919 }; |
922 | 920 |
923 class LoadIndexedInterceptorStub : public TurboFanCodeStub { | 921 class LoadIndexedInterceptorStub : public TurboFanCodeStub { |
(...skipping 1746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2670 DEFINE_CALL_INTERFACE_DESCRIPTOR(TransitionElementsKind); | 2668 DEFINE_CALL_INTERFACE_DESCRIPTOR(TransitionElementsKind); |
2671 DEFINE_HYDROGEN_CODE_STUB(TransitionElementsKind, HydrogenCodeStub); | 2669 DEFINE_HYDROGEN_CODE_STUB(TransitionElementsKind, HydrogenCodeStub); |
2672 }; | 2670 }; |
2673 | 2671 |
2674 class AllocateHeapNumberStub : public TurboFanCodeStub { | 2672 class AllocateHeapNumberStub : public TurboFanCodeStub { |
2675 public: | 2673 public: |
2676 explicit AllocateHeapNumberStub(Isolate* isolate) | 2674 explicit AllocateHeapNumberStub(Isolate* isolate) |
2677 : TurboFanCodeStub(isolate) {} | 2675 : TurboFanCodeStub(isolate) {} |
2678 | 2676 |
2679 void InitializeDescriptor(CodeStubDescriptor* descriptor) override; | 2677 void InitializeDescriptor(CodeStubDescriptor* descriptor) override; |
2680 void GenerateAssembly(compiler::CodeStubAssembler* assembler) const override; | 2678 void GenerateAssembly(CodeStubAssembler* assembler) const override; |
2681 | 2679 |
2682 DEFINE_CALL_INTERFACE_DESCRIPTOR(AllocateHeapNumber); | 2680 DEFINE_CALL_INTERFACE_DESCRIPTOR(AllocateHeapNumber); |
2683 DEFINE_CODE_STUB(AllocateHeapNumber, TurboFanCodeStub); | 2681 DEFINE_CODE_STUB(AllocateHeapNumber, TurboFanCodeStub); |
2684 }; | 2682 }; |
2685 | 2683 |
2686 class AllocateMutableHeapNumberStub : public TurboFanCodeStub { | 2684 class AllocateMutableHeapNumberStub : public TurboFanCodeStub { |
2687 public: | 2685 public: |
2688 explicit AllocateMutableHeapNumberStub(Isolate* isolate) | 2686 explicit AllocateMutableHeapNumberStub(Isolate* isolate) |
2689 : TurboFanCodeStub(isolate) {} | 2687 : TurboFanCodeStub(isolate) {} |
2690 | 2688 |
2691 void InitializeDescriptor(CodeStubDescriptor* descriptor) override; | 2689 void InitializeDescriptor(CodeStubDescriptor* descriptor) override; |
2692 void GenerateAssembly(compiler::CodeStubAssembler* assembler) const override; | 2690 void GenerateAssembly(CodeStubAssembler* assembler) const override; |
2693 | 2691 |
2694 DEFINE_CALL_INTERFACE_DESCRIPTOR(AllocateMutableHeapNumber); | 2692 DEFINE_CALL_INTERFACE_DESCRIPTOR(AllocateMutableHeapNumber); |
2695 DEFINE_CODE_STUB(AllocateMutableHeapNumber, TurboFanCodeStub); | 2693 DEFINE_CODE_STUB(AllocateMutableHeapNumber, TurboFanCodeStub); |
2696 }; | 2694 }; |
2697 | 2695 |
2698 #define SIMD128_ALLOC_STUB(TYPE, Type, type, lane_count, lane_type) \ | 2696 #define SIMD128_ALLOC_STUB(TYPE, Type, type, lane_count, lane_type) \ |
2699 class Allocate##Type##Stub : public TurboFanCodeStub { \ | 2697 class Allocate##Type##Stub : public TurboFanCodeStub { \ |
2700 public: \ | 2698 public: \ |
2701 explicit Allocate##Type##Stub(Isolate* isolate) \ | 2699 explicit Allocate##Type##Stub(Isolate* isolate) \ |
2702 : TurboFanCodeStub(isolate) {} \ | 2700 : TurboFanCodeStub(isolate) {} \ |
2703 \ | 2701 \ |
2704 void InitializeDescriptor(CodeStubDescriptor* descriptor) override; \ | 2702 void InitializeDescriptor(CodeStubDescriptor* descriptor) override; \ |
2705 void GenerateAssembly( \ | 2703 void GenerateAssembly(CodeStubAssembler* assembler) const override; \ |
2706 compiler::CodeStubAssembler* assembler) const override; \ | |
2707 \ | 2704 \ |
2708 DEFINE_CALL_INTERFACE_DESCRIPTOR(Allocate##Type); \ | 2705 DEFINE_CALL_INTERFACE_DESCRIPTOR(Allocate##Type); \ |
2709 DEFINE_CODE_STUB(Allocate##Type, TurboFanCodeStub); \ | 2706 DEFINE_CODE_STUB(Allocate##Type, TurboFanCodeStub); \ |
2710 }; | 2707 }; |
2711 SIMD128_TYPES(SIMD128_ALLOC_STUB) | 2708 SIMD128_TYPES(SIMD128_ALLOC_STUB) |
2712 #undef SIMD128_ALLOC_STUB | 2709 #undef SIMD128_ALLOC_STUB |
2713 | 2710 |
2714 class AllocateStub final : public HydrogenCodeStub { | 2711 class AllocateStub final : public HydrogenCodeStub { |
2715 public: | 2712 public: |
2716 AllocateStub(Isolate* isolate, PretenureFlag pretenure_flag) | 2713 AllocateStub(Isolate* isolate, PretenureFlag pretenure_flag) |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3163 #undef DEFINE_HYDROGEN_CODE_STUB | 3160 #undef DEFINE_HYDROGEN_CODE_STUB |
3164 #undef DEFINE_CODE_STUB | 3161 #undef DEFINE_CODE_STUB |
3165 #undef DEFINE_CODE_STUB_BASE | 3162 #undef DEFINE_CODE_STUB_BASE |
3166 | 3163 |
3167 extern Representation RepresentationFromType(Type* type); | 3164 extern Representation RepresentationFromType(Type* type); |
3168 | 3165 |
3169 } // namespace internal | 3166 } // namespace internal |
3170 } // namespace v8 | 3167 } // namespace v8 |
3171 | 3168 |
3172 #endif // V8_CODE_STUBS_H_ | 3169 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |