| 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 955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 966 /** | 966 /** |
| 967 * The superclass of values and API object templates. | 967 * The superclass of values and API object templates. |
| 968 */ | 968 */ |
| 969 class V8_EXPORT Data { | 969 class V8_EXPORT Data { |
| 970 private: | 970 private: |
| 971 Data(); | 971 Data(); |
| 972 }; | 972 }; |
| 973 | 973 |
| 974 | 974 |
| 975 /** | 975 /** |
| 976 * The optional attributes of ScriptOrigin. |
| 977 */ |
| 978 class ScriptOriginOptions { |
| 979 public: |
| 980 V8_INLINE ScriptOriginOptions(bool is_embedder_debug_script = false, |
| 981 bool is_shared_cross_origin = false, |
| 982 bool is_opaque = false) |
| 983 : flags_((is_embedder_debug_script ? kIsEmbedderDebugScript : 0) | |
| 984 (is_shared_cross_origin ? kIsSharedCrossOrigin : 0) | |
| 985 (is_opaque ? kIsOpaque : 0)) {} |
| 986 bool IsEmbedderDebugScript() const { return flags_ & kIsEmbedderDebugScript; } |
| 987 bool IsSharedCrossOrigin() const { return flags_ & kIsSharedCrossOrigin; } |
| 988 bool IsOpaque() const { return flags_ & kIsOpaque; } |
| 989 |
| 990 private: |
| 991 enum { |
| 992 kIsEmbedderDebugScript = 1, |
| 993 kIsSharedCrossOrigin = 1 << 1, |
| 994 kIsOpaque = 1 << 2 |
| 995 }; |
| 996 const unsigned char flags_; |
| 997 }; |
| 998 |
| 999 /** |
| 976 * The origin, within a file, of a script. | 1000 * The origin, within a file, of a script. |
| 977 */ | 1001 */ |
| 978 class ScriptOrigin { | 1002 class ScriptOrigin { |
| 979 public: | 1003 public: |
| 980 V8_INLINE ScriptOrigin( | 1004 V8_INLINE ScriptOrigin( |
| 981 Handle<Value> resource_name, | 1005 Handle<Value> resource_name, |
| 982 Handle<Integer> resource_line_offset = Handle<Integer>(), | 1006 Handle<Integer> resource_line_offset = Handle<Integer>(), |
| 983 Handle<Integer> resource_column_offset = Handle<Integer>(), | 1007 Handle<Integer> resource_column_offset = Handle<Integer>(), |
| 984 Handle<Boolean> resource_is_shared_cross_origin = Handle<Boolean>(), | 1008 Handle<Boolean> resource_is_shared_cross_origin = Handle<Boolean>(), |
| 985 Handle<Integer> script_id = Handle<Integer>(), | 1009 Handle<Integer> script_id = Handle<Integer>(), |
| 986 Handle<Boolean> resource_is_embedder_debug_script = Handle<Boolean>(), | 1010 Handle<Boolean> resource_is_embedder_debug_script = Handle<Boolean>(), |
| 987 Handle<Value> source_map_url = Handle<Value>()) | 1011 Handle<Value> source_map_url = Handle<Value>(), |
| 988 : resource_name_(resource_name), | 1012 Handle<Boolean> resource_is_opaque = Handle<Boolean>()); |
| 989 resource_line_offset_(resource_line_offset), | |
| 990 resource_column_offset_(resource_column_offset), | |
| 991 resource_is_embedder_debug_script_(resource_is_embedder_debug_script), | |
| 992 resource_is_shared_cross_origin_(resource_is_shared_cross_origin), | |
| 993 script_id_(script_id), | |
| 994 source_map_url_(source_map_url) {} | |
| 995 V8_INLINE Handle<Value> ResourceName() const; | 1013 V8_INLINE Handle<Value> ResourceName() const; |
| 996 V8_INLINE Handle<Integer> ResourceLineOffset() const; | 1014 V8_INLINE Handle<Integer> ResourceLineOffset() const; |
| 997 V8_INLINE Handle<Integer> ResourceColumnOffset() const; | 1015 V8_INLINE Handle<Integer> ResourceColumnOffset() const; |
| 998 /** | 1016 /** |
| 999 * Returns true for embedder's debugger scripts | 1017 * Returns true for embedder's debugger scripts |
| 1000 */ | 1018 */ |
| 1001 V8_INLINE Handle<Boolean> ResourceIsEmbedderDebugScript() const; | |
| 1002 V8_INLINE Handle<Boolean> ResourceIsSharedCrossOrigin() const; | |
| 1003 V8_INLINE Handle<Integer> ScriptID() const; | 1019 V8_INLINE Handle<Integer> ScriptID() const; |
| 1004 V8_INLINE Handle<Value> SourceMapUrl() const; | 1020 V8_INLINE Handle<Value> SourceMapUrl() const; |
| 1021 V8_INLINE ScriptOriginOptions Options() const { return options_; } |
| 1005 | 1022 |
| 1006 private: | 1023 private: |
| 1007 Handle<Value> resource_name_; | 1024 Handle<Value> resource_name_; |
| 1008 Handle<Integer> resource_line_offset_; | 1025 Handle<Integer> resource_line_offset_; |
| 1009 Handle<Integer> resource_column_offset_; | 1026 Handle<Integer> resource_column_offset_; |
| 1010 Handle<Boolean> resource_is_embedder_debug_script_; | 1027 ScriptOriginOptions options_; |
| 1011 Handle<Boolean> resource_is_shared_cross_origin_; | |
| 1012 Handle<Integer> script_id_; | 1028 Handle<Integer> script_id_; |
| 1013 Handle<Value> source_map_url_; | 1029 Handle<Value> source_map_url_; |
| 1014 }; | 1030 }; |
| 1015 | 1031 |
| 1016 | 1032 |
| 1017 /** | 1033 /** |
| 1018 * A compiled JavaScript script, not yet tied to a Context. | 1034 * A compiled JavaScript script, not yet tied to a Context. |
| 1019 */ | 1035 */ |
| 1020 class V8_EXPORT UnboundScript { | 1036 class V8_EXPORT UnboundScript { |
| 1021 public: | 1037 public: |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1153 // Prevent copying. Not implemented. | 1169 // Prevent copying. Not implemented. |
| 1154 Source(const Source&); | 1170 Source(const Source&); |
| 1155 Source& operator=(const Source&); | 1171 Source& operator=(const Source&); |
| 1156 | 1172 |
| 1157 Local<String> source_string; | 1173 Local<String> source_string; |
| 1158 | 1174 |
| 1159 // Origin information | 1175 // Origin information |
| 1160 Handle<Value> resource_name; | 1176 Handle<Value> resource_name; |
| 1161 Handle<Integer> resource_line_offset; | 1177 Handle<Integer> resource_line_offset; |
| 1162 Handle<Integer> resource_column_offset; | 1178 Handle<Integer> resource_column_offset; |
| 1163 Handle<Boolean> resource_is_embedder_debug_script; | 1179 ScriptOriginOptions resource_options; |
| 1164 Handle<Boolean> resource_is_shared_cross_origin; | |
| 1165 Handle<Value> source_map_url; | 1180 Handle<Value> source_map_url; |
| 1166 | 1181 |
| 1167 // Cached data from previous compilation (if a kConsume*Cache flag is | 1182 // Cached data from previous compilation (if a kConsume*Cache flag is |
| 1168 // set), or hold newly generated cache data (kProduce*Cache flags) are | 1183 // set), or hold newly generated cache data (kProduce*Cache flags) are |
| 1169 // set when calling a compile method. | 1184 // set when calling a compile method. |
| 1170 CachedData* cached_data; | 1185 CachedData* cached_data; |
| 1171 }; | 1186 }; |
| 1172 | 1187 |
| 1173 /** | 1188 /** |
| 1174 * For streaming incomplete script data to V8. The embedder should implement a | 1189 * For streaming incomplete script data to V8. The embedder should implement a |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1443 * the error occurred. | 1458 * the error occurred. |
| 1444 */ | 1459 */ |
| 1445 V8_DEPRECATE_SOON("Use maybe version", int GetEndColumn() const); | 1460 V8_DEPRECATE_SOON("Use maybe version", int GetEndColumn() const); |
| 1446 V8_WARN_UNUSED_RESULT Maybe<int> GetEndColumn(Local<Context> context) const; | 1461 V8_WARN_UNUSED_RESULT Maybe<int> GetEndColumn(Local<Context> context) const; |
| 1447 | 1462 |
| 1448 /** | 1463 /** |
| 1449 * Passes on the value set by the embedder when it fed the script from which | 1464 * Passes on the value set by the embedder when it fed the script from which |
| 1450 * this Message was generated to V8. | 1465 * this Message was generated to V8. |
| 1451 */ | 1466 */ |
| 1452 bool IsSharedCrossOrigin() const; | 1467 bool IsSharedCrossOrigin() const; |
| 1468 bool IsOpaque() const; |
| 1453 | 1469 |
| 1454 // TODO(1245381): Print to a string instead of on a FILE. | 1470 // TODO(1245381): Print to a string instead of on a FILE. |
| 1455 static void PrintCurrentStackTrace(Isolate* isolate, FILE* out); | 1471 static void PrintCurrentStackTrace(Isolate* isolate, FILE* out); |
| 1456 | 1472 |
| 1457 static const int kNoLineNumberInfo = 0; | 1473 static const int kNoLineNumberInfo = 0; |
| 1458 static const int kNoColumnInfo = 0; | 1474 static const int kNoColumnInfo = 0; |
| 1459 static const int kNoScriptIdInfo = 0; | 1475 static const int kNoScriptIdInfo = 0; |
| 1460 }; | 1476 }; |
| 1461 | 1477 |
| 1462 | 1478 |
| (...skipping 5756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7219 bool FunctionCallbackInfo<T>::IsConstructCall() const { | 7235 bool FunctionCallbackInfo<T>::IsConstructCall() const { |
| 7220 return is_construct_call_ & 0x1; | 7236 return is_construct_call_ & 0x1; |
| 7221 } | 7237 } |
| 7222 | 7238 |
| 7223 | 7239 |
| 7224 template<typename T> | 7240 template<typename T> |
| 7225 int FunctionCallbackInfo<T>::Length() const { | 7241 int FunctionCallbackInfo<T>::Length() const { |
| 7226 return length_; | 7242 return length_; |
| 7227 } | 7243 } |
| 7228 | 7244 |
| 7245 ScriptOrigin::ScriptOrigin(Handle<Value> resource_name, |
| 7246 Handle<Integer> resource_line_offset, |
| 7247 Handle<Integer> resource_column_offset, |
| 7248 Handle<Boolean> resource_is_shared_cross_origin, |
| 7249 Handle<Integer> script_id, |
| 7250 Handle<Boolean> resource_is_embedder_debug_script, |
| 7251 Handle<Value> source_map_url, |
| 7252 Handle<Boolean> resource_is_opaque) |
| 7253 : resource_name_(resource_name), |
| 7254 resource_line_offset_(resource_line_offset), |
| 7255 resource_column_offset_(resource_column_offset), |
| 7256 options_(!resource_is_embedder_debug_script.IsEmpty() && |
| 7257 resource_is_embedder_debug_script->IsTrue(), |
| 7258 !resource_is_shared_cross_origin.IsEmpty() && |
| 7259 resource_is_shared_cross_origin->IsTrue(), |
| 7260 !resource_is_opaque.IsEmpty() && resource_is_opaque->IsTrue()), |
| 7261 script_id_(script_id), |
| 7262 source_map_url_(source_map_url) {} |
| 7229 | 7263 |
| 7230 Handle<Value> ScriptOrigin::ResourceName() const { | 7264 Handle<Value> ScriptOrigin::ResourceName() const { |
| 7231 return resource_name_; | 7265 return resource_name_; |
| 7232 } | 7266 } |
| 7233 | 7267 |
| 7234 | 7268 |
| 7235 Handle<Integer> ScriptOrigin::ResourceLineOffset() const { | 7269 Handle<Integer> ScriptOrigin::ResourceLineOffset() const { |
| 7236 return resource_line_offset_; | 7270 return resource_line_offset_; |
| 7237 } | 7271 } |
| 7238 | 7272 |
| 7239 | 7273 |
| 7240 Handle<Integer> ScriptOrigin::ResourceColumnOffset() const { | 7274 Handle<Integer> ScriptOrigin::ResourceColumnOffset() const { |
| 7241 return resource_column_offset_; | 7275 return resource_column_offset_; |
| 7242 } | 7276 } |
| 7243 | 7277 |
| 7244 | 7278 |
| 7245 Handle<Boolean> ScriptOrigin::ResourceIsEmbedderDebugScript() const { | |
| 7246 return resource_is_embedder_debug_script_; | |
| 7247 } | |
| 7248 | |
| 7249 | |
| 7250 Handle<Boolean> ScriptOrigin::ResourceIsSharedCrossOrigin() const { | |
| 7251 return resource_is_shared_cross_origin_; | |
| 7252 } | |
| 7253 | |
| 7254 | |
| 7255 Handle<Integer> ScriptOrigin::ScriptID() const { | 7279 Handle<Integer> ScriptOrigin::ScriptID() const { |
| 7256 return script_id_; | 7280 return script_id_; |
| 7257 } | 7281 } |
| 7258 | 7282 |
| 7259 | 7283 |
| 7260 Handle<Value> ScriptOrigin::SourceMapUrl() const { return source_map_url_; } | 7284 Handle<Value> ScriptOrigin::SourceMapUrl() const { return source_map_url_; } |
| 7261 | 7285 |
| 7262 | 7286 |
| 7263 ScriptCompiler::Source::Source(Local<String> string, const ScriptOrigin& origin, | 7287 ScriptCompiler::Source::Source(Local<String> string, const ScriptOrigin& origin, |
| 7264 CachedData* data) | 7288 CachedData* data) |
| 7265 : source_string(string), | 7289 : source_string(string), |
| 7266 resource_name(origin.ResourceName()), | 7290 resource_name(origin.ResourceName()), |
| 7267 resource_line_offset(origin.ResourceLineOffset()), | 7291 resource_line_offset(origin.ResourceLineOffset()), |
| 7268 resource_column_offset(origin.ResourceColumnOffset()), | 7292 resource_column_offset(origin.ResourceColumnOffset()), |
| 7269 resource_is_embedder_debug_script(origin.ResourceIsEmbedderDebugScript()), | 7293 resource_options(origin.Options()), |
| 7270 resource_is_shared_cross_origin(origin.ResourceIsSharedCrossOrigin()), | |
| 7271 source_map_url(origin.SourceMapUrl()), | 7294 source_map_url(origin.SourceMapUrl()), |
| 7272 cached_data(data) {} | 7295 cached_data(data) {} |
| 7273 | 7296 |
| 7274 | 7297 |
| 7275 ScriptCompiler::Source::Source(Local<String> string, | 7298 ScriptCompiler::Source::Source(Local<String> string, |
| 7276 CachedData* data) | 7299 CachedData* data) |
| 7277 : source_string(string), cached_data(data) {} | 7300 : source_string(string), cached_data(data) {} |
| 7278 | 7301 |
| 7279 | 7302 |
| 7280 ScriptCompiler::Source::~Source() { | 7303 ScriptCompiler::Source::~Source() { |
| (...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8024 */ | 8047 */ |
| 8025 | 8048 |
| 8026 | 8049 |
| 8027 } // namespace v8 | 8050 } // namespace v8 |
| 8028 | 8051 |
| 8029 | 8052 |
| 8030 #undef TYPE_CHECK | 8053 #undef TYPE_CHECK |
| 8031 | 8054 |
| 8032 | 8055 |
| 8033 #endif // V8_H_ | 8056 #endif // V8_H_ |
| OLD | NEW |