ReceiverCheckMode needs to be utilized further.

The parameter wasn't being passed appropriately, and there was an extra
opportunity to use mode RECEIVER_IS_STRING in SubStringStub.

R=yangguo@chromium.org

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

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24704 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 77d8b4b9
......@@ -3167,8 +3167,8 @@ void SubStringStub::Generate(MacroAssembler* masm) {
// r2: length
// r3: from index (untagged)
__ SmiTag(r3, r3);
StringCharAtGenerator generator(
r0, r3, r2, r0, &runtime, &runtime, &runtime, STRING_INDEX_IS_NUMBER);
StringCharAtGenerator generator(r0, r3, r2, r0, &runtime, &runtime, &runtime,
STRING_INDEX_IS_NUMBER, RECEIVER_IS_STRING);
generator.GenerateFast(masm);
__ Drop(3);
__ Ret();
......
......@@ -3812,9 +3812,9 @@ void SubStringStub::Generate(MacroAssembler* masm) {
// x12: input_type
// x15: from (untagged)
__ SmiTag(from);
StringCharAtGenerator generator(
input_string, from, result_length, x0,
&runtime, &runtime, &runtime, STRING_INDEX_IS_NUMBER);
StringCharAtGenerator generator(input_string, from, result_length, x0,
&runtime, &runtime, &runtime,
STRING_INDEX_IS_NUMBER, RECEIVER_IS_STRING);
generator.GenerateFast(masm);
__ Drop(3);
__ Ret();
......
......@@ -1803,7 +1803,7 @@ class StringCharAtGenerator {
ReceiverCheckMode check_mode = RECEIVER_IS_UNKNOWN)
: char_code_at_generator_(object, index, scratch, receiver_not_string,
index_not_number, index_out_of_range,
index_flags),
index_flags, check_mode),
char_from_code_generator_(scratch, result) {}
// Generates the fast case code. On the fallthrough path |result|
......
......@@ -702,8 +702,6 @@ void LoadIndexedStringStub::Generate(MacroAssembler* masm) {
Register result = eax;
DCHECK(!result.is(scratch));
// TODO(mvstanton): the generator doesn't need to verify that
// receiver is a string map, that is done outside the handler.
StringCharAtGenerator char_at_generator(receiver, index, scratch, result,
&miss, // When not a string.
&miss, // When not a number.
......@@ -3159,8 +3157,9 @@ void SubStringStub::Generate(MacroAssembler* masm) {
// ebx: instance type
// ecx: sub string length (smi)
// edx: from index (smi)
StringCharAtGenerator generator(
eax, edx, ecx, eax, &runtime, &runtime, &runtime, STRING_INDEX_IS_NUMBER);
StringCharAtGenerator generator(eax, edx, ecx, eax, &runtime, &runtime,
&runtime, STRING_INDEX_IS_NUMBER,
RECEIVER_IS_STRING);
generator.GenerateFast(masm);
__ ret(3 * kPointerSize);
generator.SkipSlow(masm, &runtime);
......
......@@ -3332,8 +3332,8 @@ void SubStringStub::Generate(MacroAssembler* masm) {
// a2: length
// a3: from index (untagged)
__ SmiTag(a3, a3);
StringCharAtGenerator generator(
v0, a3, a2, v0, &runtime, &runtime, &runtime, STRING_INDEX_IS_NUMBER);
StringCharAtGenerator generator(v0, a3, a2, v0, &runtime, &runtime, &runtime,
STRING_INDEX_IS_NUMBER, RECEIVER_IS_STRING);
generator.GenerateFast(masm);
__ DropAndRet(3);
generator.SkipSlow(masm, &runtime);
......
......@@ -3106,8 +3106,9 @@ void SubStringStub::Generate(MacroAssembler* masm) {
// rbx: instance type
// rcx: sub string length (smi)
// rdx: from index (smi)
StringCharAtGenerator generator(
rax, rdx, rcx, rax, &runtime, &runtime, &runtime, STRING_INDEX_IS_NUMBER);
StringCharAtGenerator generator(rax, rdx, rcx, rax, &runtime, &runtime,
&runtime, STRING_INDEX_IS_NUMBER,
RECEIVER_IS_STRING);
generator.GenerateFast(masm);
__ ret(SUB_STRING_ARGUMENT_COUNT * kPointerSize);
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