LCOV - code coverage report
Current view: top level - src - code-factory.cc (source / functions) Hit Total Coverage
Test: app.info Lines: 134 182 73.6 %
Date: 2019-01-20 Functions: 40 43 93.0 %

          Line data    Source code
       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
       3             : // found in the LICENSE file.
       4             : 
       5             : #include "src/code-factory.h"
       6             : 
       7             : #include "src/bootstrapper.h"
       8             : #include "src/builtins/builtins-descriptors.h"
       9             : #include "src/ic/ic.h"
      10             : #include "src/objects-inl.h"
      11             : 
      12             : namespace v8 {
      13             : namespace internal {
      14             : 
      15             : // static
      16      156467 : Handle<Code> CodeFactory::RuntimeCEntry(Isolate* isolate, int result_size) {
      17      156467 :   return CodeFactory::CEntry(isolate, result_size);
      18             : }
      19             : 
      20             : #define CENTRY_CODE(RS, SD, AM, BE) \
      21             :   BUILTIN_CODE(isolate, CEntry_##RS##_##SD##_##AM##_##BE)
      22             : 
      23             : // static
      24     2593489 : Handle<Code> CodeFactory::CEntry(Isolate* isolate, int result_size,
      25             :                                  SaveFPRegsMode save_doubles,
      26             :                                  ArgvMode argv_mode, bool builtin_exit_frame) {
      27             :   // Aliases for readability below.
      28             :   const int rs = result_size;
      29             :   const SaveFPRegsMode sd = save_doubles;
      30             :   const ArgvMode am = argv_mode;
      31             :   const bool be = builtin_exit_frame;
      32             : 
      33     2593489 :   if (rs == 1 && sd == kDontSaveFPRegs && am == kArgvOnStack && !be) {
      34     2133090 :     return CENTRY_CODE(Return1, DontSaveFPRegs, ArgvOnStack, NoBuiltinExit);
      35      460399 :   } else if (rs == 1 && sd == kDontSaveFPRegs && am == kArgvOnStack && be) {
      36      458407 :     return CENTRY_CODE(Return1, DontSaveFPRegs, ArgvOnStack, BuiltinExit);
      37        1992 :   } else if (rs == 1 && sd == kDontSaveFPRegs && am == kArgvInRegister && !be) {
      38         174 :     return CENTRY_CODE(Return1, DontSaveFPRegs, ArgvInRegister, NoBuiltinExit);
      39        1818 :   } else if (rs == 1 && sd == kSaveFPRegs && am == kArgvOnStack && !be) {
      40           0 :     return CENTRY_CODE(Return1, SaveFPRegs, ArgvOnStack, NoBuiltinExit);
      41        1818 :   } else if (rs == 1 && sd == kSaveFPRegs && am == kArgvOnStack && be) {
      42           0 :     return CENTRY_CODE(Return1, SaveFPRegs, ArgvOnStack, BuiltinExit);
      43        1818 :   } else if (rs == 2 && sd == kDontSaveFPRegs && am == kArgvOnStack && !be) {
      44        1640 :     return CENTRY_CODE(Return2, DontSaveFPRegs, ArgvOnStack, NoBuiltinExit);
      45         178 :   } else if (rs == 2 && sd == kDontSaveFPRegs && am == kArgvOnStack && be) {
      46           0 :     return CENTRY_CODE(Return2, DontSaveFPRegs, ArgvOnStack, BuiltinExit);
      47         178 :   } else if (rs == 2 && sd == kDontSaveFPRegs && am == kArgvInRegister && !be) {
      48         174 :     return CENTRY_CODE(Return2, DontSaveFPRegs, ArgvInRegister, NoBuiltinExit);
      49           4 :   } else if (rs == 2 && sd == kSaveFPRegs && am == kArgvOnStack && !be) {
      50           0 :     return CENTRY_CODE(Return2, SaveFPRegs, ArgvOnStack, NoBuiltinExit);
      51           4 :   } else if (rs == 2 && sd == kSaveFPRegs && am == kArgvOnStack && be) {
      52           0 :     return CENTRY_CODE(Return2, SaveFPRegs, ArgvOnStack, BuiltinExit);
      53             :   }
      54             : 
      55           4 :   UNREACHABLE();
      56             : }
      57             : 
      58             : #undef CENTRY_CODE
      59             : 
      60             : // static
      61        1288 : Callable CodeFactory::ApiGetter(Isolate* isolate) {
      62        1288 :   return Builtins::CallableFor(isolate, Builtins::kCallApiGetter);
      63             : }
      64             : 
      65             : // static
      66       11508 : Callable CodeFactory::CallApiCallback(Isolate* isolate) {
      67       11508 :   return Builtins::CallableFor(isolate, Builtins::kCallApiCallback);
      68             : }
      69             : 
      70             : // static
      71      405966 : Callable CodeFactory::LoadGlobalIC(Isolate* isolate, TypeofMode typeof_mode) {
      72             :   return typeof_mode == NOT_INSIDE_TYPEOF
      73             :              ? Builtins::CallableFor(isolate, Builtins::kLoadGlobalICTrampoline)
      74             :              : Builtins::CallableFor(
      75      405966 :                    isolate, Builtins::kLoadGlobalICInsideTypeofTrampoline);
      76             : }
      77             : 
      78             : // static
      79         200 : Callable CodeFactory::LoadGlobalICInOptimizedCode(Isolate* isolate,
      80             :                                                   TypeofMode typeof_mode) {
      81             :   return typeof_mode == NOT_INSIDE_TYPEOF
      82             :              ? Builtins::CallableFor(isolate, Builtins::kLoadGlobalIC)
      83             :              : Builtins::CallableFor(isolate,
      84         200 :                                      Builtins::kLoadGlobalICInsideTypeof);
      85             : }
      86             : 
      87       29062 : Callable CodeFactory::StoreOwnIC(Isolate* isolate) {
      88             :   // TODO(ishell): Currently we use StoreOwnIC only for storing properties that
      89             :   // already exist in the boilerplate therefore we can use StoreIC.
      90       29062 :   return Builtins::CallableFor(isolate, Builtins::kStoreICTrampoline);
      91             : }
      92             : 
      93         205 : Callable CodeFactory::StoreOwnICInOptimizedCode(Isolate* isolate) {
      94             :   // TODO(ishell): Currently we use StoreOwnIC only for storing properties that
      95             :   // already exist in the boilerplate therefore we can use StoreIC.
      96         205 :   return Builtins::CallableFor(isolate, Builtins::kStoreIC);
      97             : }
      98             : 
      99           0 : Callable CodeFactory::KeyedStoreIC_SloppyArguments(Isolate* isolate,
     100             :                                                    KeyedAccessStoreMode mode) {
     101             :   Builtins::Name builtin_index;
     102           0 :   switch (mode) {
     103             :     case STANDARD_STORE:
     104             :       builtin_index = Builtins::kKeyedStoreIC_SloppyArguments_Standard;
     105             :       break;
     106             :     case STORE_AND_GROW_NO_TRANSITION_HANDLE_COW:
     107             :       builtin_index =
     108             :           Builtins::kKeyedStoreIC_SloppyArguments_GrowNoTransitionHandleCOW;
     109           0 :       break;
     110             :     case STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS:
     111             :       builtin_index =
     112             :           Builtins::kKeyedStoreIC_SloppyArguments_NoTransitionIgnoreOOB;
     113           0 :       break;
     114             :     case STORE_NO_TRANSITION_HANDLE_COW:
     115             :       builtin_index =
     116             :           Builtins::kKeyedStoreIC_SloppyArguments_NoTransitionHandleCOW;
     117           0 :       break;
     118             :     default:
     119           0 :       UNREACHABLE();
     120             :   }
     121           0 :   return isolate->builtins()->CallableFor(isolate, builtin_index);
     122             : }
     123             : 
     124        1395 : Callable CodeFactory::KeyedStoreIC_Slow(Isolate* isolate,
     125             :                                         KeyedAccessStoreMode mode) {
     126             :   Builtins::Name builtin_index;
     127        1395 :   switch (mode) {
     128             :     case STANDARD_STORE:
     129             :       builtin_index = Builtins::kKeyedStoreIC_Slow_Standard;
     130             :       break;
     131             :     case STORE_AND_GROW_NO_TRANSITION_HANDLE_COW:
     132             :       builtin_index = Builtins::kKeyedStoreIC_Slow_GrowNoTransitionHandleCOW;
     133         389 :       break;
     134             :     case STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS:
     135             :       builtin_index = Builtins::kKeyedStoreIC_Slow_NoTransitionIgnoreOOB;
     136           0 :       break;
     137             :     case STORE_NO_TRANSITION_HANDLE_COW:
     138             :       builtin_index = Builtins::kKeyedStoreIC_Slow_NoTransitionHandleCOW;
     139           9 :       break;
     140             :     default:
     141           0 :       UNREACHABLE();
     142             :   }
     143        2790 :   return isolate->builtins()->CallableFor(isolate, builtin_index);
     144             : }
     145             : 
     146          36 : Callable CodeFactory::StoreInArrayLiteralIC_Slow(Isolate* isolate,
     147             :                                                  KeyedAccessStoreMode mode) {
     148             :   Builtins::Name builtin_index;
     149          36 :   switch (mode) {
     150             :     case STANDARD_STORE:
     151             :       builtin_index = Builtins::kStoreInArrayLiteralIC_Slow_Standard;
     152             :       break;
     153             :     case STORE_AND_GROW_NO_TRANSITION_HANDLE_COW:
     154             :       builtin_index =
     155             :           Builtins::kStoreInArrayLiteralIC_Slow_GrowNoTransitionHandleCOW;
     156          36 :       break;
     157             :     case STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS:
     158             :       builtin_index =
     159             :           Builtins::kStoreInArrayLiteralIC_Slow_NoTransitionIgnoreOOB;
     160           0 :       break;
     161             :     case STORE_NO_TRANSITION_HANDLE_COW:
     162             :       builtin_index =
     163             :           Builtins::kStoreInArrayLiteralIC_Slow_NoTransitionHandleCOW;
     164           0 :       break;
     165             :     default:
     166           0 :       UNREACHABLE();
     167             :   }
     168          72 :   return isolate->builtins()->CallableFor(isolate, builtin_index);
     169             : }
     170             : 
     171        1696 : Callable CodeFactory::ElementsTransitionAndStore(Isolate* isolate,
     172             :                                                  KeyedAccessStoreMode mode) {
     173             :   Builtins::Name builtin_index;
     174        1696 :   switch (mode) {
     175             :     case STANDARD_STORE:
     176             :       builtin_index = Builtins::kElementsTransitionAndStore_Standard;
     177             :       break;
     178             :     case STORE_AND_GROW_NO_TRANSITION_HANDLE_COW:
     179             :       builtin_index =
     180             :           Builtins::kElementsTransitionAndStore_GrowNoTransitionHandleCOW;
     181         223 :       break;
     182             :     case STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS:
     183             :       builtin_index =
     184             :           Builtins::kElementsTransitionAndStore_NoTransitionIgnoreOOB;
     185           0 :       break;
     186             :     case STORE_NO_TRANSITION_HANDLE_COW:
     187             :       builtin_index =
     188             :           Builtins::kElementsTransitionAndStore_NoTransitionHandleCOW;
     189         213 :       break;
     190             :     default:
     191           0 :       UNREACHABLE();
     192             :   }
     193        3392 :   return isolate->builtins()->CallableFor(isolate, builtin_index);
     194             : }
     195             : 
     196      217692 : Callable CodeFactory::StoreFastElementIC(Isolate* isolate,
     197             :                                          KeyedAccessStoreMode mode) {
     198             :   Builtins::Name builtin_index;
     199      217692 :   switch (mode) {
     200             :     case STANDARD_STORE:
     201             :       builtin_index = Builtins::kStoreFastElementIC_Standard;
     202             :       break;
     203             :     case STORE_AND_GROW_NO_TRANSITION_HANDLE_COW:
     204             :       builtin_index = Builtins::kStoreFastElementIC_GrowNoTransitionHandleCOW;
     205       11280 :       break;
     206             :     case STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS:
     207             :       builtin_index = Builtins::kStoreFastElementIC_NoTransitionIgnoreOOB;
     208         978 :       break;
     209             :     case STORE_NO_TRANSITION_HANDLE_COW:
     210             :       builtin_index = Builtins::kStoreFastElementIC_NoTransitionHandleCOW;
     211        1672 :       break;
     212             :     default:
     213           0 :       UNREACHABLE();
     214             :   }
     215      435383 :   return isolate->builtins()->CallableFor(isolate, builtin_index);
     216             : }
     217             : 
     218             : // static
     219           0 : Callable CodeFactory::BinaryOperation(Isolate* isolate, Operation op) {
     220           0 :   switch (op) {
     221             :     case Operation::kShiftRight:
     222           0 :       return Builtins::CallableFor(isolate, Builtins::kShiftRight);
     223             :     case Operation::kShiftLeft:
     224           0 :       return Builtins::CallableFor(isolate, Builtins::kShiftLeft);
     225             :     case Operation::kShiftRightLogical:
     226           0 :       return Builtins::CallableFor(isolate, Builtins::kShiftRightLogical);
     227             :     case Operation::kAdd:
     228           0 :       return Builtins::CallableFor(isolate, Builtins::kAdd);
     229             :     case Operation::kSubtract:
     230           0 :       return Builtins::CallableFor(isolate, Builtins::kSubtract);
     231             :     case Operation::kMultiply:
     232           0 :       return Builtins::CallableFor(isolate, Builtins::kMultiply);
     233             :     case Operation::kDivide:
     234           0 :       return Builtins::CallableFor(isolate, Builtins::kDivide);
     235             :     case Operation::kModulus:
     236           0 :       return Builtins::CallableFor(isolate, Builtins::kModulus);
     237             :     case Operation::kBitwiseOr:
     238           0 :       return Builtins::CallableFor(isolate, Builtins::kBitwiseOr);
     239             :     case Operation::kBitwiseAnd:
     240           0 :       return Builtins::CallableFor(isolate, Builtins::kBitwiseAnd);
     241             :     case Operation::kBitwiseXor:
     242           0 :       return Builtins::CallableFor(isolate, Builtins::kBitwiseXor);
     243             :     default:
     244             :       break;
     245             :   }
     246           0 :   UNREACHABLE();
     247             : }
     248             : 
     249             : // static
     250        3533 : Callable CodeFactory::NonPrimitiveToPrimitive(Isolate* isolate,
     251             :                                               ToPrimitiveHint hint) {
     252             :   return Callable(isolate->builtins()->NonPrimitiveToPrimitive(hint),
     253        7066 :                   TypeConversionDescriptor{});
     254             : }
     255             : 
     256             : // static
     257         280 : Callable CodeFactory::OrdinaryToPrimitive(Isolate* isolate,
     258             :                                           OrdinaryToPrimitiveHint hint) {
     259             :   return Callable(isolate->builtins()->OrdinaryToPrimitive(hint),
     260         560 :                   TypeConversionDescriptor{});
     261             : }
     262             : 
     263             : // static
     264       44084 : Callable CodeFactory::StringAdd(Isolate* isolate, StringAddFlags flags) {
     265       44084 :   switch (flags) {
     266             :     case STRING_ADD_CHECK_NONE:
     267       21059 :       return Builtins::CallableFor(isolate, Builtins::kStringAdd_CheckNone);
     268             :     case STRING_ADD_CONVERT_LEFT:
     269        6463 :       return Builtins::CallableFor(isolate, Builtins::kStringAdd_ConvertLeft);
     270             :     case STRING_ADD_CONVERT_RIGHT:
     271       16562 :       return Builtins::CallableFor(isolate, Builtins::kStringAdd_ConvertRight);
     272             :   }
     273           0 :   UNREACHABLE();
     274             : }
     275             : 
     276             : // static
     277         504 : Callable CodeFactory::ResumeGenerator(Isolate* isolate) {
     278         504 :   return Builtins::CallableFor(isolate, Builtins::kResumeGeneratorTrampoline);
     279             : }
     280             : 
     281             : // static
     282        1176 : Callable CodeFactory::FrameDropperTrampoline(Isolate* isolate) {
     283        1176 :   return Builtins::CallableFor(isolate, Builtins::kFrameDropperTrampoline);
     284             : }
     285             : 
     286             : // static
     287         978 : Callable CodeFactory::HandleDebuggerStatement(Isolate* isolate) {
     288         978 :   return Builtins::CallableFor(isolate, Builtins::kHandleDebuggerStatement);
     289             : }
     290             : 
     291             : // static
     292        4634 : Callable CodeFactory::FastNewFunctionContext(Isolate* isolate,
     293             :                                              ScopeType scope_type) {
     294        4634 :   switch (scope_type) {
     295             :     case ScopeType::EVAL_SCOPE:
     296             :       return Builtins::CallableFor(isolate,
     297           0 :                                    Builtins::kFastNewFunctionContextEval);
     298             :     case ScopeType::FUNCTION_SCOPE:
     299             :       return Builtins::CallableFor(isolate,
     300        4634 :                                    Builtins::kFastNewFunctionContextFunction);
     301             :     default:
     302           0 :       UNREACHABLE();
     303             :   }
     304             : }
     305             : 
     306             : // static
     307       61486 : Callable CodeFactory::ArgumentAdaptor(Isolate* isolate) {
     308       61486 :   return Builtins::CallableFor(isolate, Builtins::kArgumentsAdaptorTrampoline);
     309             : }
     310             : 
     311             : // static
     312      294180 : Callable CodeFactory::Call(Isolate* isolate, ConvertReceiverMode mode) {
     313      588358 :   return Callable(isolate->builtins()->Call(mode), CallTrampolineDescriptor{});
     314             : }
     315             : 
     316             : // static
     317         352 : Callable CodeFactory::CallWithArrayLike(Isolate* isolate) {
     318         352 :   return Builtins::CallableFor(isolate, Builtins::kCallWithArrayLike);
     319             : }
     320             : 
     321             : // static
     322         889 : Callable CodeFactory::CallWithSpread(Isolate* isolate) {
     323         889 :   return Builtins::CallableFor(isolate, Builtins::kCallWithSpread);
     324             : }
     325             : 
     326             : // static
     327       23451 : Callable CodeFactory::CallFunction(Isolate* isolate, ConvertReceiverMode mode) {
     328             :   return Callable(isolate->builtins()->CallFunction(mode),
     329       46905 :                   CallTrampolineDescriptor{});
     330             : }
     331             : 
     332             : // static
     333         224 : Callable CodeFactory::CallVarargs(Isolate* isolate) {
     334         224 :   return Builtins::CallableFor(isolate, Builtins::kCallVarargs);
     335             : }
     336             : 
     337             : // static
     338          74 : Callable CodeFactory::CallForwardVarargs(Isolate* isolate) {
     339          74 :   return Builtins::CallableFor(isolate, Builtins::kCallForwardVarargs);
     340             : }
     341             : 
     342             : // static
     343         301 : Callable CodeFactory::CallFunctionForwardVarargs(Isolate* isolate) {
     344         301 :   return Builtins::CallableFor(isolate, Builtins::kCallFunctionForwardVarargs);
     345             : }
     346             : 
     347             : // static
     348       11299 : Callable CodeFactory::Construct(Isolate* isolate) {
     349       11299 :   return Builtins::CallableFor(isolate, Builtins::kConstruct);
     350             : }
     351             : 
     352             : // static
     353          60 : Callable CodeFactory::ConstructWithSpread(Isolate* isolate) {
     354          60 :   return Builtins::CallableFor(isolate, Builtins::kConstructWithSpread);
     355             : }
     356             : 
     357             : // static
     358           0 : Callable CodeFactory::ConstructFunction(Isolate* isolate) {
     359           0 :   return Builtins::CallableFor(isolate, Builtins::kConstructFunction);
     360             : }
     361             : 
     362             : // static
     363         224 : Callable CodeFactory::ConstructVarargs(Isolate* isolate) {
     364         224 :   return Builtins::CallableFor(isolate, Builtins::kConstructVarargs);
     365             : }
     366             : 
     367             : // static
     368          45 : Callable CodeFactory::ConstructForwardVarargs(Isolate* isolate) {
     369          45 :   return Builtins::CallableFor(isolate, Builtins::kConstructForwardVarargs);
     370             : }
     371             : 
     372             : // static
     373         644 : Callable CodeFactory::ConstructFunctionForwardVarargs(Isolate* isolate) {
     374             :   return Builtins::CallableFor(isolate,
     375         644 :                                Builtins::kConstructFunctionForwardVarargs);
     376             : }
     377             : 
     378             : // static
     379        1176 : Callable CodeFactory::InterpreterPushArgsThenCall(
     380             :     Isolate* isolate, ConvertReceiverMode receiver_mode,
     381             :     InterpreterPushArgsMode mode) {
     382        1176 :   switch (mode) {
     383             :     case InterpreterPushArgsMode::kArrayFunction:
     384             :       // There is no special-case handling of calls to Array. They will all go
     385             :       // through the kOther case below.
     386           0 :       UNREACHABLE();
     387             :     case InterpreterPushArgsMode::kWithFinalSpread:
     388             :       return Builtins::CallableFor(
     389         168 :           isolate, Builtins::kInterpreterPushArgsThenCallWithFinalSpread);
     390             :     case InterpreterPushArgsMode::kOther:
     391        1008 :       switch (receiver_mode) {
     392             :         case ConvertReceiverMode::kNullOrUndefined:
     393             :           return Builtins::CallableFor(
     394         336 :               isolate, Builtins::kInterpreterPushUndefinedAndArgsThenCall);
     395             :         case ConvertReceiverMode::kNotNullOrUndefined:
     396             :         case ConvertReceiverMode::kAny:
     397             :           return Builtins::CallableFor(isolate,
     398         672 :                                        Builtins::kInterpreterPushArgsThenCall);
     399             :       }
     400             :   }
     401           0 :   UNREACHABLE();
     402             : }
     403             : 
     404             : // static
     405         504 : Callable CodeFactory::InterpreterPushArgsThenConstruct(
     406             :     Isolate* isolate, InterpreterPushArgsMode mode) {
     407         504 :   switch (mode) {
     408             :     case InterpreterPushArgsMode::kArrayFunction:
     409             :       return Builtins::CallableFor(
     410         168 :           isolate, Builtins::kInterpreterPushArgsThenConstructArrayFunction);
     411             :     case InterpreterPushArgsMode::kWithFinalSpread:
     412             :       return Builtins::CallableFor(
     413         168 :           isolate, Builtins::kInterpreterPushArgsThenConstructWithFinalSpread);
     414             :     case InterpreterPushArgsMode::kOther:
     415             :       return Builtins::CallableFor(isolate,
     416         168 :                                    Builtins::kInterpreterPushArgsThenConstruct);
     417             :   }
     418           0 :   UNREACHABLE();
     419             : }
     420             : 
     421             : // static
     422         348 : Callable CodeFactory::InterpreterCEntry(Isolate* isolate, int result_size) {
     423             :   // Note: If we ever use fpregs in the interpreter then we will need to
     424             :   // save fpregs too.
     425             :   Handle<Code> code = CodeFactory::CEntry(isolate, result_size, kDontSaveFPRegs,
     426         348 :                                           kArgvInRegister);
     427         348 :   if (result_size == 1) {
     428             :     return Callable(code, InterpreterCEntry1Descriptor{});
     429             :   } else {
     430             :     DCHECK_EQ(result_size, 2);
     431             :     return Callable(code, InterpreterCEntry2Descriptor{});
     432             :   }
     433             : }
     434             : 
     435             : // static
     436         168 : Callable CodeFactory::InterpreterOnStackReplacement(Isolate* isolate) {
     437             :   return Builtins::CallableFor(isolate,
     438         168 :                                Builtins::kInterpreterOnStackReplacement);
     439             : }
     440             : 
     441             : // static
     442         392 : Callable CodeFactory::ArrayNoArgumentConstructor(
     443             :     Isolate* isolate, ElementsKind kind,
     444             :     AllocationSiteOverrideMode override_mode) {
     445             : #define CASE(kind_caps, kind_camel, mode_camel) \
     446             :   case kind_caps:                               \
     447             :     return Builtins::CallableFor(               \
     448             :         isolate,                                \
     449             :         Builtins::kArrayNoArgumentConstructor_##kind_camel##_##mode_camel);
     450         392 :   if (override_mode == DONT_OVERRIDE && AllocationSite::ShouldTrack(kind)) {
     451             :     DCHECK(IsSmiElementsKind(kind));
     452         112 :     switch (kind) {
     453          56 :       CASE(PACKED_SMI_ELEMENTS, PackedSmi, DontOverride);
     454          56 :       CASE(HOLEY_SMI_ELEMENTS, HoleySmi, DontOverride);
     455             :       default:
     456           0 :         UNREACHABLE();
     457             :     }
     458             :   } else {
     459             :     DCHECK(override_mode == DISABLE_ALLOCATION_SITES ||
     460             :            !AllocationSite::ShouldTrack(kind));
     461         280 :     switch (kind) {
     462          56 :       CASE(PACKED_SMI_ELEMENTS, PackedSmi, DisableAllocationSites);
     463           0 :       CASE(HOLEY_SMI_ELEMENTS, HoleySmi, DisableAllocationSites);
     464          56 :       CASE(PACKED_ELEMENTS, Packed, DisableAllocationSites);
     465          56 :       CASE(HOLEY_ELEMENTS, Holey, DisableAllocationSites);
     466          56 :       CASE(PACKED_DOUBLE_ELEMENTS, PackedDouble, DisableAllocationSites);
     467          56 :       CASE(HOLEY_DOUBLE_ELEMENTS, HoleyDouble, DisableAllocationSites);
     468             :       default:
     469           0 :         UNREACHABLE();
     470             :     }
     471             :   }
     472             : #undef CASE
     473             : }
     474             : 
     475             : // static
     476         392 : Callable CodeFactory::ArraySingleArgumentConstructor(
     477             :     Isolate* isolate, ElementsKind kind,
     478             :     AllocationSiteOverrideMode override_mode) {
     479             : #define CASE(kind_caps, kind_camel, mode_camel) \
     480             :   case kind_caps:                               \
     481             :     return Builtins::CallableFor(               \
     482             :         isolate,                                \
     483             :         Builtins::kArraySingleArgumentConstructor_##kind_camel##_##mode_camel)
     484         392 :   if (override_mode == DONT_OVERRIDE && AllocationSite::ShouldTrack(kind)) {
     485             :     DCHECK(IsSmiElementsKind(kind));
     486         112 :     switch (kind) {
     487          56 :       CASE(PACKED_SMI_ELEMENTS, PackedSmi, DontOverride);
     488          56 :       CASE(HOLEY_SMI_ELEMENTS, HoleySmi, DontOverride);
     489             :       default:
     490           0 :         UNREACHABLE();
     491             :     }
     492             :   } else {
     493             :     DCHECK(override_mode == DISABLE_ALLOCATION_SITES ||
     494             :            !AllocationSite::ShouldTrack(kind));
     495         280 :     switch (kind) {
     496           0 :       CASE(PACKED_SMI_ELEMENTS, PackedSmi, DisableAllocationSites);
     497          56 :       CASE(HOLEY_SMI_ELEMENTS, HoleySmi, DisableAllocationSites);
     498          56 :       CASE(PACKED_ELEMENTS, Packed, DisableAllocationSites);
     499          56 :       CASE(HOLEY_ELEMENTS, Holey, DisableAllocationSites);
     500          56 :       CASE(PACKED_DOUBLE_ELEMENTS, PackedDouble, DisableAllocationSites);
     501          56 :       CASE(HOLEY_DOUBLE_ELEMENTS, HoleyDouble, DisableAllocationSites);
     502             :       default:
     503           0 :         UNREACHABLE();
     504             :     }
     505             :   }
     506             : #undef CASE
     507             : }
     508             : 
     509             : }  // namespace internal
     510      183867 : }  // namespace v8

Generated by: LCOV version 1.10