internal.tq 1.68 KB
Newer Older
1 2 3 4 5 6 7 8 9
// 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;
10 11
extern runtime BytecodeBudgetInterruptFromCode(implicit context: Context)(
    FeedbackCell): JSAny;
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
}

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<FeedbackVector>(maybeFeedbackVector) otherwise CallRuntime;
    return Cast<JSArray>(ic::LoadFeedbackVectorSlot(vector, slot))
        otherwise CallRuntime;
  } label CallRuntime deferred {
    const result = UnsafeCast<JSArray>(runtime::GetTemplateObject(
        description, shared, Convert<Smi>(Signed(slot))));
    const vector =
        Cast<FeedbackVector>(maybeFeedbackVector) otherwise return result;
    ic::StoreFeedbackVectorSlot(vector, slot, result);
    return result;
  }
}

37 38 39 40 41 42 43
builtin BytecodeBudgetInterruptFromCode(implicit context: Context)(
    feedbackCell: FeedbackCell): Object {
  // The runtime call is wrapped by a builtin since the calling sequence in
  // generated code is shorter for builtins than for runtime calls.
  tail runtime::BytecodeBudgetInterruptFromCode(feedbackCell);
}

44
}  // namespace internal