13fb3ca8c7ca439d408449a395897395c0faae8d1Ben Murdoch// Copyright 2011 the V8 project authors. All rights reserved.
23100271588b61cbc1dc472a3f2f105d2eed8497fAndrei Popescu// Redistribution and use in source and binary forms, with or without
33100271588b61cbc1dc472a3f2f105d2eed8497fAndrei Popescu// modification, are permitted provided that the following conditions are
43100271588b61cbc1dc472a3f2f105d2eed8497fAndrei Popescu// met:
53100271588b61cbc1dc472a3f2f105d2eed8497fAndrei Popescu//
63100271588b61cbc1dc472a3f2f105d2eed8497fAndrei Popescu//     * Redistributions of source code must retain the above copyright
73100271588b61cbc1dc472a3f2f105d2eed8497fAndrei Popescu//       notice, this list of conditions and the following disclaimer.
83100271588b61cbc1dc472a3f2f105d2eed8497fAndrei Popescu//     * Redistributions in binary form must reproduce the above
93100271588b61cbc1dc472a3f2f105d2eed8497fAndrei Popescu//       copyright notice, this list of conditions and the following
103100271588b61cbc1dc472a3f2f105d2eed8497fAndrei Popescu//       disclaimer in the documentation and/or other materials provided
113100271588b61cbc1dc472a3f2f105d2eed8497fAndrei Popescu//       with the distribution.
123100271588b61cbc1dc472a3f2f105d2eed8497fAndrei Popescu//     * Neither the name of Google Inc. nor the names of its
133100271588b61cbc1dc472a3f2f105d2eed8497fAndrei Popescu//       contributors may be used to endorse or promote products derived
143100271588b61cbc1dc472a3f2f105d2eed8497fAndrei Popescu//       from this software without specific prior written permission.
153100271588b61cbc1dc472a3f2f105d2eed8497fAndrei Popescu//
163100271588b61cbc1dc472a3f2f105d2eed8497fAndrei Popescu// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
173100271588b61cbc1dc472a3f2f105d2eed8497fAndrei Popescu// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
183100271588b61cbc1dc472a3f2f105d2eed8497fAndrei Popescu// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
193100271588b61cbc1dc472a3f2f105d2eed8497fAndrei Popescu// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
203100271588b61cbc1dc472a3f2f105d2eed8497fAndrei Popescu// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
213100271588b61cbc1dc472a3f2f105d2eed8497fAndrei Popescu// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
223100271588b61cbc1dc472a3f2f105d2eed8497fAndrei Popescu// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
233100271588b61cbc1dc472a3f2f105d2eed8497fAndrei Popescu// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
243100271588b61cbc1dc472a3f2f105d2eed8497fAndrei Popescu// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
253100271588b61cbc1dc472a3f2f105d2eed8497fAndrei Popescu// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
263100271588b61cbc1dc472a3f2f105d2eed8497fAndrei Popescu// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
273100271588b61cbc1dc472a3f2f105d2eed8497fAndrei Popescu
28257744e915dfc84d6d07a6b2accf8402d9ffc708Ben Murdoch#ifndef V8_PREPARSE_DATA_FORMAT_H_
29257744e915dfc84d6d07a6b2accf8402d9ffc708Ben Murdoch#define V8_PREPARSE_DATA_FORMAT_H_
303100271588b61cbc1dc472a3f2f105d2eed8497fAndrei Popescu
313100271588b61cbc1dc472a3f2f105d2eed8497fAndrei Popescunamespace v8 {
323100271588b61cbc1dc472a3f2f105d2eed8497fAndrei Popescunamespace internal {
333100271588b61cbc1dc472a3f2f105d2eed8497fAndrei Popescu
34257744e915dfc84d6d07a6b2accf8402d9ffc708Ben Murdoch// Generic and general data used by preparse data recorders and readers.
35257744e915dfc84d6d07a6b2accf8402d9ffc708Ben Murdoch
36257744e915dfc84d6d07a6b2accf8402d9ffc708Ben Murdochstruct PreparseDataConstants {
373100271588b61cbc1dc472a3f2f105d2eed8497fAndrei Popescu public:
38257744e915dfc84d6d07a6b2accf8402d9ffc708Ben Murdoch  // Layout and constants of the preparse data exchange format.
39257744e915dfc84d6d07a6b2accf8402d9ffc708Ben Murdoch  static const unsigned kMagicNumber = 0xBadDead;
403fb3ca8c7ca439d408449a395897395c0faae8d1Ben Murdoch  static const unsigned kCurrentVersion = 7;
41257744e915dfc84d6d07a6b2accf8402d9ffc708Ben Murdoch
42257744e915dfc84d6d07a6b2accf8402d9ffc708Ben Murdoch  static const int kMagicOffset = 0;
43257744e915dfc84d6d07a6b2accf8402d9ffc708Ben Murdoch  static const int kVersionOffset = 1;
44257744e915dfc84d6d07a6b2accf8402d9ffc708Ben Murdoch  static const int kHasErrorOffset = 2;
45257744e915dfc84d6d07a6b2accf8402d9ffc708Ben Murdoch  static const int kFunctionsSizeOffset = 3;
46257744e915dfc84d6d07a6b2accf8402d9ffc708Ben Murdoch  static const int kSymbolCountOffset = 4;
47257744e915dfc84d6d07a6b2accf8402d9ffc708Ben Murdoch  static const int kSizeOffset = 5;
48257744e915dfc84d6d07a6b2accf8402d9ffc708Ben Murdoch  static const int kHeaderSize = 6;
49257744e915dfc84d6d07a6b2accf8402d9ffc708Ben Murdoch
50257744e915dfc84d6d07a6b2accf8402d9ffc708Ben Murdoch  // If encoding a message, the following positions are fixed.
51257744e915dfc84d6d07a6b2accf8402d9ffc708Ben Murdoch  static const int kMessageStartPos = 0;
52257744e915dfc84d6d07a6b2accf8402d9ffc708Ben Murdoch  static const int kMessageEndPos = 1;
53257744e915dfc84d6d07a6b2accf8402d9ffc708Ben Murdoch  static const int kMessageArgCountPos = 2;
54257744e915dfc84d6d07a6b2accf8402d9ffc708Ben Murdoch  static const int kMessageTextPos = 3;
55257744e915dfc84d6d07a6b2accf8402d9ffc708Ben Murdoch
56257744e915dfc84d6d07a6b2accf8402d9ffc708Ben Murdoch  static const unsigned char kNumberTerminator = 0x80u;
573100271588b61cbc1dc472a3f2f105d2eed8497fAndrei Popescu};
583100271588b61cbc1dc472a3f2f105d2eed8497fAndrei Popescu
593100271588b61cbc1dc472a3f2f105d2eed8497fAndrei Popescu
60257744e915dfc84d6d07a6b2accf8402d9ffc708Ben Murdoch} }  // namespace v8::internal.
613100271588b61cbc1dc472a3f2f105d2eed8497fAndrei Popescu
62257744e915dfc84d6d07a6b2accf8402d9ffc708Ben Murdoch#endif  // V8_PREPARSE_DATA_FORMAT_H_
63