Commit 56f507c5 authored by palfia@homejinni.com's avatar palfia@homejinni.com

MIPS: Combine %_SubString and %_StringCharAt.

Port r13700 (587dc7c1)

BUG=

Review URL: https://codereview.chromium.org/12310087

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13739 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent deeddc7e
......@@ -5979,23 +5979,6 @@ void StringCharFromCodeGenerator::GenerateSlow(
}
// -------------------------------------------------------------------------
// StringCharAtGenerator
void StringCharAtGenerator::GenerateFast(MacroAssembler* masm) {
char_code_at_generator_.GenerateFast(masm);
char_from_code_generator_.GenerateFast(masm);
}
void StringCharAtGenerator::GenerateSlow(
MacroAssembler* masm,
const RuntimeCallHelper& call_helper) {
char_code_at_generator_.GenerateSlow(masm, call_helper);
char_from_code_generator_.GenerateSlow(masm, call_helper);
}
void StringHelper::GenerateCopyCharacters(MacroAssembler* masm,
Register dest,
Register src,
......@@ -6376,6 +6359,9 @@ void SubStringStub::Generate(MacroAssembler* masm) {
__ Branch(&runtime, ne, t0, Operand(zero_reg));
Label single_char;
__ Branch(&single_char, eq, a2, Operand(1));
// Short-cut for the case of trivial substring.
Label return_v0;
// v0: original string
......@@ -6536,6 +6522,18 @@ void SubStringStub::Generate(MacroAssembler* masm) {
// Just jump to runtime to create the sub string.
__ bind(&runtime);
__ TailCallRuntime(Runtime::kSubString, 3, 1);
__ bind(&single_char);
// v0: original string
// a1: instance type
// a2: length
// a3: from index (untagged)
__ SmiTag(a3, a3);
StringCharAtGenerator generator(
v0, a3, a2, v0, &runtime, &runtime, &runtime, STRING_INDEX_IS_NUMBER);
generator.GenerateFast(masm);
__ DropAndRet(3);
generator.SkipSlow(masm, &runtime);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment