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 929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
940 /** | 940 /** |
941 * The superclass of values and API object templates. | 941 * The superclass of values and API object templates. |
942 */ | 942 */ |
943 class V8_EXPORT Data { | 943 class V8_EXPORT Data { |
944 private: | 944 private: |
945 Data(); | 945 Data(); |
946 }; | 946 }; |
947 | 947 |
948 | 948 |
949 /** | 949 /** |
950 * Pre-compilation data that can be associated with a script. This | |
951 * data can be calculated for a script in advance of actually | |
952 * compiling it, and can be stored between compilations. When script | |
953 * data is given to the compile method compilation will be faster. | |
954 */ | |
955 class V8_EXPORT ScriptData { // NOLINT | |
956 public: | |
957 virtual ~ScriptData() { } | |
958 | |
959 /** | |
960 * Pre-compiles the specified script (context-independent). | |
961 * | |
962 * NOTE: Pre-compilation using this method cannot happen on another thread | |
963 * without using Lockers. | |
964 * | |
965 * \param source Script source code. | |
966 */ | |
967 static ScriptData* PreCompile(Handle<String> source); | |
968 | |
969 /** | |
970 * Load previous pre-compilation data. | |
971 * | |
972 * \param data Pointer to data returned by a call to Data() of a previous | |
973 * ScriptData. Ownership is not transferred. | |
974 * \param length Length of data. | |
975 */ | |
976 static ScriptData* New(const char* data, int length); | |
977 | |
978 /** | |
979 * Returns the length of Data(). | |
980 */ | |
981 virtual int Length() = 0; | |
982 | |
983 /** | |
984 * Returns a serialized representation of this ScriptData that can later be | |
985 * passed to New(). NOTE: Serialized data is platform-dependent. | |
986 */ | |
987 virtual const char* Data() = 0; | |
988 | |
989 /** | |
990 * Returns true if the source code could not be parsed. | |
991 */ | |
992 virtual bool HasError() = 0; | |
993 }; | |
994 | |
995 | |
996 /** | |
997 * The origin, within a file, of a script. | 950 * The origin, within a file, of a script. |
998 */ | 951 */ |
999 class ScriptOrigin { | 952 class ScriptOrigin { |
1000 public: | 953 public: |
1001 V8_INLINE ScriptOrigin( | 954 V8_INLINE ScriptOrigin( |
1002 Handle<Value> resource_name, | 955 Handle<Value> resource_name, |
1003 Handle<Integer> resource_line_offset = Handle<Integer>(), | 956 Handle<Integer> resource_line_offset = Handle<Integer>(), |
1004 Handle<Integer> resource_column_offset = Handle<Integer>(), | 957 Handle<Integer> resource_column_offset = Handle<Integer>(), |
1005 Handle<Boolean> resource_is_shared_cross_origin = Handle<Boolean>()) | 958 Handle<Boolean> resource_is_shared_cross_origin = Handle<Boolean>()) |
1006 : resource_name_(resource_name), | 959 : resource_name_(resource_name), |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1043 | 996 |
1044 | 997 |
1045 /** | 998 /** |
1046 * A compiled JavaScript script, tied to a Context which was active when the | 999 * A compiled JavaScript script, tied to a Context which was active when the |
1047 * script was compiled. | 1000 * script was compiled. |
1048 */ | 1001 */ |
1049 class V8_EXPORT Script { | 1002 class V8_EXPORT Script { |
1050 public: | 1003 public: |
1051 /** | 1004 /** |
1052 * A shorthand for ScriptCompiler::Compile(). | 1005 * A shorthand for ScriptCompiler::Compile(). |
1053 * The ScriptData parameter will be deprecated; use ScriptCompiler::Compile if | |
1054 * you want to pass it. | |
1055 */ | 1006 */ |
1056 static Local<Script> Compile(Handle<String> source, | 1007 static Local<Script> Compile(Handle<String> source, |
1057 ScriptOrigin* origin = NULL, | 1008 ScriptOrigin* origin = NULL); |
1058 ScriptData* script_data = NULL); | |
1059 | 1009 |
1060 // To be decprecated, use the Compile above. | 1010 // To be decprecated, use the Compile above. |
1061 static Local<Script> Compile(Handle<String> source, | 1011 static Local<Script> Compile(Handle<String> source, |
1062 Handle<String> file_name); | 1012 Handle<String> file_name); |
1063 | 1013 |
1064 /** | 1014 /** |
1065 * Runs the script returning the resulting value. It will be run in the | 1015 * Runs the script returning the resulting value. It will be run in the |
1066 * context in which it was created (ScriptCompiler::CompileBound or | 1016 * context in which it was created (ScriptCompiler::CompileBound or |
1067 * UnboundScript::BindToGlobalContext()). | 1017 * UnboundScript::BindToGlobalContext()). |
1068 */ | 1018 */ |
(...skipping 5615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6684 */ | 6634 */ |
6685 | 6635 |
6686 | 6636 |
6687 } // namespace v8 | 6637 } // namespace v8 |
6688 | 6638 |
6689 | 6639 |
6690 #undef TYPE_CHECK | 6640 #undef TYPE_CHECK |
6691 | 6641 |
6692 | 6642 |
6693 #endif // V8_H_ | 6643 #endif // V8_H_ |
OLD | NEW |