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

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

Issue 1239793002: [interpreter] Add basic framework for bytecode handler code generation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add comment to count macro. 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_IMPL_H_ 5 #ifndef V8_COMPILER_LINKAGE_IMPL_H_
6 #define V8_COMPILER_LINKAGE_IMPL_H_ 6 #define V8_COMPILER_LINKAGE_IMPL_H_
7 7
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/compiler/interpreter-assembler.h"
9 #include "src/compiler/osr.h" 10 #include "src/compiler/osr.h"
10 11
11 namespace v8 { 12 namespace v8 {
12 namespace internal { 13 namespace internal {
13 namespace compiler { 14 namespace compiler {
14 15
15 // TODO(titzer): replace uses of int with size_t in LinkageHelper. 16 // TODO(titzer): replace uses of int with size_t in LinkageHelper.
16 template <typename LinkageTraits> 17 template <typename LinkageTraits>
17 class LinkageHelper { 18 class LinkageHelper {
18 public: 19 public:
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 msig, // machine_sig 227 msig, // machine_sig
227 locations.Build(), // location_sig 228 locations.Build(), // location_sig
228 0, // js_parameter_count 229 0, // js_parameter_count
229 Operator::kNoProperties, // properties 230 Operator::kNoProperties, // properties
230 LinkageTraits::CCalleeSaveRegisters(), // callee-saved registers 231 LinkageTraits::CCalleeSaveRegisters(), // callee-saved registers
231 LinkageTraits::CCalleeSaveFPRegisters(), // callee-saved fp regs 232 LinkageTraits::CCalleeSaveFPRegisters(), // callee-saved fp regs
232 CallDescriptor::kNoFlags, // flags 233 CallDescriptor::kNoFlags, // flags
233 "c-call"); 234 "c-call");
234 } 235 }
235 236
236 static CallDescriptor* GetInterpreterDispatchDescriptor( 237 static CallDescriptor* GetInterpreterDispatchDescriptor(Zone* zone,
237 Zone* zone, const MachineSignature* msig) { 238 bool will_return) {
238 DCHECK_EQ(0, msig->parameter_count()); 239 int return_count = will_return ? 1 : 0;
239 LocationSignature::Builder locations(zone, msig->return_count(), 240 MachineSignature::Builder types(zone, return_count, 2);
240 msig->parameter_count()); 241 LocationSignature::Builder locations(zone, return_count, 2);
241 AddReturnLocations(&locations); 242
243 // Add registers for fixed parameters passed via interpreter dispatch.
244 DCHECK_EQ(0, InterpreterAssembler::kBytecodePointerParameter);
Michael Starzinger 2015/07/17 13:20:59 Would it make sense to move these constant (i.e. k
rmcilroy 2015/07/21 11:13:21 Works for me. Done.
245 types.AddParam(kMachPtr);
246 locations.AddParam(regloc(LinkageTraits::InterpreterBytecodePointerReg()));
247
248 DCHECK_EQ(1, InterpreterAssembler::kDispatchTablePointerParameter);
249 types.AddParam(kMachPtr);
250 locations.AddParam(regloc(LinkageTraits::InterpreterDispatchTableReg()));
251
252 if (will_return) {
Michael Starzinger 2015/07/17 13:20:58 The boolean "will_return" flag here makes me nervo
rmcilroy 2015/07/21 11:13:21 Based on a suggestion from @danno I reworked this
Michael Starzinger 2015/07/21 13:51:45 Acknowledged. Yep, much better, I like.
253 types.AddReturn(kMachAnyTagged);
254 AddReturnLocations(&locations);
255 }
256
242 LinkageLocation target_loc = LinkageLocation::AnyRegister(); 257 LinkageLocation target_loc = LinkageLocation::AnyRegister();
243 return new (zone) CallDescriptor( // -- 258 return new (zone) CallDescriptor( // --
244 CallDescriptor::kInterpreterDispatch, // kind 259 CallDescriptor::kInterpreterDispatch, // kind
245 kMachNone, // target MachineType 260 kMachNone, // target MachineType
246 target_loc, // target location 261 target_loc, // target location
247 msig, // machine_sig 262 types.Build(), // machine_sig
248 locations.Build(), // location_sig 263 locations.Build(), // location_sig
249 0, // js_parameter_count 264 0, // js_parameter_count
250 Operator::kNoProperties, // properties 265 Operator::kNoProperties, // properties
251 kNoCalleeSaved, // callee-saved registers 266 kNoCalleeSaved, // callee-saved registers
252 kNoCalleeSaved, // callee-saved fp regs 267 kNoCalleeSaved, // callee-saved fp regs
253 CallDescriptor::kSupportsTailCalls, // flags 268 CallDescriptor::kSupportsTailCalls, // flags
254 "interpreter-dispatch"); 269 "interpreter-dispatch");
255 } 270 }
256 271
257 static LinkageLocation regloc(Register reg) { 272 static LinkageLocation regloc(Register reg) {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 int parameter_index = 1 + index; // skip index 0, which is the target. 330 int parameter_index = 1 + index; // skip index 0, which is the target.
316 return incoming_->GetInputLocation(parameter_index); 331 return incoming_->GetInputLocation(parameter_index);
317 } 332 }
318 } 333 }
319 334
320 } // namespace compiler 335 } // namespace compiler
321 } // namespace internal 336 } // namespace internal
322 } // namespace v8 337 } // namespace v8
323 338
324 #endif // V8_COMPILER_LINKAGE_IMPL_H_ 339 #endif // V8_COMPILER_LINKAGE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698