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_RUNTIME_H_ | 5 #ifndef V8_RUNTIME_RUNTIME_H_ |
6 #define V8_RUNTIME_H_ | 6 #define V8_RUNTIME_RUNTIME_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/objects.h" | 9 #include "src/objects.h" |
10 #include "src/zone.h" | 10 #include "src/zone.h" |
11 | 11 |
12 namespace v8 { | 12 namespace v8 { |
13 namespace internal { | 13 namespace internal { |
14 | 14 |
15 // The interface to C++ runtime functions. | 15 // The interface to C++ runtime functions. |
16 | 16 |
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
770 ConsStringIteratorOp string_locale_compare_it1_; | 770 ConsStringIteratorOp string_locale_compare_it1_; |
771 ConsStringIteratorOp string_locale_compare_it2_; | 771 ConsStringIteratorOp string_locale_compare_it2_; |
772 | 772 |
773 friend class Isolate; | 773 friend class Isolate; |
774 friend class Runtime; | 774 friend class Runtime; |
775 | 775 |
776 DISALLOW_COPY_AND_ASSIGN(RuntimeState); | 776 DISALLOW_COPY_AND_ASSIGN(RuntimeState); |
777 }; | 777 }; |
778 | 778 |
779 | 779 |
| 780 class JavaScriptFrameIterator; // Forward declaration. |
| 781 |
| 782 |
780 class Runtime : public AllStatic { | 783 class Runtime : public AllStatic { |
781 public: | 784 public: |
782 enum FunctionId { | 785 enum FunctionId { |
783 #define F(name, nargs, ressize) k##name, | 786 #define F(name, nargs, ressize) k##name, |
784 RUNTIME_FUNCTION_LIST(F) INLINE_OPTIMIZED_FUNCTION_LIST(F) | 787 RUNTIME_FUNCTION_LIST(F) INLINE_OPTIMIZED_FUNCTION_LIST(F) |
785 #undef F | 788 #undef F |
786 #define F(name, nargs, ressize) kInline##name, | 789 #define F(name, nargs, ressize) kInline##name, |
787 INLINE_FUNCTION_LIST(F) | 790 INLINE_FUNCTION_LIST(F) |
788 #undef F | 791 #undef F |
789 #define F(name, nargs, ressize) kInlineOptimized##name, | 792 #define F(name, nargs, ressize) kInlineOptimized##name, |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
821 | 824 |
822 // Get the intrinsic function with the given name, which must be internalized. | 825 // Get the intrinsic function with the given name, which must be internalized. |
823 static const Function* FunctionForName(Handle<String> name); | 826 static const Function* FunctionForName(Handle<String> name); |
824 | 827 |
825 // Get the intrinsic function with the given FunctionId. | 828 // Get the intrinsic function with the given FunctionId. |
826 static const Function* FunctionForId(FunctionId id); | 829 static const Function* FunctionForId(FunctionId id); |
827 | 830 |
828 // Get the intrinsic function with the given function entry address. | 831 // Get the intrinsic function with the given function entry address. |
829 static const Function* FunctionForEntry(Address ref); | 832 static const Function* FunctionForEntry(Address ref); |
830 | 833 |
831 // General-purpose helper functions for runtime system. | |
832 static int StringMatch(Isolate* isolate, Handle<String> sub, | |
833 Handle<String> pat, int index); | |
834 | |
835 // TODO(1240886): Some of the following methods are *not* handle safe, but | 834 // TODO(1240886): Some of the following methods are *not* handle safe, but |
836 // accept handle arguments. This seems fragile. | 835 // accept handle arguments. This seems fragile. |
837 | 836 |
838 // Support getting the characters in a string using [] notation as | 837 // Support getting the characters in a string using [] notation as |
839 // in Firefox/SpiderMonkey, Safari and Opera. | 838 // in Firefox/SpiderMonkey, Safari and Opera. |
840 MUST_USE_RESULT static MaybeHandle<Object> GetElementOrCharAt( | 839 MUST_USE_RESULT static MaybeHandle<Object> GetElementOrCharAt( |
841 Isolate* isolate, Handle<Object> object, uint32_t index); | 840 Isolate* isolate, Handle<Object> object, uint32_t index); |
842 | 841 |
843 MUST_USE_RESULT static MaybeHandle<Object> SetObjectProperty( | 842 MUST_USE_RESULT static MaybeHandle<Object> SetObjectProperty( |
844 Isolate* isolate, Handle<Object> object, Handle<Object> key, | 843 Isolate* isolate, Handle<Object> object, Handle<Object> key, |
845 Handle<Object> value, StrictMode strict_mode); | 844 Handle<Object> value, StrictMode strict_mode); |
846 | 845 |
847 MUST_USE_RESULT static MaybeHandle<Object> DefineObjectProperty( | 846 MUST_USE_RESULT static MaybeHandle<Object> DefineObjectProperty( |
848 Handle<JSObject> object, Handle<Object> key, Handle<Object> value, | 847 Handle<JSObject> object, Handle<Object> key, Handle<Object> value, |
849 PropertyAttributes attr); | 848 PropertyAttributes attr); |
850 | 849 |
851 MUST_USE_RESULT static MaybeHandle<Object> DeleteObjectProperty( | |
852 Isolate* isolate, Handle<JSReceiver> object, Handle<Object> key, | |
853 JSReceiver::DeleteMode mode); | |
854 | |
855 MUST_USE_RESULT static MaybeHandle<Object> HasObjectProperty( | |
856 Isolate* isolate, Handle<JSReceiver> object, Handle<Object> key); | |
857 | |
858 MUST_USE_RESULT static MaybeHandle<Object> GetObjectProperty( | 850 MUST_USE_RESULT static MaybeHandle<Object> GetObjectProperty( |
859 Isolate* isolate, Handle<Object> object, Handle<Object> key); | 851 Isolate* isolate, Handle<Object> object, Handle<Object> key); |
860 | 852 |
861 MUST_USE_RESULT static MaybeHandle<Name> ToName(Isolate* isolate, | 853 MUST_USE_RESULT static MaybeHandle<Name> ToName(Isolate* isolate, |
862 Handle<Object> key); | 854 Handle<Object> key); |
863 | 855 |
864 static void SetupArrayBuffer(Isolate* isolate, | 856 static void SetupArrayBuffer(Isolate* isolate, |
865 Handle<JSArrayBuffer> array_buffer, | 857 Handle<JSArrayBuffer> array_buffer, |
866 bool is_external, void* data, | 858 bool is_external, void* data, |
867 size_t allocated_length); | 859 size_t allocated_length); |
868 | 860 |
869 static bool SetupArrayBufferAllocatingData(Isolate* isolate, | 861 static bool SetupArrayBufferAllocatingData(Isolate* isolate, |
870 Handle<JSArrayBuffer> array_buffer, | 862 Handle<JSArrayBuffer> array_buffer, |
871 size_t allocated_length, | 863 size_t allocated_length, |
872 bool initialize = true); | 864 bool initialize = true); |
873 | 865 |
874 static void NeuterArrayBuffer(Handle<JSArrayBuffer> array_buffer); | 866 static void NeuterArrayBuffer(Handle<JSArrayBuffer> array_buffer); |
875 | 867 |
876 static void FreeArrayBuffer(Isolate* isolate, | 868 static void FreeArrayBuffer(Isolate* isolate, |
877 JSArrayBuffer* phantom_array_buffer); | 869 JSArrayBuffer* phantom_array_buffer); |
878 | 870 |
| 871 static int FindIndexedNonNativeFrame(JavaScriptFrameIterator* it, int index); |
| 872 |
879 enum TypedArrayId { | 873 enum TypedArrayId { |
880 // arrayIds below should be synchromized with typedarray.js natives. | 874 // arrayIds below should be synchromized with typedarray.js natives. |
881 ARRAY_ID_UINT8 = 1, | 875 ARRAY_ID_UINT8 = 1, |
882 ARRAY_ID_INT8 = 2, | 876 ARRAY_ID_INT8 = 2, |
883 ARRAY_ID_UINT16 = 3, | 877 ARRAY_ID_UINT16 = 3, |
884 ARRAY_ID_INT16 = 4, | 878 ARRAY_ID_INT16 = 4, |
885 ARRAY_ID_UINT32 = 5, | 879 ARRAY_ID_UINT32 = 5, |
886 ARRAY_ID_INT32 = 6, | 880 ARRAY_ID_INT32 = 6, |
887 ARRAY_ID_FLOAT32 = 7, | 881 ARRAY_ID_FLOAT32 = 7, |
888 ARRAY_ID_FLOAT64 = 8, | 882 ARRAY_ID_FLOAT64 = 8, |
(...skipping 22 matching lines...) Expand all Loading... |
911 class AllocateDoubleAlignFlag : public BitField<bool, 0, 1> {}; | 905 class AllocateDoubleAlignFlag : public BitField<bool, 0, 1> {}; |
912 class AllocateTargetSpace : public BitField<AllocationSpace, 1, 3> {}; | 906 class AllocateTargetSpace : public BitField<AllocationSpace, 1, 3> {}; |
913 | 907 |
914 class DeclareGlobalsEvalFlag : public BitField<bool, 0, 1> {}; | 908 class DeclareGlobalsEvalFlag : public BitField<bool, 0, 1> {}; |
915 class DeclareGlobalsNativeFlag : public BitField<bool, 1, 1> {}; | 909 class DeclareGlobalsNativeFlag : public BitField<bool, 1, 1> {}; |
916 class DeclareGlobalsStrictMode : public BitField<StrictMode, 2, 1> {}; | 910 class DeclareGlobalsStrictMode : public BitField<StrictMode, 2, 1> {}; |
917 | 911 |
918 } // namespace internal | 912 } // namespace internal |
919 } // namespace v8 | 913 } // namespace v8 |
920 | 914 |
921 #endif // V8_RUNTIME_H_ | 915 #endif // V8_RUNTIME_RUNTIME_H_ |
OLD | NEW |