| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 | 66 |
| 67 namespace v8 { | 67 namespace v8 { |
| 68 | 68 |
| 69 | 69 |
| 70 class PreParserData { | 70 class PreParserData { |
| 71 public: | 71 public: |
| 72 PreParserData(size_t size, const uint8_t* data) | 72 PreParserData(size_t size, const uint8_t* data) |
| 73 : data_(data), size_(size) { } | 73 : data_(data), size_(size) { } |
| 74 | 74 |
| 75 // Create a PreParserData value where stack_overflow reports true. | 75 // Create a PreParserData value where stack_overflow reports true. |
| 76 static PreParserData StackOverflow() { return PreParserData(NULL, 0); } | 76 static PreParserData StackOverflow() { return PreParserData(0, 0); } |
| 77 // Whether the pre-parser stopped due to a stack overflow. | 77 // Whether the pre-parser stopped due to a stack overflow. |
| 78 // If this is the case, size() and data() should not be used. | 78 // If this is the case, size() and data() should not be used. |
| 79 | 79 |
| 80 bool stack_overflow() { return size_ == 0u; } | 80 bool stack_overflow() { return size_ == 0u; } |
| 81 | 81 |
| 82 // The size of the data in bytes. | 82 // The size of the data in bytes. |
| 83 size_t size() const { return size_; } | 83 size_t size() const { return size_; } |
| 84 | 84 |
| 85 // Pointer to the data. | 85 // Pointer to the data. |
| 86 const uint8_t* data() const { return data_; } | 86 const uint8_t* data() const { return data_; } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 107 // space that the preparser is allowed to use. If the preparser uses | 107 // 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() | 108 // more stack space than the limit provided, the result's stack_overflow() |
| 109 // method will return true. Otherwise the result contains preparser | 109 // method will return true. Otherwise the result contains preparser |
| 110 // data that can be used by the V8 parser to speed up parsing. | 110 // data that can be used by the V8 parser to speed up parsing. |
| 111 PreParserData V8EXPORT Preparse(UnicodeInputStream* input, | 111 PreParserData V8EXPORT Preparse(UnicodeInputStream* input, |
| 112 size_t max_stack_size); | 112 size_t max_stack_size); |
| 113 | 113 |
| 114 } // namespace v8. | 114 } // namespace v8. |
| 115 | 115 |
| 116 #endif // PREPARSER_H | 116 #endif // PREPARSER_H |
| OLD | NEW |