| // 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 |
| BooleanConstructor( |
| js-implicit context: Context, receiver: Object, newTarget: Object, |
| target: JSFunction)(...arguments): Object { |
| const value = SelectBooleanConstant(ToBoolean(arguments[0])); |
| |
| if (newTarget == Undefined) { |
| return value; |
| } |
| |
| const map = GetDerivedMap(target, UnsafeCast<JSReceiver>(newTarget)); |
| |
| const obj = |
| UnsafeCast<JSPrimitiveWrapper>(AllocateFastOrSlowJSObjectFromMap(map)); |
| obj.value = value; |
| return obj; |
| } |
| } |