OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 #define V8EXPORT __attribute__ ((visibility("default"))) | 59 #define V8EXPORT __attribute__ ((visibility("default"))) |
60 #else // defined(__GNUC__) && (__GNUC__ >= 4) | 60 #else // defined(__GNUC__) && (__GNUC__ >= 4) |
61 #define V8EXPORT | 61 #define V8EXPORT |
62 #endif // defined(__GNUC__) && (__GNUC__ >= 4) | 62 #endif // defined(__GNUC__) && (__GNUC__ >= 4) |
63 | 63 |
64 #endif // _WIN32 | 64 #endif // _WIN32 |
65 | 65 |
66 | 66 |
67 namespace v8 { | 67 namespace v8 { |
68 | 68 |
69 | 69 // The result of preparsing is either a stack overflow error, or an opaque |
| 70 // blob of data that can be passed back into the parser. |
70 class V8EXPORT PreParserData { | 71 class V8EXPORT PreParserData { |
71 public: | 72 public: |
72 PreParserData(size_t size, const uint8_t* data) | 73 PreParserData(size_t size, const uint8_t* data) |
73 : data_(data), size_(size) { } | 74 : data_(data), size_(size) { } |
74 | 75 |
75 // Create a PreParserData value where stack_overflow reports true. | 76 // Create a PreParserData value where stack_overflow reports true. |
76 static PreParserData StackOverflow() { return PreParserData(0, NULL); } | 77 static PreParserData StackOverflow() { return PreParserData(0, NULL); } |
77 | 78 |
78 // Whether the pre-parser stopped due to a stack overflow. | 79 // Whether the pre-parser stopped due to a stack overflow. |
79 // If this is the case, size() and data() should not be used. | 80 // If this is the case, size() and data() should not be used. |
(...skipping 27 matching lines...) Expand all Loading... |
107 // space that the preparser is allowed to use. If the preparser uses | 108 // space that the preparser is allowed to use. If the preparser uses |
108 // more stack space than the limit provided, the result's stack_overflow() | 109 // more stack space than the limit provided, the result's stack_overflow() |
109 // method will return true. Otherwise the result contains preparser | 110 // method will return true. Otherwise the result contains preparser |
110 // data that can be used by the V8 parser to speed up parsing. | 111 // data that can be used by the V8 parser to speed up parsing. |
111 PreParserData V8EXPORT Preparse(UnicodeInputStream* input, | 112 PreParserData V8EXPORT Preparse(UnicodeInputStream* input, |
112 size_t max_stack_size); | 113 size_t max_stack_size); |
113 | 114 |
114 } // namespace v8. | 115 } // namespace v8. |
115 | 116 |
116 #endif // PREPARSER_H | 117 #endif // PREPARSER_H |
OLD | NEW |