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

Side by Side Diff: src/compiler/linkage.h

Issue 1205023002: [turbofan] Add basic support for calling to (a subset of) C functions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix argument slots. Created 5 years, 5 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
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_COMPILER_LINKAGE_H_ 5 #ifndef V8_COMPILER_LINKAGE_H_
6 #define V8_COMPILER_LINKAGE_H_ 6 #define V8_COMPILER_LINKAGE_H_
7 7
8 #include "src/base/flags.h" 8 #include "src/base/flags.h"
9 #include "src/compiler/frame.h" 9 #include "src/compiler/frame.h"
10 #include "src/compiler/machine-type.h" 10 #include "src/compiler/machine-type.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 callee_saved_registers_(callee_saved_registers), 95 callee_saved_registers_(callee_saved_registers),
96 flags_(flags), 96 flags_(flags),
97 debug_name_(debug_name) { 97 debug_name_(debug_name) {
98 DCHECK(machine_sig->return_count() == location_sig->return_count()); 98 DCHECK(machine_sig->return_count() == location_sig->return_count());
99 DCHECK(machine_sig->parameter_count() == location_sig->parameter_count()); 99 DCHECK(machine_sig->parameter_count() == location_sig->parameter_count());
100 } 100 }
101 101
102 // Returns the kind of this call. 102 // Returns the kind of this call.
103 Kind kind() const { return kind_; } 103 Kind kind() const { return kind_; }
104 104
105 // Returns {true} if this descriptor is a call to a C function.
106 bool IsCFunctionCall() const { return kind_ == kCallAddress; }
107
105 // Returns {true} if this descriptor is a call to a JSFunction. 108 // Returns {true} if this descriptor is a call to a JSFunction.
106 bool IsJSFunctionCall() const { return kind_ == kCallJSFunction; } 109 bool IsJSFunctionCall() const { return kind_ == kCallJSFunction; }
107 110
108 // The number of return values from this call. 111 // The number of return values from this call.
109 size_t ReturnCount() const { return machine_sig_->return_count(); } 112 size_t ReturnCount() const { return machine_sig_->return_count(); }
110 113
114 // The number of C parameters to this call.
115 size_t CParameterCount() const { return machine_sig_->parameter_count(); }
116
111 // The number of JavaScript parameters to this call, including the receiver 117 // The number of JavaScript parameters to this call, including the receiver
112 // object. 118 // object.
113 size_t JSParameterCount() const { return js_param_count_; } 119 size_t JSParameterCount() const { return js_param_count_; }
114 120
115 // The total number of inputs to this call, which includes the target, 121 // The total number of inputs to this call, which includes the target,
116 // receiver, context, etc. 122 // receiver, context, etc.
117 // TODO(titzer): this should input the framestate input too. 123 // TODO(titzer): this should input the framestate input too.
118 size_t InputCount() const { return 1 + machine_sig_->parameter_count(); } 124 size_t InputCount() const { return 1 + machine_sig_->parameter_count(); }
119 125
120 size_t FrameStateCount() const { return NeedsFrameState() ? 1 : 0; } 126 size_t FrameStateCount() const { return NeedsFrameState() ? 1 : 0; }
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 CallDescriptor* const incoming_; 263 CallDescriptor* const incoming_;
258 264
259 DISALLOW_COPY_AND_ASSIGN(Linkage); 265 DISALLOW_COPY_AND_ASSIGN(Linkage);
260 }; 266 };
261 267
262 } // namespace compiler 268 } // namespace compiler
263 } // namespace internal 269 } // namespace internal
264 } // namespace v8 270 } // namespace v8
265 271
266 #endif // V8_COMPILER_LINKAGE_H_ 272 #endif // V8_COMPILER_LINKAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698