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 913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
924 /** | 924 /** |
925 * The superclass of values and API object templates. | 925 * The superclass of values and API object templates. |
926 */ | 926 */ |
927 class V8_EXPORT Data { | 927 class V8_EXPORT Data { |
928 private: | 928 private: |
929 Data(); | 929 Data(); |
930 }; | 930 }; |
931 | 931 |
932 | 932 |
933 /** | 933 /** |
934 * Pre-compilation data that can be associated with a script. This | |
935 * data can be calculated for a script in advance of actually | |
936 * compiling it, and can be stored between compilations. When script | |
937 * data is given to the compile method compilation will be faster. | |
938 */ | |
939 class V8_EXPORT ScriptData { // NOLINT | |
940 public: | |
941 virtual ~ScriptData() { } | |
942 | |
943 /** | |
944 * Pre-compiles the specified script (context-independent). | |
945 * | |
946 * NOTE: Pre-compilation using this method cannot happen on another thread | |
947 * without using Lockers. | |
948 * | |
949 * \param source Script source code. | |
950 */ | |
951 static ScriptData* PreCompile(Handle<String> source); | |
952 | |
953 /** | |
954 * Load previous pre-compilation data. | |
955 * | |
956 * \param data Pointer to data returned by a call to Data() of a previous | |
957 * ScriptData. Ownership is not transferred. | |
958 * \param length Length of data. | |
959 */ | |
960 static ScriptData* New(const char* data, int length); | |
961 | |
962 /** | |
963 * Returns the length of Data(). | |
964 */ | |
965 virtual int Length() = 0; | |
966 | |
967 /** | |
968 * Returns a serialized representation of this ScriptData that can later be | |
969 * passed to New(). NOTE: Serialized data is platform-dependent. | |
970 */ | |
971 virtual const char* Data() = 0; | |
972 | |
973 /** | |
974 * Returns true if the source code could not be parsed. | |
975 */ | |
976 virtual bool HasError() = 0; | |
977 }; | |
978 | |
979 | |
980 /** | |
981 * The origin, within a file, of a script. | 934 * The origin, within a file, of a script. |
982 */ | 935 */ |
983 class ScriptOrigin { | 936 class ScriptOrigin { |
984 public: | 937 public: |
985 V8_INLINE ScriptOrigin( | 938 V8_INLINE ScriptOrigin( |
986 Handle<Value> resource_name, | 939 Handle<Value> resource_name, |
987 Handle<Integer> resource_line_offset = Handle<Integer>(), | 940 Handle<Integer> resource_line_offset = Handle<Integer>(), |
988 Handle<Integer> resource_column_offset = Handle<Integer>(), | 941 Handle<Integer> resource_column_offset = Handle<Integer>(), |
989 Handle<Boolean> resource_is_shared_cross_origin = Handle<Boolean>()) | 942 Handle<Boolean> resource_is_shared_cross_origin = Handle<Boolean>()) |
990 : resource_name_(resource_name), | 943 : resource_name_(resource_name), |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1027 | 980 |
1028 | 981 |
1029 /** | 982 /** |
1030 * A compiled JavaScript script, tied to a Context which was active when the | 983 * A compiled JavaScript script, tied to a Context which was active when the |
1031 * script was compiled. | 984 * script was compiled. |
1032 */ | 985 */ |
1033 class V8_EXPORT Script { | 986 class V8_EXPORT Script { |
1034 public: | 987 public: |
1035 /** | 988 /** |
1036 * A shorthand for ScriptCompiler::Compile(). | 989 * A shorthand for ScriptCompiler::Compile(). |
1037 * The ScriptData parameter will be deprecated; use ScriptCompiler::Compile if | |
1038 * you want to pass it. | |
1039 */ | 990 */ |
1040 static Local<Script> Compile(Handle<String> source, | 991 static Local<Script> Compile(Handle<String> source, |
1041 ScriptOrigin* origin = NULL, | 992 ScriptOrigin* origin = NULL); |
1042 ScriptData* script_data = NULL); | |
1043 | 993 |
1044 // To be decprecated, use the Compile above. | 994 // To be decprecated, use the Compile above. |
1045 static Local<Script> Compile(Handle<String> source, | 995 static Local<Script> Compile(Handle<String> source, |
1046 Handle<String> file_name); | 996 Handle<String> file_name); |
1047 | 997 |
1048 /** | 998 /** |
1049 * Runs the script returning the resulting value. It will be run in the | 999 * Runs the script returning the resulting value. It will be run in the |
1050 * context in which it was created (ScriptCompiler::CompileBound or | 1000 * context in which it was created (ScriptCompiler::CompileBound or |
1051 * UnboundScript::BindToGlobalContext()). | 1001 * UnboundScript::BindToGlobalContext()). |
1052 */ | 1002 */ |
(...skipping 5633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6686 */ | 6636 */ |
6687 | 6637 |
6688 | 6638 |
6689 } // namespace v8 | 6639 } // namespace v8 |
6690 | 6640 |
6691 | 6641 |
6692 #undef TYPE_CHECK | 6642 #undef TYPE_CHECK |
6693 | 6643 |
6694 | 6644 |
6695 #endif // V8_H_ | 6645 #endif // V8_H_ |
OLD | NEW |