[intrinsics] Nuke the %_StringCharFromCode intrinsic.
As of https://codereview.chromium.org/2348493003 there are no users of this intrinsic left in the code, and we don't want to have any new users of it. The runtime function remains as it serves as a fallback for the optimized code (Crankshaft code actually). BUG=v8:5049 R=mstarzinger@chromium.org Review-Url: https://codereview.chromium.org/2378693002 Cr-Commit-Position: refs/heads/master@{#39822}
This commit is contained in:
parent
9e2b40aa87
commit
3304ea9122
@ -12305,16 +12305,6 @@ void HOptimizedGraphBuilder::GenerateStringCharCodeAt(CallRuntime* call) {
|
||||
}
|
||||
|
||||
|
||||
// Fast support for string.charAt(n) and string[n].
|
||||
void HOptimizedGraphBuilder::GenerateStringCharFromCode(CallRuntime* call) {
|
||||
DCHECK(call->arguments()->length() == 1);
|
||||
CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
|
||||
HValue* char_code = Pop();
|
||||
HInstruction* result = NewUncasted<HStringCharFromCode>(char_code);
|
||||
return ast_context()->ReturnInstruction(result, call->id());
|
||||
}
|
||||
|
||||
|
||||
// Fast support for SubString.
|
||||
void HOptimizedGraphBuilder::GenerateSubString(CallRuntime* call) {
|
||||
DCHECK_EQ(3, call->arguments()->length());
|
||||
|
@ -2209,7 +2209,6 @@ class HOptimizedGraphBuilder : public HGraphBuilder,
|
||||
F(IsJSProxy) \
|
||||
F(Call) \
|
||||
F(NewObject) \
|
||||
F(StringCharFromCode) \
|
||||
F(ToInteger) \
|
||||
F(ToObject) \
|
||||
F(ToString) \
|
||||
|
@ -2777,24 +2777,6 @@ void FullCodeGenerator::EmitClassOf(CallRuntime* expr) {
|
||||
}
|
||||
|
||||
|
||||
void FullCodeGenerator::EmitStringCharFromCode(CallRuntime* expr) {
|
||||
ZoneList<Expression*>* args = expr->arguments();
|
||||
DCHECK(args->length() == 1);
|
||||
VisitForAccumulatorValue(args->at(0));
|
||||
|
||||
Label done;
|
||||
StringCharFromCodeGenerator generator(r0, r1);
|
||||
generator.GenerateFast(masm_);
|
||||
__ jmp(&done);
|
||||
|
||||
NopRuntimeCallHelper call_helper;
|
||||
generator.GenerateSlow(masm_, call_helper);
|
||||
|
||||
__ bind(&done);
|
||||
context()->Plug(r1);
|
||||
}
|
||||
|
||||
|
||||
void FullCodeGenerator::EmitStringCharCodeAt(CallRuntime* expr) {
|
||||
ZoneList<Expression*>* args = expr->arguments();
|
||||
DCHECK(args->length() == 2);
|
||||
|
@ -2685,28 +2685,6 @@ void FullCodeGenerator::EmitClassOf(CallRuntime* expr) {
|
||||
}
|
||||
|
||||
|
||||
void FullCodeGenerator::EmitStringCharFromCode(CallRuntime* expr) {
|
||||
ZoneList<Expression*>* args = expr->arguments();
|
||||
DCHECK(args->length() == 1);
|
||||
|
||||
VisitForAccumulatorValue(args->at(0));
|
||||
|
||||
Label done;
|
||||
Register code = x0;
|
||||
Register result = x1;
|
||||
|
||||
StringCharFromCodeGenerator generator(code, result);
|
||||
generator.GenerateFast(masm_);
|
||||
__ B(&done);
|
||||
|
||||
NopRuntimeCallHelper call_helper;
|
||||
generator.GenerateSlow(masm_, call_helper);
|
||||
|
||||
__ Bind(&done);
|
||||
context()->Plug(result);
|
||||
}
|
||||
|
||||
|
||||
void FullCodeGenerator::EmitStringCharCodeAt(CallRuntime* expr) {
|
||||
ZoneList<Expression*>* args = expr->arguments();
|
||||
DCHECK(args->length() == 2);
|
||||
|
@ -477,7 +477,6 @@ class FullCodeGenerator final : public AstVisitor<FullCodeGenerator> {
|
||||
F(IsJSProxy) \
|
||||
F(Call) \
|
||||
F(NewObject) \
|
||||
F(StringCharFromCode) \
|
||||
F(IsJSReceiver) \
|
||||
F(HasCachedArrayIndex) \
|
||||
F(GetCachedArrayIndex) \
|
||||
|
@ -2663,25 +2663,6 @@ void FullCodeGenerator::EmitClassOf(CallRuntime* expr) {
|
||||
}
|
||||
|
||||
|
||||
void FullCodeGenerator::EmitStringCharFromCode(CallRuntime* expr) {
|
||||
ZoneList<Expression*>* args = expr->arguments();
|
||||
DCHECK(args->length() == 1);
|
||||
|
||||
VisitForAccumulatorValue(args->at(0));
|
||||
|
||||
Label done;
|
||||
StringCharFromCodeGenerator generator(eax, ebx);
|
||||
generator.GenerateFast(masm_);
|
||||
__ jmp(&done);
|
||||
|
||||
NopRuntimeCallHelper call_helper;
|
||||
generator.GenerateSlow(masm_, call_helper);
|
||||
|
||||
__ bind(&done);
|
||||
context()->Plug(ebx);
|
||||
}
|
||||
|
||||
|
||||
void FullCodeGenerator::EmitStringCharCodeAt(CallRuntime* expr) {
|
||||
ZoneList<Expression*>* args = expr->arguments();
|
||||
DCHECK(args->length() == 2);
|
||||
|
@ -2782,25 +2782,6 @@ void FullCodeGenerator::EmitClassOf(CallRuntime* expr) {
|
||||
}
|
||||
|
||||
|
||||
void FullCodeGenerator::EmitStringCharFromCode(CallRuntime* expr) {
|
||||
ZoneList<Expression*>* args = expr->arguments();
|
||||
DCHECK(args->length() == 1);
|
||||
|
||||
VisitForAccumulatorValue(args->at(0));
|
||||
|
||||
Label done;
|
||||
StringCharFromCodeGenerator generator(v0, a1);
|
||||
generator.GenerateFast(masm_);
|
||||
__ jmp(&done);
|
||||
|
||||
NopRuntimeCallHelper call_helper;
|
||||
generator.GenerateSlow(masm_, call_helper);
|
||||
|
||||
__ bind(&done);
|
||||
context()->Plug(a1);
|
||||
}
|
||||
|
||||
|
||||
void FullCodeGenerator::EmitStringCharCodeAt(CallRuntime* expr) {
|
||||
ZoneList<Expression*>* args = expr->arguments();
|
||||
DCHECK(args->length() == 2);
|
||||
|
@ -2781,25 +2781,6 @@ void FullCodeGenerator::EmitClassOf(CallRuntime* expr) {
|
||||
}
|
||||
|
||||
|
||||
void FullCodeGenerator::EmitStringCharFromCode(CallRuntime* expr) {
|
||||
ZoneList<Expression*>* args = expr->arguments();
|
||||
DCHECK(args->length() == 1);
|
||||
|
||||
VisitForAccumulatorValue(args->at(0));
|
||||
|
||||
Label done;
|
||||
StringCharFromCodeGenerator generator(v0, a1);
|
||||
generator.GenerateFast(masm_);
|
||||
__ jmp(&done);
|
||||
|
||||
NopRuntimeCallHelper call_helper;
|
||||
generator.GenerateSlow(masm_, call_helper);
|
||||
|
||||
__ bind(&done);
|
||||
context()->Plug(a1);
|
||||
}
|
||||
|
||||
|
||||
void FullCodeGenerator::EmitStringCharCodeAt(CallRuntime* expr) {
|
||||
ZoneList<Expression*>* args = expr->arguments();
|
||||
DCHECK(args->length() == 2);
|
||||
|
@ -2778,24 +2778,6 @@ void FullCodeGenerator::EmitClassOf(CallRuntime* expr) {
|
||||
}
|
||||
|
||||
|
||||
void FullCodeGenerator::EmitStringCharFromCode(CallRuntime* expr) {
|
||||
ZoneList<Expression*>* args = expr->arguments();
|
||||
DCHECK(args->length() == 1);
|
||||
VisitForAccumulatorValue(args->at(0));
|
||||
|
||||
Label done;
|
||||
StringCharFromCodeGenerator generator(r3, r4);
|
||||
generator.GenerateFast(masm_);
|
||||
__ b(&done);
|
||||
|
||||
NopRuntimeCallHelper call_helper;
|
||||
generator.GenerateSlow(masm_, call_helper);
|
||||
|
||||
__ bind(&done);
|
||||
context()->Plug(r4);
|
||||
}
|
||||
|
||||
|
||||
void FullCodeGenerator::EmitStringCharCodeAt(CallRuntime* expr) {
|
||||
ZoneList<Expression*>* args = expr->arguments();
|
||||
DCHECK(args->length() == 2);
|
||||
|
@ -2710,23 +2710,6 @@ void FullCodeGenerator::EmitClassOf(CallRuntime* expr) {
|
||||
context()->Plug(r2);
|
||||
}
|
||||
|
||||
void FullCodeGenerator::EmitStringCharFromCode(CallRuntime* expr) {
|
||||
ZoneList<Expression*>* args = expr->arguments();
|
||||
DCHECK(args->length() == 1);
|
||||
VisitForAccumulatorValue(args->at(0));
|
||||
|
||||
Label done;
|
||||
StringCharFromCodeGenerator generator(r2, r3);
|
||||
generator.GenerateFast(masm_);
|
||||
__ b(&done);
|
||||
|
||||
NopRuntimeCallHelper call_helper;
|
||||
generator.GenerateSlow(masm_, call_helper);
|
||||
|
||||
__ bind(&done);
|
||||
context()->Plug(r3);
|
||||
}
|
||||
|
||||
void FullCodeGenerator::EmitStringCharCodeAt(CallRuntime* expr) {
|
||||
ZoneList<Expression*>* args = expr->arguments();
|
||||
DCHECK(args->length() == 2);
|
||||
|
@ -2654,25 +2654,6 @@ void FullCodeGenerator::EmitClassOf(CallRuntime* expr) {
|
||||
}
|
||||
|
||||
|
||||
void FullCodeGenerator::EmitStringCharFromCode(CallRuntime* expr) {
|
||||
ZoneList<Expression*>* args = expr->arguments();
|
||||
DCHECK(args->length() == 1);
|
||||
|
||||
VisitForAccumulatorValue(args->at(0));
|
||||
|
||||
Label done;
|
||||
StringCharFromCodeGenerator generator(rax, rbx);
|
||||
generator.GenerateFast(masm_);
|
||||
__ jmp(&done);
|
||||
|
||||
NopRuntimeCallHelper call_helper;
|
||||
generator.GenerateSlow(masm_, call_helper);
|
||||
|
||||
__ bind(&done);
|
||||
context()->Plug(rbx);
|
||||
}
|
||||
|
||||
|
||||
void FullCodeGenerator::EmitStringCharCodeAt(CallRuntime* expr) {
|
||||
ZoneList<Expression*>* args = expr->arguments();
|
||||
DCHECK(args->length() == 2);
|
||||
|
@ -2655,25 +2655,6 @@ void FullCodeGenerator::EmitClassOf(CallRuntime* expr) {
|
||||
}
|
||||
|
||||
|
||||
void FullCodeGenerator::EmitStringCharFromCode(CallRuntime* expr) {
|
||||
ZoneList<Expression*>* args = expr->arguments();
|
||||
DCHECK(args->length() == 1);
|
||||
|
||||
VisitForAccumulatorValue(args->at(0));
|
||||
|
||||
Label done;
|
||||
StringCharFromCodeGenerator generator(eax, ebx);
|
||||
generator.GenerateFast(masm_);
|
||||
__ jmp(&done);
|
||||
|
||||
NopRuntimeCallHelper call_helper;
|
||||
generator.GenerateSlow(masm_, call_helper);
|
||||
|
||||
__ bind(&done);
|
||||
context()->Plug(ebx);
|
||||
}
|
||||
|
||||
|
||||
void FullCodeGenerator::EmitStringCharCodeAt(CallRuntime* expr) {
|
||||
ZoneList<Expression*>* args = expr->arguments();
|
||||
DCHECK(args->length() == 2);
|
||||
|
@ -131,15 +131,6 @@ TEST(StringCharCodeAt) {
|
||||
}
|
||||
|
||||
|
||||
TEST(StringCharFromCode) {
|
||||
FunctionTester T("(function(a) { return %_StringCharFromCode(a); })", flags);
|
||||
|
||||
T.CheckCall(T.Val("a"), T.Val(97));
|
||||
T.CheckCall(T.Val("\xE2\x9D\x8A"), T.Val(0x274A));
|
||||
T.CheckCall(T.Val(""), T.undefined());
|
||||
}
|
||||
|
||||
|
||||
TEST(StringCompare) {
|
||||
FunctionTester T("(function(a,b) { return %_StringCompare(a,b); })", flags);
|
||||
|
||||
|
@ -1,76 +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
|
||||
|
||||
function dead1(a, b) {
|
||||
var x = %_StringCharFromCode(a);
|
||||
return a; // x is dead code
|
||||
}
|
||||
|
||||
function dead2(a, b) {
|
||||
var x = %_StringCharFromCode(a);
|
||||
var y = %_StringCharFromCode(b);
|
||||
return a; // x and y are both dead
|
||||
}
|
||||
|
||||
function dead3(a, b) {
|
||||
a = a ? 11 : 12;
|
||||
b = b ? 13 : 14;
|
||||
var x = %_StringCharFromCode(a);
|
||||
var y = %_StringCharFromCode(b);
|
||||
return a; // x and y are both dead
|
||||
}
|
||||
|
||||
function test() {
|
||||
assertEquals(33, dead1(33, 32));
|
||||
assertEquals(33, dead2(33, 32));
|
||||
assertEquals(11, dead3(33, 32));
|
||||
|
||||
assertEquals(31, dead1(31, 30));
|
||||
assertEquals(31, dead2(31, 30));
|
||||
assertEquals(11, dead3(31, 32));
|
||||
|
||||
assertEquals(0, dead1(0, 30));
|
||||
assertEquals(0, dead2(0, 30));
|
||||
assertEquals(12, dead3(0, 32));
|
||||
|
||||
assertEquals(true, dead1(true, 0));
|
||||
assertEquals(true, dead2(true, 0));
|
||||
assertEquals(11, dead3(true, 0));
|
||||
|
||||
assertEquals("true", dead1("true", 0));
|
||||
assertEquals("true", dead2("true", 0));
|
||||
assertEquals(11, dead3("true", 0));
|
||||
}
|
||||
|
||||
test();
|
||||
test();
|
||||
%OptimizeFunctionOnNextCall(dead1);
|
||||
%OptimizeFunctionOnNextCall(dead2);
|
||||
%OptimizeFunctionOnNextCall(dead3);
|
||||
test();
|
Loading…
Reference in New Issue
Block a user