LCOV - code coverage report
Current view: top level - src/x64 - interface-descriptors-x64.cc (source / functions) Hit Total Coverage
Test: app.info Lines: 178 179 99.4 %
Date: 2017-04-26 Functions: 62 63 98.4 %

          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             : namespace v8 {
      10             : namespace internal {
      11             : 
      12           0 : const Register CallInterfaceDescriptor::ContextRegister() { return rsi; }
      13             : 
      14     1519550 : void CallInterfaceDescriptor::DefaultInitializePlatformSpecific(
      15             :     CallInterfaceDescriptorData* data, int register_parameter_count) {
      16     1519550 :   const Register default_stub_registers[] = {rax, rbx, rcx, rdx, rdi};
      17     1519550 :   CHECK_LE(static_cast<size_t>(register_parameter_count),
      18             :            arraysize(default_stub_registers));
      19             :   data->InitializePlatformSpecific(register_parameter_count,
      20     1519550 :                                    default_stub_registers);
      21     1519550 : }
      22             : 
      23       60782 : const Register FastNewFunctionContextDescriptor::FunctionRegister() {
      24       60782 :   return rdi;
      25             : }
      26      105686 : const Register FastNewFunctionContextDescriptor::SlotsRegister() { return rax; }
      27             : 
      28     2261200 : const Register LoadDescriptor::ReceiverRegister() { return rdx; }
      29     3136503 : const Register LoadDescriptor::NameRegister() { return rcx; }
      30     3072246 : const Register LoadDescriptor::SlotRegister() { return rax; }
      31             : 
      32      182900 : const Register LoadWithVectorDescriptor::VectorRegister() { return rbx; }
      33             : 
      34       60782 : const Register LoadICProtoArrayDescriptor::HandlerRegister() { return rdi; }
      35             : 
      36     1606609 : const Register StoreDescriptor::ReceiverRegister() { return rdx; }
      37     1606609 : const Register StoreDescriptor::NameRegister() { return rcx; }
      38      299854 : const Register StoreDescriptor::ValueRegister() { return rax; }
      39     1561859 : const Register StoreDescriptor::SlotRegister() { return rdi; }
      40             : 
      41      137596 : const Register StoreWithVectorDescriptor::VectorRegister() { return rbx; }
      42             : 
      43      121564 : const Register StoreTransitionDescriptor::SlotRegister() { return rdi; }
      44      121564 : const Register StoreTransitionDescriptor::VectorRegister() { return rbx; }
      45      121564 : const Register StoreTransitionDescriptor::MapRegister() { return r11; }
      46             : 
      47       60782 : const Register StringCompareDescriptor::LeftRegister() { return rdx; }
      48       60782 : const Register StringCompareDescriptor::RightRegister() { return rax; }
      49             : 
      50       60825 : const Register ApiGetterDescriptor::HolderRegister() { return rcx; }
      51       60825 : const Register ApiGetterDescriptor::CallbackRegister() { return rbx; }
      52             : 
      53       62160 : const Register MathPowTaggedDescriptor::exponent() { return rdx; }
      54             : 
      55       60782 : const Register MathPowIntegerDescriptor::exponent() {
      56       60782 :   return MathPowTaggedDescriptor::exponent();
      57             : }
      58             : 
      59             : 
      60       60782 : const Register GrowArrayElementsDescriptor::ObjectRegister() { return rax; }
      61       60782 : const Register GrowArrayElementsDescriptor::KeyRegister() { return rbx; }
      62             : 
      63             : 
      64       60782 : void FastNewClosureDescriptor::InitializePlatformSpecific(
      65             :     CallInterfaceDescriptorData* data) {
      66             :   // SharedFunctionInfo, vector, slot index.
      67       60782 :   Register registers[] = {rbx, rcx, rdx};
      68       60782 :   data->InitializePlatformSpecific(arraysize(registers), registers);
      69       60782 : }
      70             : 
      71       60782 : void TypeofDescriptor::InitializePlatformSpecific(
      72             :     CallInterfaceDescriptorData* data) {
      73       60782 :   Register registers[] = {rbx};
      74       60782 :   data->InitializePlatformSpecific(arraysize(registers), registers);
      75       60782 : }
      76             : 
      77             : 
      78             : // static
      79       60782 : const Register TypeConversionDescriptor::ArgumentRegister() { return rax; }
      80             : 
      81       60782 : void FastCloneRegExpDescriptor::InitializePlatformSpecific(
      82             :     CallInterfaceDescriptorData* data) {
      83       60782 :   Register registers[] = {rdi, rax, rcx, rdx};
      84       60782 :   data->InitializePlatformSpecific(arraysize(registers), registers);
      85       60782 : }
      86             : 
      87             : 
      88       60782 : void FastCloneShallowArrayDescriptor::InitializePlatformSpecific(
      89             :     CallInterfaceDescriptorData* data) {
      90       60782 :   Register registers[] = {rax, rbx, rcx};
      91       60782 :   data->InitializePlatformSpecific(arraysize(registers), registers);
      92       60782 : }
      93             : 
      94             : 
      95       60782 : void FastCloneShallowObjectDescriptor::InitializePlatformSpecific(
      96             :     CallInterfaceDescriptorData* data) {
      97       60782 :   Register registers[] = {rax, rbx, rcx, rdx};
      98       60782 :   data->InitializePlatformSpecific(arraysize(registers), registers);
      99       60782 : }
     100             : 
     101             : 
     102       60782 : void CreateAllocationSiteDescriptor::InitializePlatformSpecific(
     103             :     CallInterfaceDescriptorData* data) {
     104       60782 :   Register registers[] = {rbx, rdx};
     105       60782 :   data->InitializePlatformSpecific(arraysize(registers), registers);
     106       60782 : }
     107             : 
     108             : 
     109       60782 : void CreateWeakCellDescriptor::InitializePlatformSpecific(
     110             :     CallInterfaceDescriptorData* data) {
     111       60782 :   Register registers[] = {rbx, rdx, rdi};
     112       60782 :   data->InitializePlatformSpecific(arraysize(registers), registers);
     113       60782 : }
     114             : 
     115             : 
     116       60782 : void CallFunctionDescriptor::InitializePlatformSpecific(
     117             :     CallInterfaceDescriptorData* data) {
     118       60782 :   Register registers[] = {rdi};
     119       60782 :   data->InitializePlatformSpecific(arraysize(registers), registers);
     120       60782 : }
     121             : 
     122       60782 : void CallICTrampolineDescriptor::InitializePlatformSpecific(
     123             :     CallInterfaceDescriptorData* data) {
     124       60782 :   Register registers[] = {rdi, rax, rdx};
     125       60782 :   data->InitializePlatformSpecific(arraysize(registers), registers);
     126       60782 : }
     127             : 
     128       60782 : void CallICDescriptor::InitializePlatformSpecific(
     129             :     CallInterfaceDescriptorData* data) {
     130       60782 :   Register registers[] = {rdi, rax, rdx, rbx};
     131       60782 :   data->InitializePlatformSpecific(arraysize(registers), registers);
     132       60782 : }
     133             : 
     134             : 
     135       60782 : void CallConstructDescriptor::InitializePlatformSpecific(
     136             :     CallInterfaceDescriptorData* data) {
     137             :   // rax : number of arguments
     138             :   // rbx : feedback vector
     139             :   // rdx : slot in feedback vector (Smi, for RecordCallTarget)
     140             :   // rdi : constructor function
     141             :   // TODO(turbofan): So far we don't gather type feedback and hence skip the
     142             :   // slot parameter, but ArrayConstructStub needs the vector to be undefined.
     143       60782 :   Register registers[] = {rax, rdi, rbx};
     144       60782 :   data->InitializePlatformSpecific(arraysize(registers), registers);
     145       60782 : }
     146             : 
     147             : 
     148       60782 : void CallTrampolineDescriptor::InitializePlatformSpecific(
     149             :     CallInterfaceDescriptorData* data) {
     150             :   // rax : number of arguments
     151             :   // rdi : the target to call
     152       60782 :   Register registers[] = {rdi, rax};
     153       60782 :   data->InitializePlatformSpecific(arraysize(registers), registers);
     154       60782 : }
     155             : 
     156       60782 : void CallForwardVarargsDescriptor::InitializePlatformSpecific(
     157             :     CallInterfaceDescriptorData* data) {
     158             :   // rcx : start index (to support rest parameters)
     159             :   // rdi : the target to call
     160       60782 :   Register registers[] = {rdi, rcx};
     161       60782 :   data->InitializePlatformSpecific(arraysize(registers), registers);
     162       60782 : }
     163             : 
     164       60782 : void ConstructStubDescriptor::InitializePlatformSpecific(
     165             :     CallInterfaceDescriptorData* data) {
     166             :   // rax : number of arguments
     167             :   // rdx : the new target
     168             :   // rdi : the target to call
     169             :   // rbx : allocation site or undefined
     170       60782 :   Register registers[] = {rdi, rdx, rax, rbx};
     171       60782 :   data->InitializePlatformSpecific(arraysize(registers), registers);
     172       60782 : }
     173             : 
     174             : 
     175       60782 : void ConstructTrampolineDescriptor::InitializePlatformSpecific(
     176             :     CallInterfaceDescriptorData* data) {
     177             :   // rax : number of arguments
     178             :   // rdx : the new target
     179             :   // rdi : the target to call
     180       60782 :   Register registers[] = {rdi, rdx, rax};
     181       60782 :   data->InitializePlatformSpecific(arraysize(registers), registers);
     182       60782 : }
     183             : 
     184             : 
     185       60782 : void TransitionElementsKindDescriptor::InitializePlatformSpecific(
     186             :     CallInterfaceDescriptorData* data) {
     187       60782 :   Register registers[] = {rax, rbx};
     188       60782 :   data->InitializePlatformSpecific(arraysize(registers), registers);
     189       60782 : }
     190             : 
     191             : 
     192       60782 : void AllocateHeapNumberDescriptor::InitializePlatformSpecific(
     193             :     CallInterfaceDescriptorData* data) {
     194       60782 :   data->InitializePlatformSpecific(0, nullptr, nullptr);
     195       60782 : }
     196             : 
     197       60782 : void ArrayConstructorDescriptor::InitializePlatformSpecific(
     198             :     CallInterfaceDescriptorData* data) {
     199             :   // kTarget, kNewTarget, kActualArgumentsCount, kAllocationSite
     200       60782 :   Register registers[] = {rdi, rdx, rax, rbx};
     201       60782 :   data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
     202       60782 : }
     203             : 
     204       60782 : void ArrayNoArgumentConstructorDescriptor::InitializePlatformSpecific(
     205             :     CallInterfaceDescriptorData* data) {
     206             :   // register state
     207             :   // rax -- number of arguments
     208             :   // rdi -- function
     209             :   // rbx -- allocation site with elements kind
     210       60782 :   Register registers[] = {rdi, rbx, rax};
     211       60782 :   data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
     212       60782 : }
     213             : 
     214       60782 : void ArraySingleArgumentConstructorDescriptor::InitializePlatformSpecific(
     215             :     CallInterfaceDescriptorData* data) {
     216             :   // register state
     217             :   // rax -- number of arguments
     218             :   // rdi -- function
     219             :   // rbx -- allocation site with elements kind
     220       60782 :   Register registers[] = {rdi, rbx, rax};
     221       60782 :   data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
     222       60782 : }
     223             : 
     224       60782 : void ArrayNArgumentsConstructorDescriptor::InitializePlatformSpecific(
     225             :     CallInterfaceDescriptorData* data) {
     226             :   // register state
     227             :   // rax -- number of arguments
     228             :   // rdi -- function
     229             :   // rbx -- allocation site with elements kind
     230       60782 :   Register registers[] = {rdi, rbx, rax};
     231       60782 :   data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
     232       60782 : }
     233             : 
     234       60782 : void VarArgFunctionDescriptor::InitializePlatformSpecific(
     235             :     CallInterfaceDescriptorData* data) {
     236             :   // stack param count needs (arg count)
     237       60782 :   Register registers[] = {rax};
     238       60782 :   data->InitializePlatformSpecific(arraysize(registers), registers);
     239       60782 : }
     240             : 
     241       60782 : void CompareDescriptor::InitializePlatformSpecific(
     242             :     CallInterfaceDescriptorData* data) {
     243       60782 :   Register registers[] = {rdx, rax};
     244       60782 :   data->InitializePlatformSpecific(arraysize(registers), registers);
     245       60782 : }
     246             : 
     247             : 
     248       60782 : void BinaryOpDescriptor::InitializePlatformSpecific(
     249             :     CallInterfaceDescriptorData* data) {
     250       60782 :   Register registers[] = {rdx, rax};
     251       60782 :   data->InitializePlatformSpecific(arraysize(registers), registers);
     252       60782 : }
     253             : 
     254             : 
     255       60782 : void BinaryOpWithAllocationSiteDescriptor::InitializePlatformSpecific(
     256             :     CallInterfaceDescriptorData* data) {
     257       60782 :   Register registers[] = {rcx, rdx, rax};
     258       60782 :   data->InitializePlatformSpecific(arraysize(registers), registers);
     259       60782 : }
     260             : 
     261       60782 : void BinaryOpWithVectorDescriptor::InitializePlatformSpecific(
     262             :     CallInterfaceDescriptorData* data) {
     263             :   // register state
     264             :   // rdx -- lhs
     265             :   // rax -- rhs
     266             :   // rdi -- slot id
     267             :   // rbx -- vector
     268       60782 :   Register registers[] = {rdx, rax, rdi, rbx};
     269       60782 :   data->InitializePlatformSpecific(arraysize(registers), registers);
     270       60782 : }
     271             : 
     272       60782 : void CountOpDescriptor::InitializePlatformSpecific(
     273             :     CallInterfaceDescriptorData* data) {
     274       60782 :   Register registers[] = {rax};
     275       60782 :   data->InitializePlatformSpecific(arraysize(registers), registers);
     276       60782 : }
     277             : 
     278       60782 : void StringAddDescriptor::InitializePlatformSpecific(
     279             :     CallInterfaceDescriptorData* data) {
     280       60782 :   Register registers[] = {rdx, rax};
     281       60782 :   data->InitializePlatformSpecific(arraysize(registers), registers);
     282       60782 : }
     283             : 
     284       60782 : void ArgumentAdaptorDescriptor::InitializePlatformSpecific(
     285             :     CallInterfaceDescriptorData* data) {
     286             :   Register registers[] = {
     287             :       rdi,  // JSFunction
     288             :       rdx,  // the new target
     289             :       rax,  // actual number of arguments
     290             :       rbx,  // expected number of arguments
     291       60782 :   };
     292       60782 :   data->InitializePlatformSpecific(arraysize(registers), registers);
     293       60782 : }
     294             : 
     295       60782 : void ApiCallbackDescriptor::InitializePlatformSpecific(
     296             :     CallInterfaceDescriptorData* data) {
     297             :   Register registers[] = {
     298             :       rdi,  // callee
     299             :       rbx,  // call_data
     300             :       rcx,  // holder
     301             :       rdx,  // api_function_address
     302       60782 :   };
     303       60782 :   data->InitializePlatformSpecific(arraysize(registers), registers);
     304       60782 : }
     305             : 
     306       60782 : void InterpreterDispatchDescriptor::InitializePlatformSpecific(
     307             :     CallInterfaceDescriptorData* data) {
     308             :   Register registers[] = {
     309             :       kInterpreterAccumulatorRegister, kInterpreterBytecodeOffsetRegister,
     310       60782 :       kInterpreterBytecodeArrayRegister, kInterpreterDispatchTableRegister};
     311       60782 :   data->InitializePlatformSpecific(arraysize(registers), registers);
     312       60782 : }
     313             : 
     314       60782 : void InterpreterPushArgsThenCallDescriptor::InitializePlatformSpecific(
     315             :     CallInterfaceDescriptorData* data) {
     316             :   Register registers[] = {
     317             :       rax,  // argument count (not including receiver)
     318             :       rbx,  // address of first argument
     319             :       rdi   // the target callable to be call
     320       60782 :   };
     321       60782 :   data->InitializePlatformSpecific(arraysize(registers), registers);
     322       60782 : }
     323             : 
     324       60782 : void InterpreterPushArgsThenConstructDescriptor::InitializePlatformSpecific(
     325             :     CallInterfaceDescriptorData* data) {
     326             :   Register registers[] = {
     327             :       rax,  // argument count (not including receiver)
     328             :       rdx,  // new target
     329             :       rdi,  // constructor
     330             :       rbx,  // allocation site feedback if available, undefined otherwise
     331             :       rcx,  // address of first argument
     332       60782 :   };
     333       60782 :   data->InitializePlatformSpecific(arraysize(registers), registers);
     334       60782 : }
     335             : 
     336       60782 : void InterpreterPushArgsThenConstructArrayDescriptor::
     337             :     InitializePlatformSpecific(CallInterfaceDescriptorData* data) {
     338             :   Register registers[] = {
     339             :       rax,  // argument count (not including receiver)
     340             :       rdx,  // target to the call. It is checked to be Array function.
     341             :       rbx,  // allocation site feedback
     342             :       rcx,  // address of first argument
     343       60782 :   };
     344       60782 :   data->InitializePlatformSpecific(arraysize(registers), registers);
     345       60782 : }
     346             : 
     347       60782 : void InterpreterCEntryDescriptor::InitializePlatformSpecific(
     348             :     CallInterfaceDescriptorData* data) {
     349             :   Register registers[] = {
     350             :       rax,  // argument count (argc)
     351             :       r15,  // address of first argument (argv)
     352             :       rbx   // the runtime function to call
     353       60782 :   };
     354       60782 :   data->InitializePlatformSpecific(arraysize(registers), registers);
     355       60782 : }
     356             : 
     357       60782 : void ResumeGeneratorDescriptor::InitializePlatformSpecific(
     358             :     CallInterfaceDescriptorData* data) {
     359             :   Register registers[] = {
     360             :       rax,  // the value to pass to the generator
     361             :       rbx,  // the JSGeneratorObject / JSAsyncGeneratorObject to resume
     362             :       rdx,  // the resume mode (tagged)
     363             :       rcx   // SuspendFlags (tagged)
     364       60782 :   };
     365       60782 :   data->InitializePlatformSpecific(arraysize(registers), registers);
     366       60782 : }
     367             : 
     368       60782 : void FrameDropperTrampolineDescriptor::InitializePlatformSpecific(
     369             :     CallInterfaceDescriptorData* data) {
     370             :   Register registers[] = {
     371             :       rbx,  // loaded new FP
     372       60782 :   };
     373       60782 :   data->InitializePlatformSpecific(arraysize(registers), registers);
     374       60782 : }
     375             : 
     376             : }  // namespace internal
     377             : }  // namespace v8
     378             : 
     379             : #endif  // V8_TARGET_ARCH_X64

Generated by: LCOV version 1.10