Line data Source code
1 : // Copyright 2016 the V8 project authors. All rights reserved.
2 : // Use of this source code is governed by a BSD-style license that can be
3 : // found in the LICENSE file.
4 :
5 : #ifndef V8_IC_ACCESS_COMPILER_DATA_H_
6 : #define V8_IC_ACCESS_COMPILER_DATA_H_
7 :
8 : #include <memory>
9 :
10 : #include "src/allocation.h"
11 : #include "src/base/macros.h"
12 :
13 : namespace v8 {
14 : namespace internal {
15 :
16 106730 : class AccessCompilerData {
17 : public:
18 54999 : AccessCompilerData() {}
19 :
20 : bool IsInitialized() const { return load_calling_convention_ != nullptr; }
21 3960 : void Initialize(int load_register_count, const Register* load_registers,
22 : int store_register_count, const Register* store_registers) {
23 : load_calling_convention_.reset(
24 3960 : NewArray<Register>(load_register_count, no_reg));
25 19800 : for (int i = 0; i < load_register_count; ++i) {
26 39600 : load_calling_convention_[i] = load_registers[i];
27 : }
28 : store_calling_convention_.reset(
29 3960 : NewArray<Register>(store_register_count, no_reg));
30 15840 : for (int i = 0; i < store_register_count; ++i) {
31 31680 : store_calling_convention_[i] = store_registers[i];
32 : }
33 3960 : }
34 :
35 : Register* load_calling_convention() { return load_calling_convention_.get(); }
36 : Register* store_calling_convention() {
37 : return store_calling_convention_.get();
38 : }
39 :
40 : private:
41 : std::unique_ptr<Register[]> load_calling_convention_;
42 : std::unique_ptr<Register[]> store_calling_convention_;
43 :
44 : DISALLOW_COPY_AND_ASSIGN(AccessCompilerData);
45 : };
46 :
47 : } // namespace internal
48 : } // namespace v8
49 :
50 : #endif // V8_IC_ACCESS_COMPILER_DATA_H_
|