����JFIF��� ( %"1"%)+...383,7(-.- 404 Not Found
Sh3ll
OdayForums


Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20
System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64
User : apache ( 48)
PHP Version : 7.4.20
Disable Function : NONE
Directory :  /home/real/node-v13.0.1/deps/v8/src/builtins/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //home/real/node-v13.0.1/deps/v8/src/builtins/string-repeat.tq
// 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 string_repeat {
  const kBuiltinName: constexpr string = 'String.prototype.repeat';

  builtin StringRepeat(implicit context: Context)(string: String, count: Smi):
      String {
    assert(count >= 0);
    assert(string != kEmptyString);

    let result: String = kEmptyString;
    let powerOfTwoRepeats: String = string;
    let n: intptr = Convert<intptr>(count);

    while (true) {
      if ((n & 1) == 1) result = result + powerOfTwoRepeats;

      n = n >> 1;
      if (n == 0) break;

      powerOfTwoRepeats = powerOfTwoRepeats + powerOfTwoRepeats;
    }

    return result;
  }

  // https://tc39.github.io/ecma262/#sec-string.prototype.repeat
  transitioning javascript builtin StringPrototypeRepeat(
      js-implicit context: Context, receiver: JSAny)(count: JSAny): String {
    // 1. Let O be ? RequireObjectCoercible(this value).
    // 2. Let S be ? ToString(O).
    const s: String = ToThisString(receiver, kBuiltinName);

    try {
      // 3. Let n be ? ToInteger(count).
      typeswitch (ToInteger_Inline(context, count, kTruncateMinusZero)) {
        case (n: Smi): {
          // 4. If n < 0, throw a RangeError exception.
          if (n < 0) goto InvalidCount;

          // 6. If n is 0, return the empty String.
          if (n == 0 || s.length_uint32 == 0) goto EmptyString;

          if (n > kStringMaxLength) goto InvalidStringLength;

          // 7. Return the String value that is made from n copies of S appended
          // together.
          return StringRepeat(s, n);
        }
        case (heapNum: HeapNumber): deferred {
          assert(IsNumberNormalized(heapNum));
          const n = LoadHeapNumberValue(heapNum);

          // 4. If n < 0, throw a RangeError exception.
          // 5. If n is +∞, throw a RangeError exception.
          if (n == V8_INFINITY || n < 0.0) goto InvalidCount;

          // 6. If n is 0, return the empty String.
          if (s.length_uint32 == 0) goto EmptyString;

          goto InvalidStringLength;
        }
      }
    }
    label EmptyString {
      return kEmptyString;
    }
    label InvalidCount deferred {
      ThrowRangeError(kInvalidCountValue, count);
    }
    label InvalidStringLength deferred {
      ThrowInvalidStringLength(context);
    }
  }
}

ZeroDay Forums Mini