preparse-data-format.h 1.21 KB
Newer Older
1
// Copyright 2011 the V8 project authors. All rights reserved.
2 3
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
4 5 6 7 8 9 10 11 12 13 14 15 16

#ifndef V8_PREPARSE_DATA_FORMAT_H_
#define V8_PREPARSE_DATA_FORMAT_H_

namespace v8 {
namespace internal {

// Generic and general data used by preparse data recorders and readers.

struct PreparseDataConstants {
 public:
  // Layout and constants of the preparse data exchange format.
  static const unsigned kMagicNumber = 0xBadDead;
17
  static const unsigned kCurrentVersion = 11;
18 19 20 21 22

  static const int kMagicOffset = 0;
  static const int kVersionOffset = 1;
  static const int kHasErrorOffset = 2;
  static const int kFunctionsSizeOffset = 3;
23 24
  static const int kSizeOffset = 4;
  static const int kHeaderSize = 5;
25 26 27 28 29

  // If encoding a message, the following positions are fixed.
  static const int kMessageStartPos = 0;
  static const int kMessageEndPos = 1;
  static const int kMessageArgCountPos = 2;
30
  static const int kParseErrorTypePos = 3;
31 32
  static const int kMessageTemplatePos = 4;
  static const int kMessageArgPos = 5;
33 34 35 36 37

  static const unsigned char kNumberTerminator = 0x80u;
};


38 39
}  // namespace internal
}  // namespace v8.
40 41

#endif  // V8_PREPARSE_DATA_FORMAT_H_