| 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/codegen.h" | 10 #include "src/codegen.h" |
| 11 #include "src/globals.h" | 11 #include "src/globals.h" |
| 12 #include "src/ic/ic-state.h" | 12 #include "src/ic/ic-state.h" |
| 13 #include "src/interface-descriptors.h" | 13 #include "src/interface-descriptors.h" |
| 14 #include "src/macro-assembler.h" | 14 #include "src/macro-assembler.h" |
| 15 #include "src/ostreams.h" | 15 #include "src/ostreams.h" |
| 16 #include "src/type-hints.h" | 16 #include "src/type-hints.h" |
| 17 | 17 |
| 18 namespace v8 { | 18 namespace v8 { |
| 19 namespace internal { | 19 namespace internal { |
| 20 | 20 |
| 21 // Forward declarations. | 21 // Forward declarations. |
| 22 class ArrayLiteral; |
| 22 class CodeStubAssembler; | 23 class CodeStubAssembler; |
| 23 class ObjectLiteral; | 24 class ObjectLiteral; |
| 24 namespace compiler { | 25 namespace compiler { |
| 25 class CodeAssemblerLabel; | 26 class CodeAssemblerLabel; |
| 26 class CodeAssemblerState; | 27 class CodeAssemblerState; |
| 27 class Node; | 28 class Node; |
| 28 } | 29 } |
| 29 | 30 |
| 30 // List of code stubs used on all platforms. | 31 // List of code stubs used on all platforms. |
| 31 #define CODE_STUB_LIST_ALL_PLATFORMS(V) \ | 32 #define CODE_STUB_LIST_ALL_PLATFORMS(V) \ |
| (...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 916 compiler::Node* flags, | 917 compiler::Node* flags, |
| 917 compiler::Node* context); | 918 compiler::Node* context); |
| 918 | 919 |
| 919 private: | 920 private: |
| 920 DEFINE_CALL_INTERFACE_DESCRIPTOR(FastCloneRegExp); | 921 DEFINE_CALL_INTERFACE_DESCRIPTOR(FastCloneRegExp); |
| 921 DEFINE_TURBOFAN_CODE_STUB(FastCloneRegExp, TurboFanCodeStub); | 922 DEFINE_TURBOFAN_CODE_STUB(FastCloneRegExp, TurboFanCodeStub); |
| 922 }; | 923 }; |
| 923 | 924 |
| 924 class FastCloneShallowArrayStub : public TurboFanCodeStub { | 925 class FastCloneShallowArrayStub : public TurboFanCodeStub { |
| 925 public: | 926 public: |
| 927 // Maximum number of elements in copied array (chosen so that even an array |
| 928 // backed by a double backing store will fit into new-space). |
| 929 static const int kMaximumClonedElements = |
| 930 JSArray::kInitialMaxFastElementArray * kPointerSize / kDoubleSize; |
| 931 |
| 926 FastCloneShallowArrayStub(Isolate* isolate, | 932 FastCloneShallowArrayStub(Isolate* isolate, |
| 927 AllocationSiteMode allocation_site_mode) | 933 AllocationSiteMode allocation_site_mode) |
| 928 : TurboFanCodeStub(isolate) { | 934 : TurboFanCodeStub(isolate) { |
| 929 minor_key_ = AllocationSiteModeBits::encode(allocation_site_mode); | 935 minor_key_ = AllocationSiteModeBits::encode(allocation_site_mode); |
| 930 } | 936 } |
| 931 | 937 |
| 932 static compiler::Node* Generate(CodeStubAssembler* assembler, | 938 static compiler::Node* Generate(CodeStubAssembler* assembler, |
| 933 compiler::Node* closure, | 939 compiler::Node* closure, |
| 934 compiler::Node* literal_index, | 940 compiler::Node* literal_index, |
| 935 compiler::Node* context, | 941 compiler::Node* context, |
| 936 compiler::CodeAssemblerLabel* call_runtime, | 942 compiler::CodeAssemblerLabel* call_runtime, |
| 937 AllocationSiteMode allocation_site_mode); | 943 AllocationSiteMode allocation_site_mode); |
| 938 | 944 |
| 945 static bool IsSupported(ArrayLiteral* expr); |
| 946 |
| 939 AllocationSiteMode allocation_site_mode() const { | 947 AllocationSiteMode allocation_site_mode() const { |
| 940 return AllocationSiteModeBits::decode(minor_key_); | 948 return AllocationSiteModeBits::decode(minor_key_); |
| 941 } | 949 } |
| 942 | 950 |
| 943 private: | 951 private: |
| 944 class AllocationSiteModeBits: public BitField<AllocationSiteMode, 0, 1> {}; | 952 class AllocationSiteModeBits: public BitField<AllocationSiteMode, 0, 1> {}; |
| 945 | 953 |
| 946 DEFINE_CALL_INTERFACE_DESCRIPTOR(FastCloneShallowArray); | 954 DEFINE_CALL_INTERFACE_DESCRIPTOR(FastCloneShallowArray); |
| 947 DEFINE_TURBOFAN_CODE_STUB(FastCloneShallowArray, TurboFanCodeStub); | 955 DEFINE_TURBOFAN_CODE_STUB(FastCloneShallowArray, TurboFanCodeStub); |
| 948 }; | 956 }; |
| (...skipping 1694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2643 #undef DEFINE_PLATFORM_CODE_STUB | 2651 #undef DEFINE_PLATFORM_CODE_STUB |
| 2644 #undef DEFINE_HANDLER_CODE_STUB | 2652 #undef DEFINE_HANDLER_CODE_STUB |
| 2645 #undef DEFINE_HYDROGEN_CODE_STUB | 2653 #undef DEFINE_HYDROGEN_CODE_STUB |
| 2646 #undef DEFINE_CODE_STUB | 2654 #undef DEFINE_CODE_STUB |
| 2647 #undef DEFINE_CODE_STUB_BASE | 2655 #undef DEFINE_CODE_STUB_BASE |
| 2648 | 2656 |
| 2649 } // namespace internal | 2657 } // namespace internal |
| 2650 } // namespace v8 | 2658 } // namespace v8 |
| 2651 | 2659 |
| 2652 #endif // V8_CODE_STUBS_H_ | 2660 #endif // V8_CODE_STUBS_H_ |
| OLD | NEW |