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/code-stubs.h" | 5 #include "src/code-stubs.h" |
6 #include "src/compiler.h" | 6 #include "src/compiler.h" |
7 #include "src/compiler/common-operator.h" | 7 #include "src/compiler/common-operator.h" |
8 #include "src/compiler/linkage.h" | 8 #include "src/compiler/linkage.h" |
9 #include "src/compiler/node.h" | 9 #include "src/compiler/node.h" |
10 #include "src/compiler/osr.h" | 10 #include "src/compiler/osr.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 switch (k) { | 55 switch (k) { |
56 case CallDescriptor::kCallCodeObject: | 56 case CallDescriptor::kCallCodeObject: |
57 os << "Code"; | 57 os << "Code"; |
58 break; | 58 break; |
59 case CallDescriptor::kCallJSFunction: | 59 case CallDescriptor::kCallJSFunction: |
60 os << "JS"; | 60 os << "JS"; |
61 break; | 61 break; |
62 case CallDescriptor::kCallAddress: | 62 case CallDescriptor::kCallAddress: |
63 os << "Addr"; | 63 os << "Addr"; |
64 break; | 64 break; |
65 case CallDescriptor::kInterpreterDispatch: | |
66 os << "InterpreterDispatch"; | |
67 break; | |
68 } | 65 } |
69 return os; | 66 return os; |
70 } | 67 } |
71 | 68 |
72 | 69 |
73 std::ostream& operator<<(std::ostream& os, const CallDescriptor& d) { | 70 std::ostream& operator<<(std::ostream& os, const CallDescriptor& d) { |
74 // TODO(svenpanne) Output properties etc. and be less cryptic. | 71 // TODO(svenpanne) Output properties etc. and be less cryptic. |
75 return os << d.kind() << ":" << d.debug_name() << ":r" << d.ReturnCount() | 72 return os << d.kind() << ":" << d.debug_name() << ":r" << d.ReturnCount() |
76 << "j" << d.JSParameterCount() << "i" << d.InputCount() << "f" | 73 << "j" << d.JSParameterCount() << "i" << d.InputCount() << "f" |
77 << d.FrameStateCount() << "t" << d.SupportsTailCalls(); | 74 << d.FrameStateCount() << "t" << d.SupportsTailCalls(); |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 return new (zone) CallDescriptor( // -- | 380 return new (zone) CallDescriptor( // -- |
384 CallDescriptor::kCallJSFunction, // kind | 381 CallDescriptor::kCallJSFunction, // kind |
385 target_type, // target MachineType | 382 target_type, // target MachineType |
386 target_loc, // target location | 383 target_loc, // target location |
387 types.Build(), // machine_sig | 384 types.Build(), // machine_sig |
388 locations.Build(), // location_sig | 385 locations.Build(), // location_sig |
389 js_parameter_count, // stack_parameter_count | 386 js_parameter_count, // stack_parameter_count |
390 Operator::kNoProperties, // properties | 387 Operator::kNoProperties, // properties |
391 kNoCalleeSaved, // callee-saved | 388 kNoCalleeSaved, // callee-saved |
392 kNoCalleeSaved, // callee-saved fp | 389 kNoCalleeSaved, // callee-saved fp |
393 flags, // flags | 390 CallDescriptor::kCanUseRoots | // flags |
| 391 flags, // flags |
394 "js-call"); | 392 "js-call"); |
395 } | 393 } |
396 | 394 |
397 | 395 |
398 CallDescriptor* Linkage::GetInterpreterDispatchDescriptor(Zone* zone) { | 396 CallDescriptor* Linkage::GetInterpreterDispatchDescriptor(Zone* zone) { |
399 MachineSignature::Builder types(zone, 0, 3); | 397 MachineSignature::Builder types(zone, 0, 3); |
400 LocationSignature::Builder locations(zone, 0, 3); | 398 LocationSignature::Builder locations(zone, 0, 3); |
401 | 399 |
402 // Add registers for fixed parameters passed via interpreter dispatch. | 400 // Add registers for fixed parameters passed via interpreter dispatch. |
403 STATIC_ASSERT(0 == Linkage::kInterpreterBytecodeOffsetParameter); | 401 STATIC_ASSERT(0 == Linkage::kInterpreterBytecodeOffsetParameter); |
404 types.AddParam(kMachIntPtr); | 402 types.AddParam(kMachIntPtr); |
405 locations.AddParam(regloc(kInterpreterBytecodeOffsetRegister)); | 403 locations.AddParam(regloc(kInterpreterBytecodeOffsetRegister)); |
406 | 404 |
407 STATIC_ASSERT(1 == Linkage::kInterpreterBytecodeArrayParameter); | 405 STATIC_ASSERT(1 == Linkage::kInterpreterBytecodeArrayParameter); |
408 types.AddParam(kMachAnyTagged); | 406 types.AddParam(kMachAnyTagged); |
409 locations.AddParam(regloc(kInterpreterBytecodeArrayRegister)); | 407 locations.AddParam(regloc(kInterpreterBytecodeArrayRegister)); |
410 | 408 |
411 STATIC_ASSERT(2 == Linkage::kInterpreterDispatchTableParameter); | 409 STATIC_ASSERT(2 == Linkage::kInterpreterDispatchTableParameter); |
412 types.AddParam(kMachPtr); | 410 types.AddParam(kMachPtr); |
413 locations.AddParam(regloc(kInterpreterDispatchTableRegister)); | 411 locations.AddParam(regloc(kInterpreterDispatchTableRegister)); |
414 | 412 |
415 LinkageLocation target_loc = LinkageLocation::ForAnyRegister(); | 413 LinkageLocation target_loc = LinkageLocation::ForAnyRegister(); |
416 return new (zone) CallDescriptor( // -- | 414 return new (zone) CallDescriptor( // -- |
417 CallDescriptor::kInterpreterDispatch, // kind | 415 CallDescriptor::kCallCodeObject, // kind |
418 kMachNone, // target MachineType | 416 kMachNone, // target MachineType |
419 target_loc, // target location | 417 target_loc, // target location |
420 types.Build(), // machine_sig | 418 types.Build(), // machine_sig |
421 locations.Build(), // location_sig | 419 locations.Build(), // location_sig |
422 0, // stack_parameter_count | 420 0, // stack_parameter_count |
423 Operator::kNoProperties, // properties | 421 Operator::kNoProperties, // properties |
424 kNoCalleeSaved, // callee-saved registers | 422 kNoCalleeSaved, // callee-saved registers |
425 kNoCalleeSaved, // callee-saved fp regs | 423 kNoCalleeSaved, // callee-saved fp regs |
426 CallDescriptor::kSupportsTailCalls, // flags | 424 CallDescriptor::kSupportsTailCalls | // flags |
| 425 CallDescriptor::kCanUseRoots, // flags |
427 "interpreter-dispatch"); | 426 "interpreter-dispatch"); |
428 } | 427 } |
429 | 428 |
430 | 429 |
431 // TODO(all): Add support for return representations/locations to | 430 // TODO(all): Add support for return representations/locations to |
432 // CallInterfaceDescriptor. | 431 // CallInterfaceDescriptor. |
433 // TODO(turbofan): cache call descriptors for code stub calls. | 432 // TODO(turbofan): cache call descriptors for code stub calls. |
434 CallDescriptor* Linkage::GetStubCallDescriptor( | 433 CallDescriptor* Linkage::GetStubCallDescriptor( |
435 Isolate* isolate, Zone* zone, const CallInterfaceDescriptor& descriptor, | 434 Isolate* isolate, Zone* zone, const CallInterfaceDescriptor& descriptor, |
436 int stack_parameter_count, CallDescriptor::Flags flags, | 435 int stack_parameter_count, CallDescriptor::Flags flags, |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 return LinkageLocation::ForCalleeFrameSlot(spill_index); | 503 return LinkageLocation::ForCalleeFrameSlot(spill_index); |
505 } else { | 504 } else { |
506 // Parameter. Use the assigned location from the incoming call descriptor. | 505 // Parameter. Use the assigned location from the incoming call descriptor. |
507 int parameter_index = 1 + index; // skip index 0, which is the target. | 506 int parameter_index = 1 + index; // skip index 0, which is the target. |
508 return incoming_->GetInputLocation(parameter_index); | 507 return incoming_->GetInputLocation(parameter_index); |
509 } | 508 } |
510 } | 509 } |
511 } // namespace compiler | 510 } // namespace compiler |
512 } // namespace internal | 511 } // namespace internal |
513 } // namespace v8 | 512 } // namespace v8 |
OLD | NEW |