OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
935 | 935 |
936 | 936 |
937 /** | 937 /** |
938 * The origin, within a file, of a script. | 938 * The origin, within a file, of a script. |
939 */ | 939 */ |
940 class ScriptOrigin { | 940 class ScriptOrigin { |
941 public: | 941 public: |
942 V8_INLINE(ScriptOrigin( | 942 V8_INLINE(ScriptOrigin( |
943 Handle<Value> resource_name, | 943 Handle<Value> resource_name, |
944 Handle<Integer> resource_line_offset = Handle<Integer>(), | 944 Handle<Integer> resource_line_offset = Handle<Integer>(), |
945 Handle<Integer> resource_column_offset = Handle<Integer>())) | 945 Handle<Integer> resource_column_offset = Handle<Integer>(), |
| 946 Handle<Boolean> resource_is_shared_cross_origin = Handle<Boolean>())) |
946 : resource_name_(resource_name), | 947 : resource_name_(resource_name), |
947 resource_line_offset_(resource_line_offset), | 948 resource_line_offset_(resource_line_offset), |
948 resource_column_offset_(resource_column_offset) { } | 949 resource_column_offset_(resource_column_offset), |
| 950 resource_is_shared_cross_origin_(resource_is_shared_cross_origin) { } |
949 V8_INLINE(Handle<Value> ResourceName() const); | 951 V8_INLINE(Handle<Value> ResourceName() const); |
950 V8_INLINE(Handle<Integer> ResourceLineOffset() const); | 952 V8_INLINE(Handle<Integer> ResourceLineOffset() const); |
951 V8_INLINE(Handle<Integer> ResourceColumnOffset() const); | 953 V8_INLINE(Handle<Integer> ResourceColumnOffset() const); |
| 954 V8_INLINE(Handle<Boolean> ResourceIsSharedCrossOrigin() const); |
952 private: | 955 private: |
953 Handle<Value> resource_name_; | 956 Handle<Value> resource_name_; |
954 Handle<Integer> resource_line_offset_; | 957 Handle<Integer> resource_line_offset_; |
955 Handle<Integer> resource_column_offset_; | 958 Handle<Integer> resource_column_offset_; |
| 959 Handle<Boolean> resource_is_shared_cross_origin_; |
956 }; | 960 }; |
957 | 961 |
958 | 962 |
959 /** | 963 /** |
960 * A compiled JavaScript script. | 964 * A compiled JavaScript script. |
961 */ | 965 */ |
962 class V8EXPORT Script { | 966 class V8EXPORT Script { |
963 public: | 967 public: |
964 /** | 968 /** |
965 * Compiles the specified script (context-independent). | 969 * Compiles the specified script (context-independent). |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1123 * the error occurred. | 1127 * the error occurred. |
1124 */ | 1128 */ |
1125 int GetStartColumn() const; | 1129 int GetStartColumn() const; |
1126 | 1130 |
1127 /** | 1131 /** |
1128 * Returns the index within the line of the last character where | 1132 * Returns the index within the line of the last character where |
1129 * the error occurred. | 1133 * the error occurred. |
1130 */ | 1134 */ |
1131 int GetEndColumn() const; | 1135 int GetEndColumn() const; |
1132 | 1136 |
| 1137 /** |
| 1138 * Passes on the value set by the embedder when it fed the script from which |
| 1139 * this Message was generated to V8. |
| 1140 */ |
| 1141 bool IsSharedCrossOrigin() const; |
| 1142 |
1133 // TODO(1245381): Print to a string instead of on a FILE. | 1143 // TODO(1245381): Print to a string instead of on a FILE. |
1134 static void PrintCurrentStackTrace(FILE* out); | 1144 static void PrintCurrentStackTrace(FILE* out); |
1135 | 1145 |
1136 static const int kNoLineNumberInfo = 0; | 1146 static const int kNoLineNumberInfo = 0; |
1137 static const int kNoColumnInfo = 0; | 1147 static const int kNoColumnInfo = 0; |
1138 }; | 1148 }; |
1139 | 1149 |
1140 | 1150 |
1141 /** | 1151 /** |
1142 * Representation of a JavaScript stack trace. The information collected is a | 1152 * Representation of a JavaScript stack trace. The information collected is a |
(...skipping 1250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2393 * V8::SetArrayBufferAllocator prior to creation of a first ArrayBuffer. | 2403 * V8::SetArrayBufferAllocator prior to creation of a first ArrayBuffer. |
2394 * | 2404 * |
2395 * This API is experimental and may change significantly. | 2405 * This API is experimental and may change significantly. |
2396 */ | 2406 */ |
2397 class V8EXPORT Allocator { // NOLINT | 2407 class V8EXPORT Allocator { // NOLINT |
2398 public: | 2408 public: |
2399 virtual ~Allocator() {} | 2409 virtual ~Allocator() {} |
2400 | 2410 |
2401 /** | 2411 /** |
2402 * Allocate |length| bytes. Return NULL if allocation is not successful. | 2412 * Allocate |length| bytes. Return NULL if allocation is not successful. |
| 2413 * Memory should be initialized to zeroes. |
2403 */ | 2414 */ |
2404 virtual void* Allocate(size_t length) = 0; | 2415 virtual void* Allocate(size_t length) = 0; |
| 2416 |
| 2417 /** |
| 2418 * Allocate |length| bytes. Return NULL if allocation is not successful. |
| 2419 * Memory does not have to be initialized. |
| 2420 */ |
| 2421 virtual void* AllocateUninitialized(size_t length) { |
| 2422 // Override with call to |Allocate| for compatibility |
| 2423 // with legacy version. |
| 2424 return Allocate(length); |
| 2425 } |
| 2426 |
2405 /** | 2427 /** |
2406 * Free the memory pointed to |data|. That memory is guaranteed to be | 2428 * Free the memory pointed to |data|. That memory is guaranteed to be |
2407 * previously allocated by |Allocate|. | 2429 * previously allocated by |Allocate|. |
2408 */ | 2430 */ |
2409 virtual void Free(void* data) = 0; | 2431 virtual void Free(void* data) = 0; |
2410 }; | 2432 }; |
2411 | 2433 |
2412 /** | 2434 /** |
2413 * The contents of an |ArrayBuffer|. Externalization of |ArrayBuffer| | 2435 * The contents of an |ArrayBuffer|. Externalization of |ArrayBuffer| |
2414 * returns an instance of this class, populated, with a pointer to data | 2436 * returns an instance of this class, populated, with a pointer to data |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2712 }; | 2734 }; |
2713 | 2735 |
2714 | 2736 |
2715 /** | 2737 /** |
2716 * An instance of the built-in Date constructor (ECMA-262, 15.9). | 2738 * An instance of the built-in Date constructor (ECMA-262, 15.9). |
2717 */ | 2739 */ |
2718 class V8EXPORT Date : public Object { | 2740 class V8EXPORT Date : public Object { |
2719 public: | 2741 public: |
2720 static Local<Value> New(double time); | 2742 static Local<Value> New(double time); |
2721 | 2743 |
| 2744 // Deprecated, use Date::ValueOf() instead. |
| 2745 // TODO(svenpanne) Actually deprecate when Chrome is adapted. |
| 2746 double NumberValue() const { return ValueOf(); } |
| 2747 |
2722 /** | 2748 /** |
2723 * A specialization of Value::NumberValue that is more efficient | 2749 * A specialization of Value::NumberValue that is more efficient |
2724 * because we know the structure of this object. | 2750 * because we know the structure of this object. |
2725 */ | 2751 */ |
2726 double NumberValue() const; | 2752 double ValueOf() const; |
2727 | 2753 |
2728 V8_INLINE(static Date* Cast(v8::Value* obj)); | 2754 V8_INLINE(static Date* Cast(v8::Value* obj)); |
2729 | 2755 |
2730 /** | 2756 /** |
2731 * Notification that the embedder has changed the time zone, | 2757 * Notification that the embedder has changed the time zone, |
2732 * daylight savings time, or other date / time configuration | 2758 * daylight savings time, or other date / time configuration |
2733 * parameters. V8 keeps a cache of various values used for | 2759 * parameters. V8 keeps a cache of various values used for |
2734 * date / time computation. This notification will reset | 2760 * date / time computation. This notification will reset |
2735 * those cached values for the current context so that date / | 2761 * those cached values for the current context so that date / |
2736 * time configuration changes would be reflected in the Date | 2762 * time configuration changes would be reflected in the Date |
2737 * object. | 2763 * object. |
2738 * | 2764 * |
2739 * This API should not be called more than needed as it will | 2765 * This API should not be called more than needed as it will |
2740 * negatively impact the performance of date operations. | 2766 * negatively impact the performance of date operations. |
2741 */ | 2767 */ |
2742 static void DateTimeConfigurationChangeNotification(); | 2768 static void DateTimeConfigurationChangeNotification(); |
2743 | 2769 |
2744 private: | 2770 private: |
2745 static void CheckCast(v8::Value* obj); | 2771 static void CheckCast(v8::Value* obj); |
2746 }; | 2772 }; |
2747 | 2773 |
2748 | 2774 |
2749 /** | 2775 /** |
2750 * A Number object (ECMA-262, 4.3.21). | 2776 * A Number object (ECMA-262, 4.3.21). |
2751 */ | 2777 */ |
2752 class V8EXPORT NumberObject : public Object { | 2778 class V8EXPORT NumberObject : public Object { |
2753 public: | 2779 public: |
2754 static Local<Value> New(double value); | 2780 static Local<Value> New(double value); |
2755 | 2781 |
| 2782 // Deprecated, use NumberObject::ValueOf() instead. |
| 2783 // TODO(svenpanne) Actually deprecate when Chrome is adapted. |
| 2784 double NumberValue() const { return ValueOf(); } |
| 2785 |
2756 /** | 2786 /** |
2757 * Returns the Number held by the object. | 2787 * Returns the Number held by the object. |
2758 */ | 2788 */ |
2759 double NumberValue() const; | 2789 double ValueOf() const; |
2760 | 2790 |
2761 V8_INLINE(static NumberObject* Cast(v8::Value* obj)); | 2791 V8_INLINE(static NumberObject* Cast(v8::Value* obj)); |
2762 | 2792 |
2763 private: | 2793 private: |
2764 static void CheckCast(v8::Value* obj); | 2794 static void CheckCast(v8::Value* obj); |
2765 }; | 2795 }; |
2766 | 2796 |
2767 | 2797 |
2768 /** | 2798 /** |
2769 * A Boolean object (ECMA-262, 4.3.15). | 2799 * A Boolean object (ECMA-262, 4.3.15). |
2770 */ | 2800 */ |
2771 class V8EXPORT BooleanObject : public Object { | 2801 class V8EXPORT BooleanObject : public Object { |
2772 public: | 2802 public: |
2773 static Local<Value> New(bool value); | 2803 static Local<Value> New(bool value); |
2774 | 2804 |
| 2805 // Deprecated, use BooleanObject::ValueOf() instead. |
| 2806 // TODO(svenpanne) Actually deprecate when Chrome is adapted. |
| 2807 bool BooleanValue() const { return ValueOf(); } |
| 2808 |
2775 /** | 2809 /** |
2776 * Returns the Boolean held by the object. | 2810 * Returns the Boolean held by the object. |
2777 */ | 2811 */ |
2778 bool BooleanValue() const; | 2812 bool ValueOf() const; |
2779 | 2813 |
2780 V8_INLINE(static BooleanObject* Cast(v8::Value* obj)); | 2814 V8_INLINE(static BooleanObject* Cast(v8::Value* obj)); |
2781 | 2815 |
2782 private: | 2816 private: |
2783 static void CheckCast(v8::Value* obj); | 2817 static void CheckCast(v8::Value* obj); |
2784 }; | 2818 }; |
2785 | 2819 |
2786 | 2820 |
2787 /** | 2821 /** |
2788 * A String object (ECMA-262, 4.3.18). | 2822 * A String object (ECMA-262, 4.3.18). |
2789 */ | 2823 */ |
2790 class V8EXPORT StringObject : public Object { | 2824 class V8EXPORT StringObject : public Object { |
2791 public: | 2825 public: |
2792 static Local<Value> New(Handle<String> value); | 2826 static Local<Value> New(Handle<String> value); |
2793 | 2827 |
| 2828 // Deprecated, use StringObject::ValueOf() instead. |
| 2829 // TODO(svenpanne) Actually deprecate when Chrome is adapted. |
| 2830 Local<String> StringValue() const { return ValueOf(); } |
| 2831 |
2794 /** | 2832 /** |
2795 * Returns the String held by the object. | 2833 * Returns the String held by the object. |
2796 */ | 2834 */ |
2797 Local<String> StringValue() const; | 2835 Local<String> ValueOf() const; |
2798 | 2836 |
2799 V8_INLINE(static StringObject* Cast(v8::Value* obj)); | 2837 V8_INLINE(static StringObject* Cast(v8::Value* obj)); |
2800 | 2838 |
2801 private: | 2839 private: |
2802 static void CheckCast(v8::Value* obj); | 2840 static void CheckCast(v8::Value* obj); |
2803 }; | 2841 }; |
2804 | 2842 |
2805 | 2843 |
2806 /** | 2844 /** |
2807 * A Symbol object (ECMA-262 edition 6). | 2845 * A Symbol object (ECMA-262 edition 6). |
2808 * | 2846 * |
2809 * This is an experimental feature. Use at your own risk. | 2847 * This is an experimental feature. Use at your own risk. |
2810 */ | 2848 */ |
2811 class V8EXPORT SymbolObject : public Object { | 2849 class V8EXPORT SymbolObject : public Object { |
2812 public: | 2850 public: |
2813 static Local<Value> New(Isolate* isolate, Handle<Symbol> value); | 2851 static Local<Value> New(Isolate* isolate, Handle<Symbol> value); |
2814 | 2852 |
| 2853 // Deprecated, use SymbolObject::ValueOf() instead. |
| 2854 // TODO(svenpanne) Actually deprecate when Chrome is adapted. |
| 2855 Local<Symbol> SymbolValue() const { return ValueOf(); } |
| 2856 |
2815 /** | 2857 /** |
2816 * Returns the Symbol held by the object. | 2858 * Returns the Symbol held by the object. |
2817 */ | 2859 */ |
2818 Local<Symbol> SymbolValue() const; | 2860 Local<Symbol> ValueOf() const; |
2819 | 2861 |
2820 V8_INLINE(static SymbolObject* Cast(v8::Value* obj)); | 2862 V8_INLINE(static SymbolObject* Cast(v8::Value* obj)); |
2821 | 2863 |
2822 private: | 2864 private: |
2823 static void CheckCast(v8::Value* obj); | 2865 static void CheckCast(v8::Value* obj); |
2824 }; | 2866 }; |
2825 | 2867 |
2826 | 2868 |
2827 /** | 2869 /** |
2828 * An instance of the built-in RegExp constructor (ECMA-262, 15.10). | 2870 * An instance of the built-in RegExp constructor (ECMA-262, 15.10). |
(...skipping 2563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5392 static const int kStringEncodingMask = 0x4; | 5434 static const int kStringEncodingMask = 0x4; |
5393 static const int kExternalTwoByteRepresentationTag = 0x02; | 5435 static const int kExternalTwoByteRepresentationTag = 0x02; |
5394 static const int kExternalAsciiRepresentationTag = 0x06; | 5436 static const int kExternalAsciiRepresentationTag = 0x06; |
5395 | 5437 |
5396 static const int kIsolateEmbedderDataOffset = 1 * kApiPointerSize; | 5438 static const int kIsolateEmbedderDataOffset = 1 * kApiPointerSize; |
5397 static const int kIsolateRootsOffset = 3 * kApiPointerSize; | 5439 static const int kIsolateRootsOffset = 3 * kApiPointerSize; |
5398 static const int kUndefinedValueRootIndex = 5; | 5440 static const int kUndefinedValueRootIndex = 5; |
5399 static const int kNullValueRootIndex = 7; | 5441 static const int kNullValueRootIndex = 7; |
5400 static const int kTrueValueRootIndex = 8; | 5442 static const int kTrueValueRootIndex = 8; |
5401 static const int kFalseValueRootIndex = 9; | 5443 static const int kFalseValueRootIndex = 9; |
5402 static const int kEmptyStringRootIndex = 134; | 5444 static const int kEmptyStringRootIndex = 135; |
5403 | 5445 |
5404 static const int kNodeClassIdOffset = 1 * kApiPointerSize; | 5446 static const int kNodeClassIdOffset = 1 * kApiPointerSize; |
5405 static const int kNodeFlagsOffset = 1 * kApiPointerSize + 3; | 5447 static const int kNodeFlagsOffset = 1 * kApiPointerSize + 3; |
5406 static const int kNodeStateMask = 0xf; | 5448 static const int kNodeStateMask = 0xf; |
5407 static const int kNodeStateIsWeakValue = 2; | 5449 static const int kNodeStateIsWeakValue = 2; |
5408 static const int kNodeStateIsNearDeathValue = 4; | 5450 static const int kNodeStateIsNearDeathValue = 4; |
5409 static const int kNodeIsIndependentShift = 4; | 5451 static const int kNodeIsIndependentShift = 4; |
5410 static const int kNodeIsPartiallyDependentShift = 5; | 5452 static const int kNodeIsPartiallyDependentShift = 5; |
5411 | 5453 |
5412 static const int kJSObjectType = 0xb1; | 5454 static const int kJSObjectType = 0xb1; |
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5969 | 6011 |
5970 Handle<Integer> ScriptOrigin::ResourceLineOffset() const { | 6012 Handle<Integer> ScriptOrigin::ResourceLineOffset() const { |
5971 return resource_line_offset_; | 6013 return resource_line_offset_; |
5972 } | 6014 } |
5973 | 6015 |
5974 | 6016 |
5975 Handle<Integer> ScriptOrigin::ResourceColumnOffset() const { | 6017 Handle<Integer> ScriptOrigin::ResourceColumnOffset() const { |
5976 return resource_column_offset_; | 6018 return resource_column_offset_; |
5977 } | 6019 } |
5978 | 6020 |
| 6021 Handle<Boolean> ScriptOrigin::ResourceIsSharedCrossOrigin() const { |
| 6022 return resource_is_shared_cross_origin_; |
| 6023 } |
| 6024 |
5979 | 6025 |
5980 Handle<Boolean> Boolean::New(bool value) { | 6026 Handle<Boolean> Boolean::New(bool value) { |
5981 return value ? True() : False(); | 6027 return value ? True() : False(); |
5982 } | 6028 } |
5983 | 6029 |
5984 | 6030 |
5985 void Template::Set(const char* name, v8::Handle<Data> value) { | 6031 void Template::Set(const char* name, v8::Handle<Data> value) { |
5986 Set(v8::String::New(name), value); | 6032 Set(v8::String::New(name), value); |
5987 } | 6033 } |
5988 | 6034 |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6481 | 6527 |
6482 | 6528 |
6483 } // namespace v8 | 6529 } // namespace v8 |
6484 | 6530 |
6485 | 6531 |
6486 #undef V8EXPORT | 6532 #undef V8EXPORT |
6487 #undef TYPE_CHECK | 6533 #undef TYPE_CHECK |
6488 | 6534 |
6489 | 6535 |
6490 #endif // V8_H_ | 6536 #endif // V8_H_ |
OLD | NEW |