Ben Murdoch | 3fb3ca8 | 2011-12-02 17:19:32 +0000 | [diff] [blame] | 1 | // Copyright 2011 the V8 project authors. All rights reserved. |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
Steve Block | 8defd9f | 2010-07-08 12:39:36 +0100 | [diff] [blame] | 4 | |
Ben Murdoch | 257744e | 2011-11-30 15:57:28 +0000 | [diff] [blame] | 5 | #ifndef V8_PREPARSE_DATA_FORMAT_H_ |
| 6 | #define V8_PREPARSE_DATA_FORMAT_H_ |
Steve Block | 8defd9f | 2010-07-08 12:39:36 +0100 | [diff] [blame] | 7 | |
| 8 | namespace v8 { |
| 9 | namespace internal { |
| 10 | |
Ben Murdoch | 257744e | 2011-11-30 15:57:28 +0000 | [diff] [blame] | 11 | // Generic and general data used by preparse data recorders and readers. |
Steve Block | 8defd9f | 2010-07-08 12:39:36 +0100 | [diff] [blame] | 12 | |
Ben Murdoch | 257744e | 2011-11-30 15:57:28 +0000 | [diff] [blame] | 13 | struct PreparseDataConstants { |
| 14 | public: |
| 15 | // Layout and constants of the preparse data exchange format. |
| 16 | static const unsigned kMagicNumber = 0xBadDead; |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 17 | static const unsigned kCurrentVersion = 9; |
Steve Block | 8defd9f | 2010-07-08 12:39:36 +0100 | [diff] [blame] | 18 | |
Ben Murdoch | 257744e | 2011-11-30 15:57:28 +0000 | [diff] [blame] | 19 | static const int kMagicOffset = 0; |
| 20 | static const int kVersionOffset = 1; |
| 21 | static const int kHasErrorOffset = 2; |
| 22 | static const int kFunctionsSizeOffset = 3; |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 23 | static const int kSizeOffset = 4; |
| 24 | static const int kHeaderSize = 5; |
Ben Murdoch | 257744e | 2011-11-30 15:57:28 +0000 | [diff] [blame] | 25 | |
| 26 | // If encoding a message, the following positions are fixed. |
| 27 | static const int kMessageStartPos = 0; |
| 28 | static const int kMessageEndPos = 1; |
| 29 | static const int kMessageArgCountPos = 2; |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 30 | static const int kIsReferenceErrorPos = 3; |
| 31 | static const int kMessageTextPos = 4; |
Ben Murdoch | 257744e | 2011-11-30 15:57:28 +0000 | [diff] [blame] | 32 | |
| 33 | static const unsigned char kNumberTerminator = 0x80u; |
| 34 | }; |
| 35 | |
| 36 | |
| 37 | } } // namespace v8::internal. |
| 38 | |
| 39 | #endif // V8_PREPARSE_DATA_FORMAT_H_ |