• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 class AccessCompilerData {
17  public:
AccessCompilerData()18   AccessCompilerData() {}
19 
IsInitialized()20   bool IsInitialized() const { return load_calling_convention_ != nullptr; }
Initialize(int load_register_count,const Register * load_registers,int store_register_count,const Register * store_registers)21   void Initialize(int load_register_count, const Register* load_registers,
22                   int store_register_count, const Register* store_registers) {
23     load_calling_convention_.reset(NewArray<Register>(load_register_count));
24     for (int i = 0; i < load_register_count; ++i) {
25       load_calling_convention_[i] = load_registers[i];
26     }
27     store_calling_convention_.reset(NewArray<Register>(store_register_count));
28     for (int i = 0; i < store_register_count; ++i) {
29       store_calling_convention_[i] = store_registers[i];
30     }
31   }
32 
load_calling_convention()33   Register* load_calling_convention() { return load_calling_convention_.get(); }
store_calling_convention()34   Register* store_calling_convention() {
35     return store_calling_convention_.get();
36   }
37 
38  private:
39   std::unique_ptr<Register[]> load_calling_convention_;
40   std::unique_ptr<Register[]> store_calling_convention_;
41 
42   DISALLOW_COPY_AND_ASSIGN(AccessCompilerData);
43 };
44 
45 }  // namespace internal
46 }  // namespace v8
47 
48 #endif  // V8_IC_ACCESS_COMPILER_DATA_H_
49