[cleanup] Drop obsolete %StringCharCodeAt intrinsic.
The previous %StringCharCodeAt runtime entry (and the inlined intrinsic) are obsolete and not used anymore (except in dedicated tests for this runtime function), so remove it. And rename the %StringCharCodeAtRT function, which is actually used to %StringCharCodeAt instead to have a consistent naming scheme for runtime fallbacks. Bug: v8:5049 Change-Id: I619429ef54f6efea61fc51ab9ed1d5cfe4417f99 Reviewed-on: https://chromium-review.googlesource.com/657719 Commit-Queue: Yang Guo <yangguo@chromium.org> Commit-Queue: Benedikt Meurer <bmeurer@chromium.org> Reviewed-by: Yang Guo <yangguo@chromium.org> Cr-Commit-Position: refs/heads/master@{#47928}
This commit is contained in:
parent
4214aa7d5a
commit
62649c8e7e
@ -3963,8 +3963,8 @@ TNode<Uint32T> CodeStubAssembler::StringCharCodeAt(
|
||||
|
||||
BIND(&if_runtime);
|
||||
{
|
||||
Node* result = CallRuntime(Runtime::kStringCharCodeAtRT,
|
||||
NoContextConstant(), string, SmiTag(index));
|
||||
Node* result = CallRuntime(Runtime::kStringCharCodeAt, NoContextConstant(),
|
||||
string, SmiTag(index));
|
||||
var_result.Bind(SmiToWord32(result));
|
||||
Goto(&return_result);
|
||||
}
|
||||
|
@ -281,7 +281,6 @@ bool IntrinsicHasNoSideEffect(Runtime::FunctionId id) {
|
||||
V(NewTypeError) \
|
||||
V(ThrowInvalidStringLength) \
|
||||
/* Strings */ \
|
||||
V(StringCharCodeAt) \
|
||||
V(StringIndexOf) \
|
||||
V(StringIncludes) \
|
||||
V(StringReplaceOneCharWithString) \
|
||||
@ -297,7 +296,7 @@ bool IntrinsicHasNoSideEffect(Runtime::FunctionId id) {
|
||||
/* Called from builtins */ \
|
||||
V(StringParseFloat) \
|
||||
V(StringParseInt) \
|
||||
V(StringCharCodeAtRT) \
|
||||
V(StringCharCodeAt) \
|
||||
V(StringIndexOfUnchecked) \
|
||||
V(StringEqual) \
|
||||
V(SymbolDescriptiveString) \
|
||||
|
@ -267,7 +267,7 @@ RUNTIME_FUNCTION(Runtime_InternalizeString) {
|
||||
return *isolate->factory()->InternalizeString(string);
|
||||
}
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_StringCharCodeAtRT) {
|
||||
RUNTIME_FUNCTION(Runtime_StringCharCodeAt) {
|
||||
HandleScope handle_scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
|
||||
@ -780,15 +780,6 @@ RUNTIME_FUNCTION(Runtime_StringCharFromCode) {
|
||||
return isolate->heap()->empty_string();
|
||||
}
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_StringCharCodeAt) {
|
||||
SealHandleScope shs(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
if (!args[0]->IsString()) return isolate->heap()->undefined_value();
|
||||
if (!args[1]->IsNumber()) return isolate->heap()->undefined_value();
|
||||
if (std::isinf(args.number_at(1))) return isolate->heap()->nan_value();
|
||||
return __RT_impl_Runtime_StringCharCodeAtRT(args, isolate);
|
||||
}
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_StringMaxLength) {
|
||||
SealHandleScope shs(isolate);
|
||||
return Smi::FromInt(String::kMaxLength);
|
||||
|
@ -523,7 +523,7 @@ namespace internal {
|
||||
F(SubString, 3, 1) \
|
||||
F(StringAdd, 2, 1) \
|
||||
F(InternalizeString, 1, 1) \
|
||||
F(StringCharCodeAtRT, 2, 1) \
|
||||
F(StringCharCodeAt, 2, 1) \
|
||||
F(StringCompare, 2, 1) \
|
||||
F(StringBuilderConcat, 3, 1) \
|
||||
F(StringBuilderJoin, 3, 1) \
|
||||
@ -537,7 +537,6 @@ namespace internal {
|
||||
F(StringNotEqual, 2, 1) \
|
||||
F(FlattenString, 1, 1) \
|
||||
F(StringCharFromCode, 1, 1) \
|
||||
F(StringCharCodeAt, 2, 1) \
|
||||
F(StringMaxLength, 0, 1)
|
||||
|
||||
#define FOR_EACH_INTRINSIC_SYMBOL(F) \
|
||||
|
@ -107,16 +107,6 @@ TEST(StringAdd) {
|
||||
}
|
||||
|
||||
|
||||
TEST(StringCharCodeAt) {
|
||||
FunctionTester T("(function(a,b) { return %_StringCharCodeAt(a,b); })",
|
||||
flags);
|
||||
|
||||
T.CheckCall(T.Val('e'), T.Val("huge fan!"), T.Val(3));
|
||||
T.CheckCall(T.Val('f'), T.Val("\xE2\x9D\x8A fan!"), T.Val(2));
|
||||
T.CheckCall(T.nan(), T.Val("not a fan!"), T.Val(23));
|
||||
}
|
||||
|
||||
|
||||
TEST(StringCompare) {
|
||||
FunctionTester T("(function(a,b) { return %_StringCompare(a,b); })", flags);
|
||||
|
||||
|
@ -1,81 +0,0 @@
|
||||
// Copyright 2013 the V8 project authors. All rights reserved.
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following
|
||||
// disclaimer in the documentation and/or other materials provided
|
||||
// with the distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// Flags: --allow-natives-syntax
|
||||
|
||||
var S1 = "string1";
|
||||
var S2 = "@@string2";
|
||||
|
||||
function dead1(a, b) {
|
||||
var x = %_StringCharCodeAt(a, 4);
|
||||
return a; // x is dead code
|
||||
}
|
||||
|
||||
function dead2(a, b) {
|
||||
var x = %_StringCharCodeAt(a, 3);
|
||||
var y = %_StringCharCodeAt(b, 1);
|
||||
return a; // x and y are both dead
|
||||
}
|
||||
|
||||
function dead3(a, b) {
|
||||
a = a ? "11" : "12";
|
||||
b = b ? "13" : "14";
|
||||
var x = %_StringCharCodeAt(a, 2);
|
||||
var y = %_StringCharCodeAt(b, 0);
|
||||
return a; // x and y are both dead
|
||||
}
|
||||
|
||||
function test() {
|
||||
var S3 = S1 + S2;
|
||||
|
||||
assertEquals(S1, dead1(S1, S2));
|
||||
assertEquals(S1, dead2(S1, S2));
|
||||
assertEquals("11", dead3(S1, S2));
|
||||
|
||||
assertEquals(S2, dead1(S2, 677));
|
||||
assertEquals(S2, dead2(S2, S3));
|
||||
assertEquals("11", dead3(S2, S3));
|
||||
|
||||
assertEquals(S3, dead1(S3, 399));
|
||||
assertEquals(S3, dead2(S3, "false"));
|
||||
assertEquals("12", dead3(0, 32));
|
||||
|
||||
assertEquals(S3, dead1(S3, 0));
|
||||
assertEquals(S3, dead2(S3, S1));
|
||||
assertEquals("11", dead3(S3, 0));
|
||||
|
||||
assertEquals("true", dead1("true", 0));
|
||||
assertEquals("true", dead2("true", S3));
|
||||
assertEquals("11", dead3("true", 0));
|
||||
}
|
||||
|
||||
test();
|
||||
test();
|
||||
%OptimizeFunctionOnNextCall(dead1);
|
||||
%OptimizeFunctionOnNextCall(dead2);
|
||||
%OptimizeFunctionOnNextCall(dead3);
|
||||
test();
|
@ -1,81 +0,0 @@
|
||||
// Copyright 2013 the V8 project authors. All rights reserved.
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following
|
||||
// disclaimer in the documentation and/or other materials provided
|
||||
// with the distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// Flags: --allow-natives-syntax
|
||||
|
||||
var S1 = "string1";
|
||||
var S2 = "@@string2";
|
||||
|
||||
function dead1(a, b) {
|
||||
var x = %_StringCharCodeAt(a, 4);
|
||||
return a; // x is dead code
|
||||
}
|
||||
|
||||
function dead2(a, b) {
|
||||
var x = %_StringCharCodeAt(a, 3);
|
||||
var y = %_StringCharCodeAt(b, 1);
|
||||
return a; // x and y are both dead
|
||||
}
|
||||
|
||||
function dead3(a, b) {
|
||||
a = a ? "11" : "12";
|
||||
b = b ? "13" : "14";
|
||||
var x = %_StringCharCodeAt(a, 2);
|
||||
var y = %_StringCharCodeAt(b, 0);
|
||||
return a; // x and y are both dead
|
||||
}
|
||||
|
||||
function test() {
|
||||
var S3 = S1 + S2;
|
||||
|
||||
assertEquals(S1, dead1(S1, S2));
|
||||
assertEquals(S1, dead2(S1, S2));
|
||||
assertEquals("11", dead3(S1, S2));
|
||||
|
||||
assertEquals(S2, dead1(S2, 677));
|
||||
assertEquals(S2, dead2(S2, S3));
|
||||
assertEquals("11", dead3(S2, S3));
|
||||
|
||||
assertEquals(S3, dead1(S3, 399));
|
||||
assertEquals(S3, dead2(S3, "false"));
|
||||
assertEquals("12", dead3(0, 32));
|
||||
|
||||
assertEquals(S3, dead1(S3, 0));
|
||||
assertEquals(S3, dead2(S3, S1));
|
||||
assertEquals("11", dead3(S3, 0));
|
||||
|
||||
assertEquals("true", dead1("true", 0));
|
||||
assertEquals("true", dead2("true", S3));
|
||||
assertEquals("11", dead3("true", 0));
|
||||
}
|
||||
|
||||
test();
|
||||
test();
|
||||
%OptimizeFunctionOnNextCall(dead1);
|
||||
%OptimizeFunctionOnNextCall(dead2);
|
||||
%OptimizeFunctionOnNextCall(dead3);
|
||||
test();
|
@ -239,6 +239,3 @@ for (var i = 0; i < 5; i++) {
|
||||
}
|
||||
%OptimizeFunctionOnNextCall(directlyOnPrototype);
|
||||
directlyOnPrototype();
|
||||
|
||||
assertTrue(isNaN(%_StringCharCodeAt("ABC", -1)));
|
||||
assertTrue(isNaN(%_StringCharCodeAt("ABC", 4)));
|
||||
|
Loading…
Reference in New Issue
Block a user