LCOV - code coverage report
Current view: top level - src - code-factory.cc (source / functions) Hit Total Coverage
Test: app.info Lines: 131 182 72.0 %
Date: 2019-04-19 Functions: 39 42 92.9 %

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

Generated by: LCOV version 1.10