| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/interface-descriptors.h" | 5 #include "src/interface-descriptors.h" |
| 6 | 6 |
| 7 namespace v8 { | 7 namespace v8 { |
| 8 namespace internal { | 8 namespace internal { |
| 9 | 9 |
| 10 namespace { | 10 namespace { |
| (...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 Zone* zone = isolate->interface_descriptor_zone(); | 487 Zone* zone = isolate->interface_descriptor_zone(); |
| 488 FunctionType* function = | 488 FunctionType* function = |
| 489 Type::Function(AnyTagged(zone), Type::Undefined(), 4, zone)->AsFunction(); | 489 Type::Function(AnyTagged(zone), Type::Undefined(), 4, zone)->AsFunction(); |
| 490 function->InitParameter(0, Type::Receiver()); // JSFunction | 490 function->InitParameter(0, Type::Receiver()); // JSFunction |
| 491 function->InitParameter(1, AnyTagged(zone)); // the new target | 491 function->InitParameter(1, AnyTagged(zone)); // the new target |
| 492 function->InitParameter(2, UntaggedIntegral32(zone)); // actual #arguments | 492 function->InitParameter(2, UntaggedIntegral32(zone)); // actual #arguments |
| 493 function->InitParameter(3, UntaggedIntegral32(zone)); // expected #arguments | 493 function->InitParameter(3, UntaggedIntegral32(zone)); // expected #arguments |
| 494 return function; | 494 return function; |
| 495 } | 495 } |
| 496 | 496 |
| 497 CallInterfaceDescriptor ApiCallbackDescriptorBase::ForArgs(Isolate* isolate, | 497 FunctionType* ApiFunctionDescriptor::BuildCallInterfaceDescriptorFunctionType( |
| 498 int argc) { | 498 Isolate* isolate, int paramater_count) { |
| 499 switch (argc) { | 499 Zone* zone = isolate->interface_descriptor_zone(); |
| 500 case 0: | 500 FunctionType* function = |
| 501 return ApiCallbackWith0ArgsDescriptor(isolate); | 501 Type::Function(AnyTagged(zone), Type::Undefined(), 5, zone)->AsFunction(); |
| 502 case 1: | 502 function->InitParameter(0, AnyTagged(zone)); // callee |
| 503 return ApiCallbackWith1ArgsDescriptor(isolate); | 503 function->InitParameter(1, AnyTagged(zone)); // call_data |
| 504 case 2: | 504 function->InitParameter(2, AnyTagged(zone)); // holder |
| 505 return ApiCallbackWith2ArgsDescriptor(isolate); | 505 function->InitParameter(3, ExternalPointer(zone)); // api_function_address |
| 506 case 3: | 506 function->InitParameter(4, UntaggedIntegral32(zone)); // actual #arguments |
| 507 return ApiCallbackWith3ArgsDescriptor(isolate); | 507 return function; |
| 508 case 4: | |
| 509 return ApiCallbackWith4ArgsDescriptor(isolate); | |
| 510 case 5: | |
| 511 return ApiCallbackWith5ArgsDescriptor(isolate); | |
| 512 case 6: | |
| 513 return ApiCallbackWith6ArgsDescriptor(isolate); | |
| 514 case 7: | |
| 515 return ApiCallbackWith7ArgsDescriptor(isolate); | |
| 516 default: | |
| 517 UNREACHABLE(); | |
| 518 return VoidDescriptor(isolate); | |
| 519 } | |
| 520 } | 508 } |
| 521 | 509 |
| 522 FunctionType* | 510 FunctionType* ApiAccessorDescriptor::BuildCallInterfaceDescriptorFunctionType( |
| 523 ApiCallbackDescriptorBase::BuildCallInterfaceDescriptorFunctionTypeWithArg( | 511 Isolate* isolate, int paramater_count) { |
| 524 Isolate* isolate, int parameter_count, int argc) { | |
| 525 Zone* zone = isolate->interface_descriptor_zone(); | 512 Zone* zone = isolate->interface_descriptor_zone(); |
| 526 FunctionType* function = | 513 FunctionType* function = |
| 527 Type::Function(AnyTagged(zone), Type::Undefined(), 4 + argc, zone) | 514 Type::Function(AnyTagged(zone), Type::Undefined(), 4, zone)->AsFunction(); |
| 528 ->AsFunction(); | |
| 529 function->InitParameter(0, AnyTagged(zone)); // callee | 515 function->InitParameter(0, AnyTagged(zone)); // callee |
| 530 function->InitParameter(1, AnyTagged(zone)); // call_data | 516 function->InitParameter(1, AnyTagged(zone)); // call_data |
| 531 function->InitParameter(2, AnyTagged(zone)); // holder | 517 function->InitParameter(2, AnyTagged(zone)); // holder |
| 532 function->InitParameter(3, ExternalPointer(zone)); // api_function_address | 518 function->InitParameter(3, ExternalPointer(zone)); // api_function_address |
| 533 for (int i = 0; i < argc; i++) { | |
| 534 function->InitParameter(i, AnyTagged(zone)); | |
| 535 } | |
| 536 return function; | 519 return function; |
| 537 } | 520 } |
| 538 | 521 |
| 539 FunctionType* | 522 FunctionType* |
| 540 InterpreterDispatchDescriptor::BuildCallInterfaceDescriptorFunctionType( | 523 InterpreterDispatchDescriptor::BuildCallInterfaceDescriptorFunctionType( |
| 541 Isolate* isolate, int parameter_count) { | 524 Isolate* isolate, int parameter_count) { |
| 542 Zone* zone = isolate->interface_descriptor_zone(); | 525 Zone* zone = isolate->interface_descriptor_zone(); |
| 543 FunctionType* function = | 526 FunctionType* function = |
| 544 Type::Function(AnyTagged(zone), Type::Undefined(), 5, zone)->AsFunction(); | 527 Type::Function(AnyTagged(zone), Type::Undefined(), 5, zone)->AsFunction(); |
| 545 function->InitParameter(kAccumulatorParameter, AnyTagged(zone)); | 528 function->InitParameter(kAccumulatorParameter, AnyTagged(zone)); |
| 546 function->InitParameter(kRegisterFileParameter, ExternalPointer(zone)); | 529 function->InitParameter(kRegisterFileParameter, ExternalPointer(zone)); |
| 547 function->InitParameter(kBytecodeOffsetParameter, UntaggedIntegral32(zone)); | 530 function->InitParameter(kBytecodeOffsetParameter, UntaggedIntegral32(zone)); |
| 548 function->InitParameter(kBytecodeArrayParameter, AnyTagged(zone)); | 531 function->InitParameter(kBytecodeArrayParameter, AnyTagged(zone)); |
| 549 function->InitParameter(kDispatchTableParameter, AnyTagged(zone)); | 532 function->InitParameter(kDispatchTableParameter, AnyTagged(zone)); |
| 550 return function; | 533 return function; |
| 551 } | 534 } |
| 552 | 535 |
| 553 } // namespace internal | 536 } // namespace internal |
| 554 } // namespace v8 | 537 } // namespace v8 |
| OLD | NEW |