| 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 991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1002 * A compiled JavaScript script. | 1002 * A compiled JavaScript script. |
| 1003 */ | 1003 */ |
| 1004 class V8_EXPORT Script { | 1004 class V8_EXPORT Script { |
| 1005 public: | 1005 public: |
| 1006 /** | 1006 /** |
| 1007 * Compiles the specified script (context-independent). | 1007 * Compiles the specified script (context-independent). |
| 1008 * | 1008 * |
| 1009 * \param source Script source code. | 1009 * \param source Script source code. |
| 1010 * \param origin Script origin, owned by caller, no references are kept | 1010 * \param origin Script origin, owned by caller, no references are kept |
| 1011 * when New() returns | 1011 * when New() returns |
| 1012 * \param pre_data Pre-parsing data, as obtained by ScriptData::PreCompile() | 1012 * \param cached_data Cached ScriptData, as obtained from a previous |
| 1013 * using pre_data speeds compilation if it's done multiple times. | 1013 * compilation. Using cached_data speeds compilation if it's done multiple |
| 1014 * Owned by caller, no references are kept when New() returns. | 1014 * times. Owned by caller, no references are kept when New() returns. |
| 1015 * \return Compiled script object (context independent; when run it | 1015 * \return Compiled script object (context independent; when run it |
| 1016 * will use the currently entered context). | 1016 * will use the currently entered context). |
| 1017 */ | 1017 */ |
| 1018 static Local<Script> New(Handle<String> source, | 1018 static Local<Script> New(Handle<String> source, |
| 1019 ScriptOrigin* origin = NULL, | 1019 ScriptOrigin* origin = NULL, |
| 1020 ScriptData* pre_data = NULL); | 1020 ScriptData* cached_data = NULL); |
| 1021 |
| 1022 /** |
| 1023 * Compiles the specified script (context-independent). |
| 1024 * |
| 1025 * \param source Script source code. |
| 1026 * \param origin Script origin, owned by caller, no references are kept |
| 1027 * when this function returns |
| 1028 * \param cached_data Cached ScriptData, as obtained from a previous run, or a |
| 1029 * pointer to where we should store it, or NULL if we shouldn't store it |
| 1030 * anywhere. Using cached_data speeds compilation if it's done multiple |
| 1031 * times. Owned by caller (ownership of the generated data will also be |
| 1032 * passed to the caller), no references are kept when this function returns. |
| 1033 * \return Compiled script object (context independent; when run it |
| 1034 * will use the currently entered context). |
| 1035 */ |
| 1036 static Local<Script> NewAndGenerateScriptDataIfNeeded( |
| 1037 Handle<String> source, ScriptOrigin* origin, ScriptData** cached_data); |
| 1021 | 1038 |
| 1022 /** | 1039 /** |
| 1023 * Compiles the specified script using the specified file name | 1040 * Compiles the specified script using the specified file name |
| 1024 * object (typically a string) as the script's origin. | 1041 * object (typically a string) as the script's origin. |
| 1025 * | 1042 * |
| 1026 * \param source Script source code. | 1043 * \param source Script source code. |
| 1027 * \param file_name file name object (typically a string) to be used | 1044 * \param file_name file name object (typically a string) to be used |
| 1028 * as the script's origin. | 1045 * as the script's origin. |
| 1029 * \return Compiled script object (context independent; when run it | 1046 * \return Compiled script object (context independent; when run it |
| 1030 * will use the currently entered context). | 1047 * will use the currently entered context). |
| 1031 */ | 1048 */ |
| 1032 static Local<Script> New(Handle<String> source, | 1049 static Local<Script> New(Handle<String> source, |
| 1033 Handle<Value> file_name); | 1050 Handle<Value> file_name); |
| 1034 | 1051 |
| 1035 /** | 1052 /** |
| 1036 * Compiles the specified script (bound to current context). | 1053 * Compiles the specified script (bound to current context). |
| 1037 * | 1054 * |
| 1038 * \param source Script source code. | 1055 * \param source Script source code. |
| 1039 * \param origin Script origin, owned by caller, no references are kept | 1056 * \param origin Script origin, owned by caller, no references are kept |
| 1040 * when Compile() returns | 1057 * when Compile() returns |
| 1041 * \param pre_data Pre-parsing data, as obtained by ScriptData::PreCompile() | 1058 * \param cached_data Cached ScriptData, as obtained from a previous run. |
| 1042 * using pre_data speeds compilation if it's done multiple times. | 1059 * Using cached_data speeds compilation if it's done multiple times. |
| 1043 * Owned by caller, no references are kept when Compile() returns. | 1060 * Owned by caller, no references are kept when Compile() returns. |
| 1044 * \return Compiled script object, bound to the context that was active | 1061 * \return Compiled script object, bound to the context that was active |
| 1045 * when this function was called. When run it will always use this | 1062 * when this function was called. When run it will always use this |
| 1046 * context. | 1063 * context. |
| 1047 */ | 1064 */ |
| 1048 static Local<Script> Compile(Handle<String> source, | 1065 static Local<Script> Compile(Handle<String> source, |
| 1049 ScriptOrigin* origin = NULL, | 1066 ScriptOrigin* origin = NULL, |
| 1050 ScriptData* pre_data = NULL); | 1067 ScriptData* cached_data = NULL); |
| 1051 | 1068 |
| 1052 /** | 1069 /** |
| 1070 * Compiles the specified script (bound to current context). |
| 1071 * |
| 1072 * \param source Script source code. |
| 1073 * \param origin Script origin, owned by caller, no references are kept |
| 1074 * when this function returns |
| 1075 * \param cached_data Cached ScriptData, as obtained from a previous run, or a |
| 1076 * pointer to where to store we don't have it yet, or NULL if we should not |
| 1077 * generate it. Using cached_data speeds compilation if it's done multiple |
| 1078 * times. Owned by caller (ownership of the generated data will also be |
| 1079 * passed to the caller), no references are kept when this function returns. |
| 1080 * \param extra_data Arbitrary data associated with script. Using |
| 1081 * this has same effect as calling SetData(), but makes data available |
| 1082 * earlier (i.e. to compile event handlers). |
| 1083 * \return Compiled script object, bound to the context that was active |
| 1084 * when this function was called. When run it will always use this |
| 1085 * context. |
| 1086 */ |
| 1087 static Local<Script> CompileAndGenerateScriptDataIfNeeded( |
| 1088 Handle<String> source, ScriptOrigin* origin = NULL, |
| 1089 ScriptData** cached_data = NULL); |
| 1090 |
| 1091 /** |
| 1053 * Compiles the specified script using the specified file name | 1092 * Compiles the specified script using the specified file name |
| 1054 * object (typically a string) as the script's origin. | 1093 * object (typically a string) as the script's origin. |
| 1055 * | 1094 * |
| 1056 * \param source Script source code. | 1095 * \param source Script source code. |
| 1057 * \param file_name File name to use as script's origin | 1096 * \param file_name File name to use as script's origin |
| 1058 * \return Compiled script object, bound to the context that was active | 1097 * \return Compiled script object, bound to the context that was active |
| 1059 * when this function was called. When run it will always use this | 1098 * when this function was called. When run it will always use this |
| 1060 * context. | 1099 * context. |
| 1061 */ | 1100 */ |
| 1062 static Local<Script> Compile(Handle<String> source, | 1101 static Local<Script> Compile(Handle<String> source, |
| (...skipping 5443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6506 */ | 6545 */ |
| 6507 | 6546 |
| 6508 | 6547 |
| 6509 } // namespace v8 | 6548 } // namespace v8 |
| 6510 | 6549 |
| 6511 | 6550 |
| 6512 #undef TYPE_CHECK | 6551 #undef TYPE_CHECK |
| 6513 | 6552 |
| 6514 | 6553 |
| 6515 #endif // V8_H_ | 6554 #endif // V8_H_ |
| OLD | NEW |