OLD | NEW |
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 #include "src/ast/scopes.h" | 5 #include "src/ast/scopes.h" |
6 #include "src/code-stubs.h" | 6 #include "src/code-stubs.h" |
7 #include "src/compiler.h" | 7 #include "src/compiler.h" |
8 #include "src/compiler/common-operator.h" | 8 #include "src/compiler/common-operator.h" |
9 #include "src/compiler/frame.h" | 9 #include "src/compiler/frame.h" |
10 #include "src/compiler/linkage.h" | 10 #include "src/compiler/linkage.h" |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 CallDescriptor::kCanUseRoots | // flags | 402 CallDescriptor::kCanUseRoots | // flags |
403 flags, // flags | 403 flags, // flags |
404 descriptor.DebugName(isolate)); | 404 descriptor.DebugName(isolate)); |
405 } | 405 } |
406 | 406 |
407 CallDescriptor* Linkage::GetBytecodeDispatchCallDescriptor( | 407 CallDescriptor* Linkage::GetBytecodeDispatchCallDescriptor( |
408 Isolate* isolate, Zone* zone, const CallInterfaceDescriptor& descriptor, | 408 Isolate* isolate, Zone* zone, const CallInterfaceDescriptor& descriptor, |
409 int stack_parameter_count) { | 409 int stack_parameter_count) { |
410 const int register_parameter_count = descriptor.GetRegisterParameterCount(); | 410 const int register_parameter_count = descriptor.GetRegisterParameterCount(); |
411 const int parameter_count = register_parameter_count + stack_parameter_count; | 411 const int parameter_count = register_parameter_count + stack_parameter_count; |
412 const int context_count = 1; | |
413 const size_t parameter_and_context_count = | |
414 static_cast<size_t>(parameter_count + context_count); | |
415 | 412 |
416 LocationSignature::Builder locations(zone, 0, parameter_and_context_count); | 413 LocationSignature::Builder locations(zone, 0, parameter_count); |
417 MachineSignature::Builder types(zone, 0, parameter_and_context_count); | 414 MachineSignature::Builder types(zone, 0, parameter_count); |
418 | 415 |
419 // Add parameters in registers and on the stack. | 416 // Add parameters in registers and on the stack. |
420 for (int i = 0; i < parameter_count; i++) { | 417 for (int i = 0; i < parameter_count; i++) { |
421 if (i < register_parameter_count) { | 418 if (i < register_parameter_count) { |
422 // The first parameters go in registers. | 419 // The first parameters go in registers. |
423 Register reg = descriptor.GetRegisterParameter(i); | 420 Register reg = descriptor.GetRegisterParameter(i); |
424 Representation rep = | 421 Representation rep = |
425 RepresentationFromType(descriptor.GetParameterType(i)); | 422 RepresentationFromType(descriptor.GetParameterType(i)); |
426 locations.AddParam(regloc(reg)); | 423 locations.AddParam(regloc(reg)); |
427 types.AddParam(reptyp(rep)); | 424 types.AddParam(reptyp(rep)); |
428 } else { | 425 } else { |
429 // The rest of the parameters go on the stack. | 426 // The rest of the parameters go on the stack. |
430 int stack_slot = i - register_parameter_count - stack_parameter_count; | 427 int stack_slot = i - register_parameter_count - stack_parameter_count; |
431 locations.AddParam(LinkageLocation::ForCallerFrameSlot(stack_slot)); | 428 locations.AddParam(LinkageLocation::ForCallerFrameSlot(stack_slot)); |
432 types.AddParam(MachineType::AnyTagged()); | 429 types.AddParam(MachineType::AnyTagged()); |
433 } | 430 } |
434 } | 431 } |
435 // Add context. | |
436 locations.AddParam(regloc(kContextRegister)); | |
437 types.AddParam(MachineType::AnyTagged()); | |
438 | 432 |
439 // The target for interpreter dispatches is a code entry address. | 433 // The target for interpreter dispatches is a code entry address. |
440 MachineType target_type = MachineType::Pointer(); | 434 MachineType target_type = MachineType::Pointer(); |
441 LinkageLocation target_loc = LinkageLocation::ForAnyRegister(); | 435 LinkageLocation target_loc = LinkageLocation::ForAnyRegister(); |
442 return new (zone) CallDescriptor( // -- | 436 return new (zone) CallDescriptor( // -- |
443 CallDescriptor::kCallAddress, // kind | 437 CallDescriptor::kCallAddress, // kind |
444 target_type, // target MachineType | 438 target_type, // target MachineType |
445 target_loc, // target location | 439 target_loc, // target location |
446 types.Build(), // machine_sig | 440 types.Build(), // machine_sig |
447 locations.Build(), // location_sig | 441 locations.Build(), // location_sig |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 } else { | 488 } else { |
495 DCHECK(loc == regloc(kContextRegister)); | 489 DCHECK(loc == regloc(kContextRegister)); |
496 return LinkageLocation::ForCalleeFrameSlot(Frame::kContextSlot); | 490 return LinkageLocation::ForCalleeFrameSlot(Frame::kContextSlot); |
497 } | 491 } |
498 } | 492 } |
499 | 493 |
500 | 494 |
501 } // namespace compiler | 495 } // namespace compiler |
502 } // namespace internal | 496 } // namespace internal |
503 } // namespace v8 | 497 } // namespace v8 |
OLD | NEW |