| 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 /** \mainpage V8 API Reference Guide | 5 /** \mainpage V8 API Reference Guide |
| 6 * | 6 * |
| 7 * V8 is Google's open source JavaScript engine. | 7 * V8 is Google's open source JavaScript engine. |
| 8 * | 8 * |
| 9 * This set of documents provides reference material generated from the | 9 * This set of documents provides reference material generated from the |
| 10 * V8 header file, include/v8.h. | 10 * V8 header file, include/v8.h. |
| (...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 955 Data(); | 955 Data(); |
| 956 }; | 956 }; |
| 957 | 957 |
| 958 | 958 |
| 959 /** | 959 /** |
| 960 * The optional attributes of ScriptOrigin. | 960 * The optional attributes of ScriptOrigin. |
| 961 */ | 961 */ |
| 962 class ScriptOriginOptions { | 962 class ScriptOriginOptions { |
| 963 public: | 963 public: |
| 964 V8_INLINE ScriptOriginOptions(bool is_shared_cross_origin = false, | 964 V8_INLINE ScriptOriginOptions(bool is_shared_cross_origin = false, |
| 965 bool is_opaque = false, bool is_wasm = false) | 965 bool is_opaque = false, bool is_wasm = false, |
| 966 bool is_module = false) |
| 966 : flags_((is_shared_cross_origin ? kIsSharedCrossOrigin : 0) | | 967 : flags_((is_shared_cross_origin ? kIsSharedCrossOrigin : 0) | |
| 967 (is_wasm ? kIsWasm : 0) | (is_opaque ? kIsOpaque : 0)) {} | 968 (is_wasm ? kIsWasm : 0) | (is_opaque ? kIsOpaque : 0) | |
| 969 (is_module ? kIsModule : 0)) {} |
| 968 V8_INLINE ScriptOriginOptions(int flags) | 970 V8_INLINE ScriptOriginOptions(int flags) |
| 969 : flags_(flags & (kIsSharedCrossOrigin | kIsOpaque | kIsWasm)) {} | 971 : flags_(flags & |
| 972 (kIsSharedCrossOrigin | kIsOpaque | kIsWasm | kIsModule)) {} |
| 973 |
| 970 bool IsSharedCrossOrigin() const { | 974 bool IsSharedCrossOrigin() const { |
| 971 return (flags_ & kIsSharedCrossOrigin) != 0; | 975 return (flags_ & kIsSharedCrossOrigin) != 0; |
| 972 } | 976 } |
| 973 bool IsOpaque() const { return (flags_ & kIsOpaque) != 0; } | 977 bool IsOpaque() const { return (flags_ & kIsOpaque) != 0; } |
| 974 bool IsWasm() const { return (flags_ & kIsWasm) != 0; } | 978 bool IsWasm() const { return (flags_ & kIsWasm) != 0; } |
| 979 bool IsModule() const { return (flags_ & kIsModule) != 0; } |
| 980 |
| 975 int Flags() const { return flags_; } | 981 int Flags() const { return flags_; } |
| 976 | 982 |
| 977 private: | 983 private: |
| 978 enum { kIsSharedCrossOrigin = 1, kIsOpaque = 1 << 1, kIsWasm = 1 << 2 }; | 984 enum { |
| 985 kIsSharedCrossOrigin = 1, |
| 986 kIsOpaque = 1 << 1, |
| 987 kIsWasm = 1 << 2, |
| 988 kIsModule = 1 << 3 |
| 989 }; |
| 979 const int flags_; | 990 const int flags_; |
| 980 }; | 991 }; |
| 981 | 992 |
| 982 /** | 993 /** |
| 983 * The origin, within a file, of a script. | 994 * The origin, within a file, of a script. |
| 984 */ | 995 */ |
| 985 class ScriptOrigin { | 996 class ScriptOrigin { |
| 986 public: | 997 public: |
| 987 V8_INLINE ScriptOrigin( | 998 V8_INLINE ScriptOrigin( |
| 988 Local<Value> resource_name, | 999 Local<Value> resource_name, |
| 989 Local<Integer> resource_line_offset = Local<Integer>(), | 1000 Local<Integer> resource_line_offset = Local<Integer>(), |
| 990 Local<Integer> resource_column_offset = Local<Integer>(), | 1001 Local<Integer> resource_column_offset = Local<Integer>(), |
| 991 Local<Boolean> resource_is_shared_cross_origin = Local<Boolean>(), | 1002 Local<Boolean> resource_is_shared_cross_origin = Local<Boolean>(), |
| 992 Local<Integer> script_id = Local<Integer>(), | 1003 Local<Integer> script_id = Local<Integer>(), |
| 993 Local<Value> source_map_url = Local<Value>(), | 1004 Local<Value> source_map_url = Local<Value>(), |
| 994 Local<Boolean> resource_is_opaque = Local<Boolean>(), | 1005 Local<Boolean> resource_is_opaque = Local<Boolean>(), |
| 995 Local<Boolean> is_wasm = Local<Boolean>()); | 1006 Local<Boolean> is_wasm = Local<Boolean>(), |
| 1007 Local<Boolean> is_module = Local<Boolean>()); |
| 996 | 1008 |
| 997 V8_INLINE Local<Value> ResourceName() const; | 1009 V8_INLINE Local<Value> ResourceName() const; |
| 998 V8_INLINE Local<Integer> ResourceLineOffset() const; | 1010 V8_INLINE Local<Integer> ResourceLineOffset() const; |
| 999 V8_INLINE Local<Integer> ResourceColumnOffset() const; | 1011 V8_INLINE Local<Integer> ResourceColumnOffset() const; |
| 1000 /** | 1012 /** |
| 1001 * Returns true for embedder's debugger scripts | 1013 * Returns true for embedder's debugger scripts |
| 1002 */ | 1014 */ |
| 1003 V8_INLINE Local<Integer> ScriptID() const; | 1015 V8_INLINE Local<Integer> ScriptID() const; |
| 1004 V8_INLINE Local<Value> SourceMapUrl() const; | 1016 V8_INLINE Local<Value> SourceMapUrl() const; |
| 1005 V8_INLINE ScriptOriginOptions Options() const { return options_; } | 1017 V8_INLINE ScriptOriginOptions Options() const { return options_; } |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1176 CachedData* cached_data = NULL); | 1188 CachedData* cached_data = NULL); |
| 1177 V8_INLINE Source(Local<String> source_string, | 1189 V8_INLINE Source(Local<String> source_string, |
| 1178 CachedData* cached_data = NULL); | 1190 CachedData* cached_data = NULL); |
| 1179 V8_INLINE ~Source(); | 1191 V8_INLINE ~Source(); |
| 1180 | 1192 |
| 1181 // Ownership of the CachedData or its buffers is *not* transferred to the | 1193 // Ownership of the CachedData or its buffers is *not* transferred to the |
| 1182 // caller. The CachedData object is alive as long as the Source object is | 1194 // caller. The CachedData object is alive as long as the Source object is |
| 1183 // alive. | 1195 // alive. |
| 1184 V8_INLINE const CachedData* GetCachedData() const; | 1196 V8_INLINE const CachedData* GetCachedData() const; |
| 1185 | 1197 |
| 1198 V8_INLINE const ScriptOriginOptions& GetResourceOptions() const; |
| 1199 |
| 1186 // Prevent copying. | 1200 // Prevent copying. |
| 1187 Source(const Source&) = delete; | 1201 Source(const Source&) = delete; |
| 1188 Source& operator=(const Source&) = delete; | 1202 Source& operator=(const Source&) = delete; |
| 1189 | 1203 |
| 1190 private: | 1204 private: |
| 1191 friend class ScriptCompiler; | 1205 friend class ScriptCompiler; |
| 1192 | 1206 |
| 1193 Local<String> source_string; | 1207 Local<String> source_string; |
| 1194 | 1208 |
| 1195 // Origin information | 1209 // Origin information |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1418 Local<String> arguments[], | 1432 Local<String> arguments[], |
| 1419 size_t context_extension_count, | 1433 size_t context_extension_count, |
| 1420 Local<Object> context_extensions[])); | 1434 Local<Object> context_extensions[])); |
| 1421 static V8_WARN_UNUSED_RESULT MaybeLocal<Function> CompileFunctionInContext( | 1435 static V8_WARN_UNUSED_RESULT MaybeLocal<Function> CompileFunctionInContext( |
| 1422 Local<Context> context, Source* source, size_t arguments_count, | 1436 Local<Context> context, Source* source, size_t arguments_count, |
| 1423 Local<String> arguments[], size_t context_extension_count, | 1437 Local<String> arguments[], size_t context_extension_count, |
| 1424 Local<Object> context_extensions[]); | 1438 Local<Object> context_extensions[]); |
| 1425 | 1439 |
| 1426 private: | 1440 private: |
| 1427 static V8_WARN_UNUSED_RESULT MaybeLocal<UnboundScript> CompileUnboundInternal( | 1441 static V8_WARN_UNUSED_RESULT MaybeLocal<UnboundScript> CompileUnboundInternal( |
| 1428 Isolate* isolate, Source* source, CompileOptions options, bool is_module); | 1442 Isolate* isolate, Source* source, CompileOptions options); |
| 1429 }; | 1443 }; |
| 1430 | 1444 |
| 1431 | 1445 |
| 1432 /** | 1446 /** |
| 1433 * An error message. | 1447 * An error message. |
| 1434 */ | 1448 */ |
| 1435 class V8_EXPORT Message { | 1449 class V8_EXPORT Message { |
| 1436 public: | 1450 public: |
| 1437 Local<String> Get() const; | 1451 Local<String> Get() const; |
| 1438 | 1452 |
| (...skipping 7541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8980 return length_; | 8994 return length_; |
| 8981 } | 8995 } |
| 8982 | 8996 |
| 8983 ScriptOrigin::ScriptOrigin(Local<Value> resource_name, | 8997 ScriptOrigin::ScriptOrigin(Local<Value> resource_name, |
| 8984 Local<Integer> resource_line_offset, | 8998 Local<Integer> resource_line_offset, |
| 8985 Local<Integer> resource_column_offset, | 8999 Local<Integer> resource_column_offset, |
| 8986 Local<Boolean> resource_is_shared_cross_origin, | 9000 Local<Boolean> resource_is_shared_cross_origin, |
| 8987 Local<Integer> script_id, | 9001 Local<Integer> script_id, |
| 8988 Local<Value> source_map_url, | 9002 Local<Value> source_map_url, |
| 8989 Local<Boolean> resource_is_opaque, | 9003 Local<Boolean> resource_is_opaque, |
| 8990 Local<Boolean> is_wasm) | 9004 Local<Boolean> is_wasm, Local<Boolean> is_module) |
| 8991 : resource_name_(resource_name), | 9005 : resource_name_(resource_name), |
| 8992 resource_line_offset_(resource_line_offset), | 9006 resource_line_offset_(resource_line_offset), |
| 8993 resource_column_offset_(resource_column_offset), | 9007 resource_column_offset_(resource_column_offset), |
| 8994 options_(!resource_is_shared_cross_origin.IsEmpty() && | 9008 options_(!resource_is_shared_cross_origin.IsEmpty() && |
| 8995 resource_is_shared_cross_origin->IsTrue(), | 9009 resource_is_shared_cross_origin->IsTrue(), |
| 8996 !resource_is_opaque.IsEmpty() && resource_is_opaque->IsTrue(), | 9010 !resource_is_opaque.IsEmpty() && resource_is_opaque->IsTrue(), |
| 8997 !is_wasm.IsEmpty() && is_wasm->IsTrue()), | 9011 !is_wasm.IsEmpty() && is_wasm->IsTrue(), |
| 9012 !is_module.IsEmpty() && is_module->IsTrue()), |
| 8998 script_id_(script_id), | 9013 script_id_(script_id), |
| 8999 source_map_url_(source_map_url) {} | 9014 source_map_url_(source_map_url) {} |
| 9000 | 9015 |
| 9001 Local<Value> ScriptOrigin::ResourceName() const { return resource_name_; } | 9016 Local<Value> ScriptOrigin::ResourceName() const { return resource_name_; } |
| 9002 | 9017 |
| 9003 | 9018 |
| 9004 Local<Integer> ScriptOrigin::ResourceLineOffset() const { | 9019 Local<Integer> ScriptOrigin::ResourceLineOffset() const { |
| 9005 return resource_line_offset_; | 9020 return resource_line_offset_; |
| 9006 } | 9021 } |
| 9007 | 9022 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 9036 ScriptCompiler::Source::~Source() { | 9051 ScriptCompiler::Source::~Source() { |
| 9037 delete cached_data; | 9052 delete cached_data; |
| 9038 } | 9053 } |
| 9039 | 9054 |
| 9040 | 9055 |
| 9041 const ScriptCompiler::CachedData* ScriptCompiler::Source::GetCachedData() | 9056 const ScriptCompiler::CachedData* ScriptCompiler::Source::GetCachedData() |
| 9042 const { | 9057 const { |
| 9043 return cached_data; | 9058 return cached_data; |
| 9044 } | 9059 } |
| 9045 | 9060 |
| 9061 const ScriptOriginOptions& ScriptCompiler::Source::GetResourceOptions() const { |
| 9062 return resource_options; |
| 9063 } |
| 9046 | 9064 |
| 9047 Local<Boolean> Boolean::New(Isolate* isolate, bool value) { | 9065 Local<Boolean> Boolean::New(Isolate* isolate, bool value) { |
| 9048 return value ? True(isolate) : False(isolate); | 9066 return value ? True(isolate) : False(isolate); |
| 9049 } | 9067 } |
| 9050 | 9068 |
| 9051 void Template::Set(Isolate* isolate, const char* name, Local<Data> value) { | 9069 void Template::Set(Isolate* isolate, const char* name, Local<Data> value) { |
| 9052 Set(String::NewFromUtf8(isolate, name, NewStringType::kNormal) | 9070 Set(String::NewFromUtf8(isolate, name, NewStringType::kNormal) |
| 9053 .ToLocalChecked(), | 9071 .ToLocalChecked(), |
| 9054 value); | 9072 value); |
| 9055 } | 9073 } |
| (...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9831 */ | 9849 */ |
| 9832 | 9850 |
| 9833 | 9851 |
| 9834 } // namespace v8 | 9852 } // namespace v8 |
| 9835 | 9853 |
| 9836 | 9854 |
| 9837 #undef TYPE_CHECK | 9855 #undef TYPE_CHECK |
| 9838 | 9856 |
| 9839 | 9857 |
| 9840 #endif // INCLUDE_V8_H_ | 9858 #endif // INCLUDE_V8_H_ |
| OLD | NEW |