Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(121)

Side by Side Diff: src/interface-descriptors.h

Issue 517993002: Refactoring InterfaceDescriptors away from code-stubs.h (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Ports. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/ia32/interface-descriptors-ia32.cc ('k') | src/interface-descriptors.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 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_CALL_INTERFACE_DESCRIPTOR_H_
6 #define V8_CALL_INTERFACE_DESCRIPTOR_H_
7
8 #include "src/assembler.h"
9 #include "src/macro-assembler.h"
10
11 namespace v8 {
12 namespace internal {
13
14 class PlatformInterfaceDescriptor;
15
16 class InterfaceDescriptor {
17 public:
18 bool IsInitialized() const { return register_param_count_ >= 0; }
19
20 int GetEnvironmentLength() const { return register_param_count_; }
21
22 int GetRegisterParameterCount() const { return register_param_count_; }
23
24 Register GetParameterRegister(int index) const {
25 return register_params_[index];
26 }
27
28 Representation GetParameterRepresentation(int index) const {
29 DCHECK(index < register_param_count_);
30 if (register_param_representations_.get() == NULL) {
31 return Representation::Tagged();
32 }
33
34 return register_param_representations_[index];
35 }
36
37 // "Environment" versions of parameter functions. The first register
38 // parameter (context) is not included.
39 int GetEnvironmentParameterCount() const {
40 return GetEnvironmentLength() - 1;
41 }
42
43 Register GetEnvironmentParameterRegister(int index) const {
44 return GetParameterRegister(index + 1);
45 }
46
47 Representation GetEnvironmentParameterRepresentation(int index) const {
48 return GetParameterRepresentation(index + 1);
49 }
50
51 // Some platforms have extra information to associate with the descriptor.
52 PlatformInterfaceDescriptor* platform_specific_descriptor() const {
53 return platform_specific_descriptor_;
54 }
55
56 static const Register ContextRegister();
57
58 protected:
59 InterfaceDescriptor();
60 virtual ~InterfaceDescriptor() {}
61
62 void Initialize(int register_parameter_count, Register* registers,
63 Representation* register_param_representations,
64 PlatformInterfaceDescriptor* platform_descriptor = NULL);
65
66 private:
67 int register_param_count_;
68
69 // The Register params are allocated dynamically by the
70 // InterfaceDescriptor, and freed on destruction. This is because static
71 // arrays of Registers cause creation of runtime static initializers
72 // which we don't want.
73 SmartArrayPointer<Register> register_params_;
74 // Specifies Representations for the stub's parameter. Points to an array of
75 // Representations of the same length of the numbers of parameters to the
76 // stub, or if NULL (the default value), Representation of each parameter
77 // assumed to be Tagged().
78 SmartArrayPointer<Representation> register_param_representations_;
79
80 PlatformInterfaceDescriptor* platform_specific_descriptor_;
81
82 DISALLOW_COPY_AND_ASSIGN(InterfaceDescriptor);
83 };
84
85
86 enum CallDescriptorKey {
87 KeyedCall,
88 NamedCall,
89 CallHandler,
90 ArgumentAdaptorCall,
91 ApiFunctionCall,
92 NUMBER_OF_CALL_DESCRIPTORS
93 };
94
95
96 class CallInterfaceDescriptor : public InterfaceDescriptor {
97 public:
98 CallInterfaceDescriptor() {}
99
100 // A copy of the passed in registers and param_representations is made
101 // and owned by the CallInterfaceDescriptor.
102
103 // TODO(mvstanton): Instead of taking parallel arrays register and
104 // param_representations, how about a struct that puts the representation
105 // and register side by side (eg, RegRep(r1, Representation::Tagged()).
106 // The same should go for the CodeStubInterfaceDescriptor class.
107 void Initialize(int register_parameter_count, Register* registers,
108 Representation* param_representations,
109 PlatformInterfaceDescriptor* platform_descriptor = NULL);
110 };
111
112
113 class CallDescriptors {
114 public:
115 static void InitializeForIsolate(Isolate* isolate);
116 };
117 }
118 } // namespace v8::internal
119
120 #if V8_TARGET_ARCH_ARM64
121 #include "src/arm64/interface-descriptors-arm64.h"
122 #elif V8_TARGET_ARCH_ARM
123 #include "src/arm/interface-descriptors-arm.h"
124 #endif
125
126 #endif // V8_CALL_INTERFACE_DESCRIPTOR_H_
OLDNEW
« no previous file with comments | « src/ia32/interface-descriptors-ia32.cc ('k') | src/interface-descriptors.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698