LCOV - code coverage report
Current view: top level - src/runtime - runtime-operators.cc (source / functions) Hit Total Coverage
Test: app.info Lines: 56 56 100.0 %
Date: 2019-01-20 Functions: 11 20 55.0 %

          Line data    Source code
       1             : // Copyright 2014 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/arguments.h"
       6             : #include "src/counters.h"
       7             : #include "src/isolate-inl.h"
       8             : #include "src/runtime/runtime-utils.h"
       9             : 
      10             : namespace v8 {
      11             : namespace internal {
      12             : 
      13          40 : RUNTIME_FUNCTION(Runtime_Add) {
      14          40 :   HandleScope scope(isolate);
      15             :   DCHECK_EQ(2, args.length());
      16          40 :   CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0);
      17          40 :   CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1);
      18         120 :   RETURN_RESULT_OR_FAILURE(isolate, Object::Add(isolate, lhs, rhs));
      19             : }
      20             : 
      21             : 
      22         495 : RUNTIME_FUNCTION(Runtime_Equal) {
      23         495 :   HandleScope scope(isolate);
      24             :   DCHECK_EQ(2, args.length());
      25         495 :   CONVERT_ARG_HANDLE_CHECKED(Object, x, 0);
      26         495 :   CONVERT_ARG_HANDLE_CHECKED(Object, y, 1);
      27         495 :   Maybe<bool> result = Object::Equals(isolate, x, y);
      28         495 :   if (result.IsNothing()) return ReadOnlyRoots(isolate).exception();
      29         495 :   return isolate->heap()->ToBoolean(result.FromJust());
      30             : }
      31             : 
      32         378 : RUNTIME_FUNCTION(Runtime_NotEqual) {
      33         378 :   HandleScope scope(isolate);
      34             :   DCHECK_EQ(2, args.length());
      35         378 :   CONVERT_ARG_HANDLE_CHECKED(Object, x, 0);
      36         378 :   CONVERT_ARG_HANDLE_CHECKED(Object, y, 1);
      37         378 :   Maybe<bool> result = Object::Equals(isolate, x, y);
      38         378 :   if (result.IsNothing()) return ReadOnlyRoots(isolate).exception();
      39         378 :   return isolate->heap()->ToBoolean(!result.FromJust());
      40             : }
      41             : 
      42          54 : RUNTIME_FUNCTION(Runtime_StrictEqual) {
      43             :   SealHandleScope scope(isolate);
      44             :   DCHECK_EQ(2, args.length());
      45         108 :   CONVERT_ARG_CHECKED(Object, x, 0);
      46         108 :   CONVERT_ARG_CHECKED(Object, y, 1);
      47          54 :   return isolate->heap()->ToBoolean(x->StrictEquals(y));
      48             : }
      49             : 
      50          54 : RUNTIME_FUNCTION(Runtime_StrictNotEqual) {
      51             :   SealHandleScope scope(isolate);
      52             :   DCHECK_EQ(2, args.length());
      53         108 :   CONVERT_ARG_CHECKED(Object, x, 0);
      54         108 :   CONVERT_ARG_CHECKED(Object, y, 1);
      55          54 :   return isolate->heap()->ToBoolean(!x->StrictEquals(y));
      56             : }
      57             : 
      58         117 : RUNTIME_FUNCTION(Runtime_LessThan) {
      59         117 :   HandleScope scope(isolate);
      60             :   DCHECK_EQ(2, args.length());
      61         117 :   CONVERT_ARG_HANDLE_CHECKED(Object, x, 0);
      62         117 :   CONVERT_ARG_HANDLE_CHECKED(Object, y, 1);
      63         117 :   Maybe<bool> result = Object::LessThan(isolate, x, y);
      64         117 :   if (result.IsNothing()) return ReadOnlyRoots(isolate).exception();
      65          99 :   return isolate->heap()->ToBoolean(result.FromJust());
      66             : }
      67             : 
      68          99 : RUNTIME_FUNCTION(Runtime_GreaterThan) {
      69          99 :   HandleScope scope(isolate);
      70             :   DCHECK_EQ(2, args.length());
      71          99 :   CONVERT_ARG_HANDLE_CHECKED(Object, x, 0);
      72          99 :   CONVERT_ARG_HANDLE_CHECKED(Object, y, 1);
      73          99 :   Maybe<bool> result = Object::GreaterThan(isolate, x, y);
      74          99 :   if (result.IsNothing()) return ReadOnlyRoots(isolate).exception();
      75          99 :   return isolate->heap()->ToBoolean(result.FromJust());
      76             : }
      77             : 
      78          72 : RUNTIME_FUNCTION(Runtime_LessThanOrEqual) {
      79          72 :   HandleScope scope(isolate);
      80             :   DCHECK_EQ(2, args.length());
      81          72 :   CONVERT_ARG_HANDLE_CHECKED(Object, x, 0);
      82          72 :   CONVERT_ARG_HANDLE_CHECKED(Object, y, 1);
      83          72 :   Maybe<bool> result = Object::LessThanOrEqual(isolate, x, y);
      84          72 :   if (result.IsNothing()) return ReadOnlyRoots(isolate).exception();
      85          72 :   return isolate->heap()->ToBoolean(result.FromJust());
      86             : }
      87             : 
      88          81 : RUNTIME_FUNCTION(Runtime_GreaterThanOrEqual) {
      89          81 :   HandleScope scope(isolate);
      90             :   DCHECK_EQ(2, args.length());
      91          81 :   CONVERT_ARG_HANDLE_CHECKED(Object, x, 0);
      92          81 :   CONVERT_ARG_HANDLE_CHECKED(Object, y, 1);
      93          81 :   Maybe<bool> result = Object::GreaterThanOrEqual(isolate, x, y);
      94          81 :   if (result.IsNothing()) return ReadOnlyRoots(isolate).exception();
      95          81 :   return isolate->heap()->ToBoolean(result.FromJust());
      96             : }
      97             : 
      98             : }  // namespace internal
      99      183867 : }  // namespace v8

Generated by: LCOV version 1.10