templates.tq 2.79 KB
Newer Older
Tobias Tebbi's avatar
Tobias Tebbi committed
1 2 3 4 5 6 7
// Copyright 2019 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

@abstract
@generateCppClass
extern class TemplateInfo extends Struct {
8 9
  tag: Smi;
  serial_number: Smi;
Tobias Tebbi's avatar
Tobias Tebbi committed
10
  number_of_properties: Smi;
11 12
  property_list: TemplateList|Undefined;
  property_accessors: TemplateList|Undefined;
Tobias Tebbi's avatar
Tobias Tebbi committed
13 14 15
}

@generateCppClass
16
@generatePrint
Tobias Tebbi's avatar
Tobias Tebbi committed
17 18
extern class FunctionTemplateRareData extends Struct {
  // See DECL_RARE_ACCESSORS in FunctionTemplateInfo.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
  prototype_template: ObjectTemplateInfo|Undefined;
  prototype_provider_template: FunctionTemplateInfo|Undefined;
  parent_template: FunctionTemplateInfo|Undefined;
  named_property_handler: InterceptorInfo|Undefined;
  indexed_property_handler: InterceptorInfo|Undefined;
  instance_template: ObjectTemplateInfo|Undefined;
  instance_call_handler: CallHandlerInfo|Undefined;
  access_check_info: AccessCheckInfo|Undefined;
  c_function: Foreign|Zero;
  c_signature: Foreign|Zero;
}

bitfield struct FunctionTemplateInfoFlags extends uint31 {
  undetectable: bool: 1 bit;
  needs_access_check: bool: 1 bit;
  read_only_prototype: bool: 1 bit;
  remove_prototype: bool: 1 bit;
  do_not_cache: bool: 1 bit;
  accept_any_receiver: bool: 1 bit;
Tobias Tebbi's avatar
Tobias Tebbi committed
38 39 40 41 42 43
}

@generateCppClass
extern class FunctionTemplateInfo extends TemplateInfo {
  // Handler invoked when calling an instance of this FunctionTemplateInfo.
  // Either CallHandlerInfo or Undefined.
44 45
  call_code: CallHandlerInfo|Undefined;
  class_name: String|Undefined;
Tobias Tebbi's avatar
Tobias Tebbi committed
46 47 48 49
  // If the signature is a FunctionTemplateInfo it is used to check whether the
  // receiver calling the associated JSFunction is a compatible receiver, i.e.
  // it is an instance of the signature FunctionTemplateInfo or any of the
  // receiver's prototypes are.
50
  signature: FunctionTemplateInfo|Undefined;
Tobias Tebbi's avatar
Tobias Tebbi committed
51 52 53
  // If any of the setters declared by DECL_RARE_ACCESSORS are used then a
  // FunctionTemplateRareData will be stored here. Until then this contains
  // undefined.
54
  @acquireRead @releaseWrite rare_data: FunctionTemplateRareData|Undefined;
55
  shared_function_info: SharedFunctionInfo|Undefined;
56
  // Internal field to store a flag bitfield.
57
  flag: SmiTagged<FunctionTemplateInfoFlags>;
58
  // "length" property of the final JSFunction.
Tobias Tebbi's avatar
Tobias Tebbi committed
59 60 61 62 63 64 65
  length: Smi;
  // Either the_hole or a private symbol. Used to cache the result on
  // the receiver under the the cached_property_name when this
  // FunctionTemplateInfo is used as a getter.
  cached_property_name: Object;
}

66 67
bitfield struct ObjectTemplateInfoFlags extends uint31 {
  is_immutable_prototype: bool: 1 bit;
68 69
  is_code_kind: bool: 1 bit;
  embedder_field_count: int32: 28 bit;
70 71
}

Tobias Tebbi's avatar
Tobias Tebbi committed
72 73
@generateCppClass
extern class ObjectTemplateInfo extends TemplateInfo {
74 75
  constructor: FunctionTemplateInfo|Undefined;
  data: SmiTagged<ObjectTemplateInfoFlags>;
Tobias Tebbi's avatar
Tobias Tebbi committed
76
}