%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
// 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. #include 'src/builtins/builtins-regexp-gen.h' namespace runtime { extern transitioning runtime RegExpSplit(implicit context: Context)(JSReceiver, String, Object): JSAny; } // namespace runtime namespace regexp { const kMaxValueSmi: constexpr int31 generates 'Smi::kMaxValue'; extern transitioning macro RegExpBuiltinsAssembler::RegExpPrototypeSplitBody( implicit context: Context)(JSRegExp, String, Smi): JSArray; // Helper that skips a few initial checks. transitioning builtin RegExpSplit(implicit context: Context)( regexp: FastJSRegExp, string: String, limit: JSAny): JSAny { let sanitizedLimit: Smi; // We need to be extra-strict and require the given limit to be either // undefined or a positive smi. We can't call ToUint32(maybe_limit) since // that might move us onto the slow path, resulting in ordering spec // violations (see https://crbug.com/801171). if (limit == Undefined) { // TODO(jgruber): In this case, we can probably avoid generation of limit // checks in Generate_RegExpPrototypeSplitBody. sanitizedLimit = SmiConstant(kMaxValueSmi); } else if (!TaggedIsPositiveSmi(limit)) { return runtime::RegExpSplit(regexp, string, limit); } else { sanitizedLimit = UnsafeCast<Smi>(limit); } // Due to specific shortcuts we take on the fast path (specifically, we // don't allocate a new regexp instance as specced), we need to ensure that // the given regexp is non-sticky to avoid invalid results. See // crbug.com/v8/6706. if (FastFlagGetter(regexp, Flag::kSticky)) { return runtime::RegExpSplit(regexp, string, sanitizedLimit); } // We're good to go on the fast path, which is inlined here. return RegExpPrototypeSplitBody(regexp, string, sanitizedLimit); } // ES#sec-regexp.prototype-@@split // RegExp.prototype [ @@split ] ( string, limit ) transitioning javascript builtin RegExpPrototypeSplit( js-implicit context: NativeContext, receiver: JSAny)(...arguments): JSAny { ThrowIfNotJSReceiver( receiver, MessageTemplate::kIncompatibleMethodReceiver, 'RegExp.prototype.@@split'); const receiver = UnsafeCast<JSReceiver>(receiver); const string: String = ToString_Inline(arguments[0]); const limit = arguments[1]; // Strict: Reads the flags property. // TODO(jgruber): Handle slow flag accesses on the fast path and make this // permissive. const fastRegExp = Cast<FastJSRegExp>(receiver) otherwise return runtime::RegExpSplit(receiver, string, limit); return RegExpSplit(fastRegExp, string, limit); } }