// Copyright 2020 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. namespace internal { namespace runtime { extern runtime GetTemplateObject(implicit context: Context)( TemplateObjectDescription, SharedFunctionInfo, Smi): JSAny; } builtin GetTemplateObject( context: Context, shared: SharedFunctionInfo, description: TemplateObjectDescription, slot: uintptr, maybeFeedbackVector: FeedbackVector|Undefined): JSArray { // TODO(jgruber): Consider merging with the GetTemplateObject bytecode // handler; the current advantage of the split implementation is that the // bytecode can skip most work if feedback exists. try { const vector = Cast(maybeFeedbackVector) otherwise CallRuntime; return Cast(ic::LoadFeedbackVectorSlot(vector, slot)) otherwise CallRuntime; } label CallRuntime deferred { const result = UnsafeCast(runtime::GetTemplateObject( description, shared, Convert(Signed(slot)))); const vector = Cast(maybeFeedbackVector) otherwise return result; ic::StoreFeedbackVectorSlot(vector, slot, result); return result; } } } // namespace internal