boolean.tq 695 Bytes
Newer Older
1 2 3 4 5 6
// Copyright 2019 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 boolean {
  javascript builtin
7
  BooleanConstructor(
8 9
      js-implicit context: Context, receiver: JSAny, newTarget: JSAny,
      target: JSFunction)(...arguments): JSAny {
10 11 12 13 14 15 16 17
    const value = SelectBooleanConstant(ToBoolean(arguments[0]));

    if (newTarget == Undefined) {
      return value;
    }

    const map = GetDerivedMap(target, UnsafeCast<JSReceiver>(newTarget));

18 19
    const obj =
        UnsafeCast<JSPrimitiveWrapper>(AllocateFastOrSlowJSObjectFromMap(map));
20 21 22 23
    obj.value = value;
    return obj;
  }
}