access-builder.h 2.01 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
// Copyright 2014 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.

#ifndef V8_COMPILER_ACCESS_BUILDER_H_
#define V8_COMPILER_ACCESS_BUILDER_H_

#include "src/compiler/simplified-operator.h"

namespace v8 {
namespace internal {
namespace compiler {

// This access builder provides a set of static methods constructing commonly
// used FieldAccess and ElementAccess descriptors. These descriptors server as
// parameters to simplified load/store operators.
17
class AccessBuilder FINAL : public AllStatic {
18
 public:
19
  // Provides access to HeapObject::map() field.
20
  static FieldAccess ForMap();
21 22

  // Provides access to JSObject::properties() field.
23
  static FieldAccess ForJSObjectProperties();
24

25
  // Provides access to JSObject::elements() field.
26
  static FieldAccess ForJSObjectElements();
27

28 29 30
  // Provides access to JSFunction::context() field.
  static FieldAccess ForJSFunctionContext();

31
  // Provides access to JSArrayBuffer::backing_store() field.
32
  static FieldAccess ForJSArrayBufferBackingStore();
33

34
  // Provides access to ExternalArray::external_pointer() field.
35
  static FieldAccess ForExternalArrayPointer();
36

37 38 39
  // Provides access to Map::instance_type() field.
  static FieldAccess ForMapInstanceType();

40 41 42
  // Provides access to String::length() field.
  static FieldAccess ForStringLength();

43 44 45
  // Provides access to JSValue::value() field.
  static FieldAccess ForValue();

46 47 48
  // Provides access Context slots.
  static FieldAccess ForContextSlot(size_t index);

49
  // Provides access to FixedArray elements.
50
  static ElementAccess ForFixedArrayElement();
51

52 53
  // Provides access to Fixed{type}TypedArray and External{type}Array elements.
  static ElementAccess ForTypedArrayElement(ExternalArrayType type,
54
                                            bool is_external);
55 56

 private:
57
  DISALLOW_IMPLICIT_CONSTRUCTORS(AccessBuilder);
58 59 60 61 62 63 64
};

}  // namespace compiler
}  // namespace internal
}  // namespace v8

#endif  // V8_COMPILER_ACCESS_BUILDER_H_