LCOV - code coverage report
Current view: top level - src/builtins - builtins-boolean.cc (source / functions) Hit Total Coverage
Test: app.info Lines: 8 8 100.0 %
Date: 2017-04-26 Functions: 4 6 66.7 %

          Line data    Source code
       1             : // Copyright 2016 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/builtins/builtins-utils.h"
       6             : #include "src/builtins/builtins.h"
       7             : #include "src/counters.h"
       8             : #include "src/objects-inl.h"
       9             : 
      10             : namespace v8 {
      11             : namespace internal {
      12             : 
      13             : // -----------------------------------------------------------------------------
      14             : // ES6 section 19.3 Boolean Objects
      15             : 
      16             : // ES6 section 19.3.1.1 Boolean ( value ) for the [[Call]] case.
      17        6300 : BUILTIN(BooleanConstructor) {
      18             :   HandleScope scope(isolate);
      19             :   Handle<Object> value = args.atOrUndefined(isolate, 1);
      20        4200 :   return isolate->heap()->ToBoolean(value->BooleanValue());
      21             : }
      22             : 
      23             : // ES6 section 19.3.1.1 Boolean ( value ) for the [[Construct]] case.
      24        5142 : BUILTIN(BooleanConstructor_ConstructStub) {
      25             :   HandleScope scope(isolate);
      26             :   Handle<Object> value = args.atOrUndefined(isolate, 1);
      27        1714 :   Handle<JSFunction> target = args.target();
      28        1714 :   Handle<JSReceiver> new_target = Handle<JSReceiver>::cast(args.new_target());
      29             :   DCHECK(*target == target->native_context()->boolean_function());
      30             :   Handle<JSObject> result;
      31        3428 :   ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
      32             :                                      JSObject::New(target, new_target));
      33             :   Handle<JSValue>::cast(result)->set_value(
      34        3428 :       isolate->heap()->ToBoolean(value->BooleanValue()));
      35        1714 :   return *result;
      36             : }
      37             : 
      38             : }  // namespace internal
      39             : }  // namespace v8

Generated by: LCOV version 1.10