LCOV - code coverage report
Current view: top level - src/x64 - interface-descriptors-x64.cc (source / functions) Hit Total Coverage
Test: app.info Lines: 130 130 100.0 %
Date: 2019-04-18 Functions: 48 48 100.0 %

          Line data    Source code
       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
       3             : // found in the LICENSE file.
       4             : 
       5             : #if V8_TARGET_ARCH_X64
       6             : 
       7             : #include "src/interface-descriptors.h"
       8             : 
       9             : #include "src/frames.h"
      10             : 
      11             : namespace v8 {
      12             : namespace internal {
      13             : 
      14       54600 : const Register CallInterfaceDescriptor::ContextRegister() { return rsi; }
      15             : 
      16    11530512 : void CallInterfaceDescriptor::DefaultInitializePlatformSpecific(
      17             :     CallInterfaceDescriptorData* data, int register_parameter_count) {
      18    11530512 :   const Register default_stub_registers[] = {rax, rbx, rcx, rdx, rdi};
      19    11530512 :   CHECK_LE(static_cast<size_t>(register_parameter_count),
      20             :            arraysize(default_stub_registers));
      21             :   data->InitializePlatformSpecific(register_parameter_count,
      22    11530512 :                                    default_stub_registers);
      23    11530512 : }
      24             : 
      25       61008 : void RecordWriteDescriptor::InitializePlatformSpecific(
      26             :     CallInterfaceDescriptorData* data) {
      27             :   const Register default_stub_registers[] = {arg_reg_1, arg_reg_2, arg_reg_3,
      28       61008 :                                              arg_reg_4, kReturnRegister0};
      29             : 
      30             :   data->RestrictAllocatableRegisters(default_stub_registers,
      31             :                                      arraysize(default_stub_registers));
      32             : 
      33             :   CHECK_LE(static_cast<size_t>(kParameterCount),
      34             :            arraysize(default_stub_registers));
      35       61008 :   data->InitializePlatformSpecific(kParameterCount, default_stub_registers);
      36       61008 : }
      37             : 
      38       61008 : void EphemeronKeyBarrierDescriptor::InitializePlatformSpecific(
      39             :     CallInterfaceDescriptorData* data) {
      40             :   const Register default_stub_registers[] = {arg_reg_1, arg_reg_2, arg_reg_3,
      41       61008 :                                              arg_reg_4, kReturnRegister0};
      42             : 
      43             :   data->RestrictAllocatableRegisters(default_stub_registers,
      44             :                                      arraysize(default_stub_registers));
      45             : 
      46             :   CHECK_LE(static_cast<size_t>(kParameterCount),
      47             :            arraysize(default_stub_registers));
      48       61008 :   data->InitializePlatformSpecific(kParameterCount, default_stub_registers);
      49       61008 : }
      50             : 
      51       61008 : const Register FastNewFunctionContextDescriptor::ScopeInfoRegister() {
      52       61008 :   return rdi;
      53             : }
      54       61008 : const Register FastNewFunctionContextDescriptor::SlotsRegister() { return rax; }
      55             : 
      56      183080 : const Register LoadDescriptor::ReceiverRegister() { return rdx; }
      57      244032 : const Register LoadDescriptor::NameRegister() { return rcx; }
      58      244032 : const Register LoadDescriptor::SlotRegister() { return rax; }
      59             : 
      60      122016 : const Register LoadWithVectorDescriptor::VectorRegister() { return rbx; }
      61             : 
      62      183024 : const Register StoreDescriptor::ReceiverRegister() { return rdx; }
      63      305040 : const Register StoreDescriptor::NameRegister() { return rcx; }
      64      305040 : const Register StoreDescriptor::ValueRegister() { return rax; }
      65      244032 : const Register StoreDescriptor::SlotRegister() { return rdi; }
      66             : 
      67      122016 : const Register StoreWithVectorDescriptor::VectorRegister() { return rbx; }
      68             : 
      69       61008 : const Register StoreTransitionDescriptor::SlotRegister() { return rdi; }
      70       61008 : const Register StoreTransitionDescriptor::VectorRegister() { return rbx; }
      71       61008 : const Register StoreTransitionDescriptor::MapRegister() { return r11; }
      72             : 
      73       61064 : const Register ApiGetterDescriptor::HolderRegister() { return rcx; }
      74       61064 : const Register ApiGetterDescriptor::CallbackRegister() { return rbx; }
      75             : 
      76       61008 : const Register GrowArrayElementsDescriptor::ObjectRegister() { return rax; }
      77       61008 : const Register GrowArrayElementsDescriptor::KeyRegister() { return rbx; }
      78             : 
      79             : 
      80       61008 : void TypeofDescriptor::InitializePlatformSpecific(
      81             :     CallInterfaceDescriptorData* data) {
      82       61008 :   Register registers[] = {rbx};
      83       61008 :   data->InitializePlatformSpecific(arraysize(registers), registers);
      84       61008 : }
      85             : 
      86             : 
      87             : // static
      88       61008 : const Register TypeConversionDescriptor::ArgumentRegister() { return rax; }
      89             : 
      90       61008 : void CallTrampolineDescriptor::InitializePlatformSpecific(
      91             :     CallInterfaceDescriptorData* data) {
      92             :   // rax : number of arguments
      93             :   // rdi : the target to call
      94       61008 :   Register registers[] = {rdi, rax};
      95       61008 :   data->InitializePlatformSpecific(arraysize(registers), registers);
      96       61008 : }
      97             : 
      98       61008 : void CallVarargsDescriptor::InitializePlatformSpecific(
      99             :     CallInterfaceDescriptorData* data) {
     100             :   // rax : number of arguments (on the stack, not including receiver)
     101             :   // rdi : the target to call
     102             :   // rcx : arguments list length (untagged)
     103             :   // rbx : arguments list (FixedArray)
     104       61008 :   Register registers[] = {rdi, rax, rcx, rbx};
     105       61008 :   data->InitializePlatformSpecific(arraysize(registers), registers);
     106       61008 : }
     107             : 
     108       61008 : void CallForwardVarargsDescriptor::InitializePlatformSpecific(
     109             :     CallInterfaceDescriptorData* data) {
     110             :   // rax : number of arguments
     111             :   // rcx : start index (to support rest parameters)
     112             :   // rdi : the target to call
     113       61008 :   Register registers[] = {rdi, rax, rcx};
     114       61008 :   data->InitializePlatformSpecific(arraysize(registers), registers);
     115       61008 : }
     116             : 
     117       61008 : void CallFunctionTemplateDescriptor::InitializePlatformSpecific(
     118             :     CallInterfaceDescriptorData* data) {
     119             :   // rdx: the function template info
     120             :   // rcx: number of arguments (on the stack, not including receiver)
     121       61008 :   Register registers[] = {rdx, rcx};
     122       61008 :   data->InitializePlatformSpecific(arraysize(registers), registers);
     123       61008 : }
     124             : 
     125       61008 : void CallWithSpreadDescriptor::InitializePlatformSpecific(
     126             :     CallInterfaceDescriptorData* data) {
     127             :   // rax : number of arguments (on the stack, not including receiver)
     128             :   // rdi : the target to call
     129             :   // rbx : the object to spread
     130       61008 :   Register registers[] = {rdi, rax, rbx};
     131       61008 :   data->InitializePlatformSpecific(arraysize(registers), registers);
     132       61008 : }
     133             : 
     134       61008 : void CallWithArrayLikeDescriptor::InitializePlatformSpecific(
     135             :     CallInterfaceDescriptorData* data) {
     136             :   // rdi : the target to call
     137             :   // rbx : the arguments list
     138       61008 :   Register registers[] = {rdi, rbx};
     139       61008 :   data->InitializePlatformSpecific(arraysize(registers), registers);
     140       61008 : }
     141             : 
     142       61008 : void ConstructVarargsDescriptor::InitializePlatformSpecific(
     143             :     CallInterfaceDescriptorData* data) {
     144             :   // rax : number of arguments (on the stack, not including receiver)
     145             :   // rdi : the target to call
     146             :   // rdx : the new target
     147             :   // rcx : arguments list length (untagged)
     148             :   // rbx : arguments list (FixedArray)
     149       61008 :   Register registers[] = {rdi, rdx, rax, rcx, rbx};
     150       61008 :   data->InitializePlatformSpecific(arraysize(registers), registers);
     151       61008 : }
     152             : 
     153       61008 : void ConstructForwardVarargsDescriptor::InitializePlatformSpecific(
     154             :     CallInterfaceDescriptorData* data) {
     155             :   // rax : number of arguments
     156             :   // rdx : the new target
     157             :   // rcx : start index (to support rest parameters)
     158             :   // rdi : the target to call
     159       61008 :   Register registers[] = {rdi, rdx, rax, rcx};
     160       61008 :   data->InitializePlatformSpecific(arraysize(registers), registers);
     161       61008 : }
     162             : 
     163       61008 : void ConstructWithSpreadDescriptor::InitializePlatformSpecific(
     164             :     CallInterfaceDescriptorData* data) {
     165             :   // rax : number of arguments (on the stack, not including receiver)
     166             :   // rdi : the target to call
     167             :   // rdx : the new target
     168             :   // rbx : the object to spread
     169       61008 :   Register registers[] = {rdi, rdx, rax, rbx};
     170       61008 :   data->InitializePlatformSpecific(arraysize(registers), registers);
     171       61008 : }
     172             : 
     173       61008 : void ConstructWithArrayLikeDescriptor::InitializePlatformSpecific(
     174             :     CallInterfaceDescriptorData* data) {
     175             :   // rdi : the target to call
     176             :   // rdx : the new target
     177             :   // rbx : the arguments list
     178       61008 :   Register registers[] = {rdi, rdx, rbx};
     179       61008 :   data->InitializePlatformSpecific(arraysize(registers), registers);
     180       61008 : }
     181             : 
     182       61008 : void ConstructStubDescriptor::InitializePlatformSpecific(
     183             :     CallInterfaceDescriptorData* data) {
     184             :   // rax : number of arguments
     185             :   // rdx : the new target
     186             :   // rdi : the target to call
     187             :   // rbx : allocation site or undefined
     188       61008 :   Register registers[] = {rdi, rdx, rax, rbx};
     189       61008 :   data->InitializePlatformSpecific(arraysize(registers), registers);
     190       61008 : }
     191             : 
     192       61008 : void AbortDescriptor::InitializePlatformSpecific(
     193             :     CallInterfaceDescriptorData* data) {
     194       61008 :   Register registers[] = {rdx};
     195       61008 :   data->InitializePlatformSpecific(arraysize(registers), registers);
     196       61008 : }
     197             : 
     198       61008 : void AllocateHeapNumberDescriptor::InitializePlatformSpecific(
     199             :     CallInterfaceDescriptorData* data) {
     200       61008 :   data->InitializePlatformSpecific(0, nullptr);
     201       61008 : }
     202             : 
     203       61008 : void CompareDescriptor::InitializePlatformSpecific(
     204             :     CallInterfaceDescriptorData* data) {
     205       61008 :   Register registers[] = {rdx, rax};
     206       61008 :   data->InitializePlatformSpecific(arraysize(registers), registers);
     207       61008 : }
     208             : 
     209       61008 : void BinaryOpDescriptor::InitializePlatformSpecific(
     210             :     CallInterfaceDescriptorData* data) {
     211       61008 :   Register registers[] = {rdx, rax};
     212       61008 :   data->InitializePlatformSpecific(arraysize(registers), registers);
     213       61008 : }
     214             : 
     215       61008 : void ArgumentsAdaptorDescriptor::InitializePlatformSpecific(
     216             :     CallInterfaceDescriptorData* data) {
     217             :   Register registers[] = {
     218             :       rdi,  // JSFunction
     219             :       rdx,  // the new target
     220             :       rax,  // actual number of arguments
     221             :       rbx,  // expected number of arguments
     222       61008 :   };
     223       61008 :   data->InitializePlatformSpecific(arraysize(registers), registers);
     224       61008 : }
     225             : 
     226       61008 : void ApiCallbackDescriptor::InitializePlatformSpecific(
     227             :     CallInterfaceDescriptorData* data) {
     228             :   Register registers[] = {
     229             :       rdx,  // api function address
     230             :       rcx,  // argument count (not including receiver)
     231             :       rbx,  // call data
     232             :       rdi,  // holder
     233       61008 :   };
     234       61008 :   data->InitializePlatformSpecific(arraysize(registers), registers);
     235       61008 : }
     236             : 
     237       61008 : void InterpreterDispatchDescriptor::InitializePlatformSpecific(
     238             :     CallInterfaceDescriptorData* data) {
     239             :   Register registers[] = {
     240             :       kInterpreterAccumulatorRegister, kInterpreterBytecodeOffsetRegister,
     241       61008 :       kInterpreterBytecodeArrayRegister, kInterpreterDispatchTableRegister};
     242       61008 :   data->InitializePlatformSpecific(arraysize(registers), registers);
     243       61008 : }
     244             : 
     245       61008 : void InterpreterPushArgsThenCallDescriptor::InitializePlatformSpecific(
     246             :     CallInterfaceDescriptorData* data) {
     247             :   Register registers[] = {
     248             :       rax,  // argument count (not including receiver)
     249             :       rbx,  // address of first argument
     250             :       rdi   // the target callable to be call
     251       61008 :   };
     252       61008 :   data->InitializePlatformSpecific(arraysize(registers), registers);
     253       61008 : }
     254             : 
     255       61008 : void InterpreterPushArgsThenConstructDescriptor::InitializePlatformSpecific(
     256             :     CallInterfaceDescriptorData* data) {
     257             :   Register registers[] = {
     258             :       rax,  // argument count (not including receiver)
     259             :       rcx,  // address of first argument
     260             :       rdi,  // constructor to call
     261             :       rdx,  // new target
     262             :       rbx,  // allocation site feedback if available, undefined otherwise
     263       61008 :   };
     264       61008 :   data->InitializePlatformSpecific(arraysize(registers), registers);
     265       61008 : }
     266             : 
     267       61008 : void ResumeGeneratorDescriptor::InitializePlatformSpecific(
     268             :     CallInterfaceDescriptorData* data) {
     269             :   Register registers[] = {
     270             :       rax,  // the value to pass to the generator
     271             :       rdx   // the JSGeneratorObject / JSAsyncGeneratorObject to resume
     272       61008 :   };
     273       61008 :   data->InitializePlatformSpecific(arraysize(registers), registers);
     274       61008 : }
     275             : 
     276       61008 : void FrameDropperTrampolineDescriptor::InitializePlatformSpecific(
     277             :     CallInterfaceDescriptorData* data) {
     278             :   Register registers[] = {
     279             :       rbx,  // loaded new FP
     280       61008 :   };
     281       61008 :   data->InitializePlatformSpecific(arraysize(registers), registers);
     282       61008 : }
     283             : 
     284       61008 : void RunMicrotasksEntryDescriptor::InitializePlatformSpecific(
     285             :     CallInterfaceDescriptorData* data) {
     286       61008 :   Register registers[] = {arg_reg_1, arg_reg_2};
     287       61008 :   data->InitializePlatformSpecific(arraysize(registers), registers);
     288       61008 : }
     289             : 
     290             : }  // namespace internal
     291      122036 : }  // namespace v8
     292             : 
     293             : #endif  // V8_TARGET_ARCH_X64

Generated by: LCOV version 1.10