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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 void Generate(MacroAssembler* masm) override; \ | 384 void Generate(MacroAssembler* masm) override; \ |
385 DEFINE_CODE_STUB(NAME, SUPER) | 385 DEFINE_CODE_STUB(NAME, SUPER) |
386 | 386 |
387 | 387 |
388 #define DEFINE_HYDROGEN_CODE_STUB(NAME, SUPER) \ | 388 #define DEFINE_HYDROGEN_CODE_STUB(NAME, SUPER) \ |
389 public: \ | 389 public: \ |
390 void InitializeDescriptor(CodeStubDescriptor* descriptor) override; \ | 390 void InitializeDescriptor(CodeStubDescriptor* descriptor) override; \ |
391 Handle<Code> GenerateCode() override; \ | 391 Handle<Code> GenerateCode() override; \ |
392 DEFINE_CODE_STUB(NAME, SUPER) | 392 DEFINE_CODE_STUB(NAME, SUPER) |
393 | 393 |
394 #define DEFINE_TURBOFAN_CODE_STUB(NAME, SUPER) \ | 394 #define DEFINE_TURBOFAN_CODE_STUB(NAME, SUPER) \ |
395 public: \ | 395 public: \ |
396 void GenerateAssembly(compiler::CodeStubAssembler* assembler) \ | 396 void GenerateAssembly(CodeStubAssembler* assembler) const override; \ |
397 const override; \ | |
398 DEFINE_CODE_STUB(NAME, SUPER) | 397 DEFINE_CODE_STUB(NAME, SUPER) |
399 | 398 |
400 #define DEFINE_HANDLER_CODE_STUB(NAME, SUPER) \ | 399 #define DEFINE_HANDLER_CODE_STUB(NAME, SUPER) \ |
401 public: \ | 400 public: \ |
402 Handle<Code> GenerateCode() override; \ | 401 Handle<Code> GenerateCode() override; \ |
403 DEFINE_CODE_STUB(NAME, SUPER) | 402 DEFINE_CODE_STUB(NAME, SUPER) |
404 | 403 |
405 #define DEFINE_CALL_INTERFACE_DESCRIPTOR(NAME) \ | 404 #define DEFINE_CALL_INTERFACE_DESCRIPTOR(NAME) \ |
406 public: \ | 405 public: \ |
407 CallInterfaceDescriptor GetCallInterfaceDescriptor() const override { \ | 406 CallInterfaceDescriptor GetCallInterfaceDescriptor() const override { \ |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 // Retrieve the code for the stub. Generate the code if needed. | 575 // Retrieve the code for the stub. Generate the code if needed. |
577 Handle<Code> GenerateCode() override; | 576 Handle<Code> GenerateCode() override; |
578 | 577 |
579 int GetStackParameterCount() const override { | 578 int GetStackParameterCount() const override { |
580 return GetCallInterfaceDescriptor().GetStackParameterCount(); | 579 return GetCallInterfaceDescriptor().GetStackParameterCount(); |
581 } | 580 } |
582 | 581 |
583 protected: | 582 protected: |
584 explicit TurboFanCodeStub(Isolate* isolate) : CodeStub(isolate) {} | 583 explicit TurboFanCodeStub(Isolate* isolate) : CodeStub(isolate) {} |
585 | 584 |
586 virtual void GenerateAssembly( | 585 virtual void GenerateAssembly(CodeStubAssembler* assembler) const = 0; |
587 compiler::CodeStubAssembler* assembler) const = 0; | |
588 | 586 |
589 private: | 587 private: |
590 DEFINE_CODE_STUB_BASE(TurboFanCodeStub, CodeStub); | 588 DEFINE_CODE_STUB_BASE(TurboFanCodeStub, CodeStub); |
591 }; | 589 }; |
592 | 590 |
593 | 591 |
594 // Helper interface to prepare to/restore after making runtime calls. | 592 // Helper interface to prepare to/restore after making runtime calls. |
595 class RuntimeCallHelper { | 593 class RuntimeCallHelper { |
596 public: | 594 public: |
597 virtual ~RuntimeCallHelper() {} | 595 virtual ~RuntimeCallHelper() {} |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 explicit ToLengthStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} | 863 explicit ToLengthStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} |
866 | 864 |
867 DEFINE_CALL_INTERFACE_DESCRIPTOR(TypeConversion); | 865 DEFINE_CALL_INTERFACE_DESCRIPTOR(TypeConversion); |
868 DEFINE_TURBOFAN_CODE_STUB(ToLength, TurboFanCodeStub); | 866 DEFINE_TURBOFAN_CODE_STUB(ToLength, TurboFanCodeStub); |
869 }; | 867 }; |
870 | 868 |
871 class StoreInterceptorStub : public TurboFanCodeStub { | 869 class StoreInterceptorStub : public TurboFanCodeStub { |
872 public: | 870 public: |
873 explicit StoreInterceptorStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} | 871 explicit StoreInterceptorStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} |
874 | 872 |
875 void GenerateAssembly(compiler::CodeStubAssembler* assember) const override; | 873 void GenerateAssembly(CodeStubAssembler* assember) const override; |
876 | 874 |
877 Code::Kind GetCodeKind() const override { return Code::HANDLER; } | 875 Code::Kind GetCodeKind() const override { return Code::HANDLER; } |
878 | 876 |
879 DEFINE_CALL_INTERFACE_DESCRIPTOR(Store); | 877 DEFINE_CALL_INTERFACE_DESCRIPTOR(Store); |
880 DEFINE_CODE_STUB(StoreInterceptor, TurboFanCodeStub); | 878 DEFINE_CODE_STUB(StoreInterceptor, TurboFanCodeStub); |
881 }; | 879 }; |
882 | 880 |
883 class LoadIndexedInterceptorStub : public TurboFanCodeStub { | 881 class LoadIndexedInterceptorStub : public TurboFanCodeStub { |
884 public: | 882 public: |
885 explicit LoadIndexedInterceptorStub(Isolate* isolate) | 883 explicit LoadIndexedInterceptorStub(Isolate* isolate) |
(...skipping 1743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2629 DEFINE_CALL_INTERFACE_DESCRIPTOR(TransitionElementsKind); | 2627 DEFINE_CALL_INTERFACE_DESCRIPTOR(TransitionElementsKind); |
2630 DEFINE_HYDROGEN_CODE_STUB(TransitionElementsKind, HydrogenCodeStub); | 2628 DEFINE_HYDROGEN_CODE_STUB(TransitionElementsKind, HydrogenCodeStub); |
2631 }; | 2629 }; |
2632 | 2630 |
2633 class AllocateHeapNumberStub : public TurboFanCodeStub { | 2631 class AllocateHeapNumberStub : public TurboFanCodeStub { |
2634 public: | 2632 public: |
2635 explicit AllocateHeapNumberStub(Isolate* isolate) | 2633 explicit AllocateHeapNumberStub(Isolate* isolate) |
2636 : TurboFanCodeStub(isolate) {} | 2634 : TurboFanCodeStub(isolate) {} |
2637 | 2635 |
2638 void InitializeDescriptor(CodeStubDescriptor* descriptor) override; | 2636 void InitializeDescriptor(CodeStubDescriptor* descriptor) override; |
2639 void GenerateAssembly(compiler::CodeStubAssembler* assembler) const override; | 2637 void GenerateAssembly(CodeStubAssembler* assembler) const override; |
2640 | 2638 |
2641 DEFINE_CALL_INTERFACE_DESCRIPTOR(AllocateHeapNumber); | 2639 DEFINE_CALL_INTERFACE_DESCRIPTOR(AllocateHeapNumber); |
2642 DEFINE_CODE_STUB(AllocateHeapNumber, TurboFanCodeStub); | 2640 DEFINE_CODE_STUB(AllocateHeapNumber, TurboFanCodeStub); |
2643 }; | 2641 }; |
2644 | 2642 |
2645 class AllocateMutableHeapNumberStub : public TurboFanCodeStub { | 2643 class AllocateMutableHeapNumberStub : public TurboFanCodeStub { |
2646 public: | 2644 public: |
2647 explicit AllocateMutableHeapNumberStub(Isolate* isolate) | 2645 explicit AllocateMutableHeapNumberStub(Isolate* isolate) |
2648 : TurboFanCodeStub(isolate) {} | 2646 : TurboFanCodeStub(isolate) {} |
2649 | 2647 |
2650 void InitializeDescriptor(CodeStubDescriptor* descriptor) override; | 2648 void InitializeDescriptor(CodeStubDescriptor* descriptor) override; |
2651 void GenerateAssembly(compiler::CodeStubAssembler* assembler) const override; | 2649 void GenerateAssembly(CodeStubAssembler* assembler) const override; |
2652 | 2650 |
2653 DEFINE_CALL_INTERFACE_DESCRIPTOR(AllocateMutableHeapNumber); | 2651 DEFINE_CALL_INTERFACE_DESCRIPTOR(AllocateMutableHeapNumber); |
2654 DEFINE_CODE_STUB(AllocateMutableHeapNumber, TurboFanCodeStub); | 2652 DEFINE_CODE_STUB(AllocateMutableHeapNumber, TurboFanCodeStub); |
2655 }; | 2653 }; |
2656 | 2654 |
2657 #define SIMD128_ALLOC_STUB(TYPE, Type, type, lane_count, lane_type) \ | 2655 #define SIMD128_ALLOC_STUB(TYPE, Type, type, lane_count, lane_type) \ |
2658 class Allocate##Type##Stub : public TurboFanCodeStub { \ | 2656 class Allocate##Type##Stub : public TurboFanCodeStub { \ |
2659 public: \ | 2657 public: \ |
2660 explicit Allocate##Type##Stub(Isolate* isolate) \ | 2658 explicit Allocate##Type##Stub(Isolate* isolate) \ |
2661 : TurboFanCodeStub(isolate) {} \ | 2659 : TurboFanCodeStub(isolate) {} \ |
2662 \ | 2660 \ |
2663 void InitializeDescriptor(CodeStubDescriptor* descriptor) override; \ | 2661 void InitializeDescriptor(CodeStubDescriptor* descriptor) override; \ |
2664 void GenerateAssembly( \ | 2662 void GenerateAssembly(CodeStubAssembler* assembler) const override; \ |
2665 compiler::CodeStubAssembler* assembler) const override; \ | |
2666 \ | 2663 \ |
2667 DEFINE_CALL_INTERFACE_DESCRIPTOR(Allocate##Type); \ | 2664 DEFINE_CALL_INTERFACE_DESCRIPTOR(Allocate##Type); \ |
2668 DEFINE_CODE_STUB(Allocate##Type, TurboFanCodeStub); \ | 2665 DEFINE_CODE_STUB(Allocate##Type, TurboFanCodeStub); \ |
2669 }; | 2666 }; |
2670 SIMD128_TYPES(SIMD128_ALLOC_STUB) | 2667 SIMD128_TYPES(SIMD128_ALLOC_STUB) |
2671 #undef SIMD128_ALLOC_STUB | 2668 #undef SIMD128_ALLOC_STUB |
2672 | 2669 |
2673 class AllocateInNewSpaceStub final : public HydrogenCodeStub { | 2670 class AllocateInNewSpaceStub final : public HydrogenCodeStub { |
2674 public: | 2671 public: |
2675 explicit AllocateInNewSpaceStub(Isolate* isolate) | 2672 explicit AllocateInNewSpaceStub(Isolate* isolate) |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3108 #undef DEFINE_HYDROGEN_CODE_STUB | 3105 #undef DEFINE_HYDROGEN_CODE_STUB |
3109 #undef DEFINE_CODE_STUB | 3106 #undef DEFINE_CODE_STUB |
3110 #undef DEFINE_CODE_STUB_BASE | 3107 #undef DEFINE_CODE_STUB_BASE |
3111 | 3108 |
3112 extern Representation RepresentationFromType(Type* type); | 3109 extern Representation RepresentationFromType(Type* type); |
3113 | 3110 |
3114 } // namespace internal | 3111 } // namespace internal |
3115 } // namespace v8 | 3112 } // namespace v8 |
3116 | 3113 |
3117 #endif // V8_CODE_STUBS_H_ | 3114 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |