| 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 CodeStubAssembler; | 22 class CodeStubAssembler; |
| 23 class ObjectLiteral; | |
| 24 namespace compiler { | 23 namespace compiler { |
| 25 class CodeAssemblerLabel; | 24 class CodeAssemblerLabel; |
| 26 class CodeAssemblerState; | 25 class CodeAssemblerState; |
| 27 class Node; | 26 class Node; |
| 28 } | 27 } |
| 29 | 28 |
| 30 // List of code stubs used on all platforms. | 29 // List of code stubs used on all platforms. |
| 31 #define CODE_STUB_LIST_ALL_PLATFORMS(V) \ | 30 #define CODE_STUB_LIST_ALL_PLATFORMS(V) \ |
| 32 /* --- PlatformCodeStubs --- */ \ | 31 /* --- PlatformCodeStubs --- */ \ |
| 33 V(ArrayConstructor) \ | 32 V(ArrayConstructor) \ |
| (...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 916 compiler::Node* flags, | 915 compiler::Node* flags, |
| 917 compiler::Node* context); | 916 compiler::Node* context); |
| 918 | 917 |
| 919 private: | 918 private: |
| 920 DEFINE_CALL_INTERFACE_DESCRIPTOR(FastCloneRegExp); | 919 DEFINE_CALL_INTERFACE_DESCRIPTOR(FastCloneRegExp); |
| 921 DEFINE_TURBOFAN_CODE_STUB(FastCloneRegExp, TurboFanCodeStub); | 920 DEFINE_TURBOFAN_CODE_STUB(FastCloneRegExp, TurboFanCodeStub); |
| 922 }; | 921 }; |
| 923 | 922 |
| 924 class FastCloneShallowArrayStub : public TurboFanCodeStub { | 923 class FastCloneShallowArrayStub : public TurboFanCodeStub { |
| 925 public: | 924 public: |
| 925 // Maximum number of elements in copied array (chosen so that even an array |
| 926 // backed by a double backing store will fit into new-space). |
| 927 static const int kMaximumClonedElements = |
| 928 JSArray::kInitialMaxFastElementArray * kPointerSize / kDoubleSize; |
| 929 |
| 926 FastCloneShallowArrayStub(Isolate* isolate, | 930 FastCloneShallowArrayStub(Isolate* isolate, |
| 927 AllocationSiteMode allocation_site_mode) | 931 AllocationSiteMode allocation_site_mode) |
| 928 : TurboFanCodeStub(isolate) { | 932 : TurboFanCodeStub(isolate) { |
| 929 minor_key_ = AllocationSiteModeBits::encode(allocation_site_mode); | 933 minor_key_ = AllocationSiteModeBits::encode(allocation_site_mode); |
| 930 } | 934 } |
| 931 | 935 |
| 932 static compiler::Node* Generate(CodeStubAssembler* assembler, | 936 static compiler::Node* Generate(CodeStubAssembler* assembler, |
| 933 compiler::Node* closure, | 937 compiler::Node* closure, |
| 934 compiler::Node* literal_index, | 938 compiler::Node* literal_index, |
| 935 compiler::Node* context, | 939 compiler::Node* context, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 957 DCHECK_GE(length, 0); | 961 DCHECK_GE(length, 0); |
| 958 DCHECK_LE(length, kMaximumClonedProperties); | 962 DCHECK_LE(length, kMaximumClonedProperties); |
| 959 minor_key_ = LengthBits::encode(LengthBits::encode(length)); | 963 minor_key_ = LengthBits::encode(LengthBits::encode(length)); |
| 960 } | 964 } |
| 961 | 965 |
| 962 static compiler::Node* GenerateFastPath( | 966 static compiler::Node* GenerateFastPath( |
| 963 CodeStubAssembler* assembler, compiler::CodeAssemblerLabel* call_runtime, | 967 CodeStubAssembler* assembler, compiler::CodeAssemblerLabel* call_runtime, |
| 964 compiler::Node* closure, compiler::Node* literals_index, | 968 compiler::Node* closure, compiler::Node* literals_index, |
| 965 compiler::Node* properties_count); | 969 compiler::Node* properties_count); |
| 966 | 970 |
| 967 static bool IsSupported(ObjectLiteral* expr); | |
| 968 static int PropertiesCount(int literal_length); | 971 static int PropertiesCount(int literal_length); |
| 969 | 972 |
| 970 int length() const { return LengthBits::decode(minor_key_); } | 973 int length() const { return LengthBits::decode(minor_key_); } |
| 971 | 974 |
| 972 private: | 975 private: |
| 973 class LengthBits : public BitField<int, 0, 4> {}; | 976 class LengthBits : public BitField<int, 0, 4> {}; |
| 974 | 977 |
| 975 DEFINE_CALL_INTERFACE_DESCRIPTOR(FastCloneShallowObject); | 978 DEFINE_CALL_INTERFACE_DESCRIPTOR(FastCloneShallowObject); |
| 976 DEFINE_TURBOFAN_CODE_STUB(FastCloneShallowObject, TurboFanCodeStub); | 979 DEFINE_TURBOFAN_CODE_STUB(FastCloneShallowObject, TurboFanCodeStub); |
| 977 }; | 980 }; |
| (...skipping 1665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2643 #undef DEFINE_PLATFORM_CODE_STUB | 2646 #undef DEFINE_PLATFORM_CODE_STUB |
| 2644 #undef DEFINE_HANDLER_CODE_STUB | 2647 #undef DEFINE_HANDLER_CODE_STUB |
| 2645 #undef DEFINE_HYDROGEN_CODE_STUB | 2648 #undef DEFINE_HYDROGEN_CODE_STUB |
| 2646 #undef DEFINE_CODE_STUB | 2649 #undef DEFINE_CODE_STUB |
| 2647 #undef DEFINE_CODE_STUB_BASE | 2650 #undef DEFINE_CODE_STUB_BASE |
| 2648 | 2651 |
| 2649 } // namespace internal | 2652 } // namespace internal |
| 2650 } // namespace v8 | 2653 } // namespace v8 |
| 2651 | 2654 |
| 2652 #endif // V8_CODE_STUBS_H_ | 2655 #endif // V8_CODE_STUBS_H_ |
| OLD | NEW |