templates.tq 3.13 KB
Newer Older
Tobias Tebbi's avatar
Tobias Tebbi committed
1 2 3 4 5 6
// 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
extern class TemplateInfo extends Struct {
7 8
  tag: Smi;
  serial_number: Smi;
Tobias Tebbi's avatar
Tobias Tebbi committed
9
  number_of_properties: Smi;
10 11
  property_list: TemplateList|Undefined;
  property_accessors: TemplateList|Undefined;
Tobias Tebbi's avatar
Tobias Tebbi committed
12 13 14 15
}

extern class FunctionTemplateRareData extends Struct {
  // See DECL_RARE_ACCESSORS in FunctionTemplateInfo.
16 17 18 19 20 21 22 23
  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;
24
  c_function_overloads: FixedArray;
25 26 27 28 29 30 31 32
}

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;
  accept_any_receiver: bool: 1 bit;
33
  published: bool: 1 bit;
34 35 36
  // Allowed receiver ranges are used for instance type checking to check
  // whether the receiver calling the associated JSFunction is a compatible
  // receiver.
37 38
  allowed_receiver_instance_type_range_start: int16: 12 bit;
  allowed_receiver_instance_type_range_end: int16: 12 bit;
Tobias Tebbi's avatar
Tobias Tebbi committed
39 40 41 42 43
}

extern class FunctionTemplateInfo extends TemplateInfo {
  // Handler invoked when calling an instance of this FunctionTemplateInfo.
  // Either CallHandlerInfo or Undefined.
44
  @cppAcquireLoad @cppReleaseStore call_code: CallHandlerInfo|Undefined;
45
  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 55
  @cppAcquireLoad
  @cppReleaseStore
56
  rare_data: FunctionTemplateRareData|Undefined;
57
  shared_function_info: SharedFunctionInfo|Undefined;
58
  // Internal field to store a flag bitfield.
59
  flag: SmiTagged<FunctionTemplateInfoFlags>;
60
  // "length" property of the final JSFunction.
Tobias Tebbi's avatar
Tobias Tebbi committed
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 68
  // This will be set as the instance type of the objects that are created from
  // this FunctionTemplateInfo.
  instance_type: Smi;
Tobias Tebbi's avatar
Tobias Tebbi committed
69 70
}

71 72
bitfield struct ObjectTemplateInfoFlags extends uint31 {
  is_immutable_prototype: bool: 1 bit;
73 74
  is_code_kind: bool: 1 bit;
  embedder_field_count: int32: 28 bit;
75 76
}

Tobias Tebbi's avatar
Tobias Tebbi committed
77
extern class ObjectTemplateInfo extends TemplateInfo {
78 79
  constructor: FunctionTemplateInfo|Undefined;
  data: SmiTagged<ObjectTemplateInfoFlags>;
Tobias Tebbi's avatar
Tobias Tebbi committed
80
}