Chromium Code Reviews| Index: src/ia32/code-stubs-ia32.cc |
| diff --git a/src/ia32/code-stubs-ia32.cc b/src/ia32/code-stubs-ia32.cc |
| index aee57dc385c70368c9b89f84a064301862e89a91..c283c75840395690fe4190120349618b661f18f7 100644 |
| --- a/src/ia32/code-stubs-ia32.cc |
| +++ b/src/ia32/code-stubs-ia32.cc |
| @@ -1353,8 +1353,8 @@ void BinaryOpStub::GenerateBothStringStub(MacroAssembler* masm) { |
| __ CmpObjectType(right, FIRST_NONSTRING_TYPE, ecx); |
| __ j(above_equal, &call_runtime, Label::kNear); |
| - StringAddStub string_add_stub((StringAddFlags) |
| - (ERECT_FRAME | NO_STRING_CHECK_IN_STUB)); |
| + StringAddStub string_add_stub( |
| + (StringAddFlags)(STRING_ADD_CHECK_NONE | STRING_ADD_ERECT_FRAME)); |
| GenerateRegisterArgsPush(masm); |
| __ TailCallStub(&string_add_stub); |
| @@ -1999,8 +1999,8 @@ void BinaryOpStub::GenerateAddStrings(MacroAssembler* masm) { |
| __ CmpObjectType(left, FIRST_NONSTRING_TYPE, ecx); |
| __ j(above_equal, &left_not_string, Label::kNear); |
| - StringAddStub string_add_left_stub((StringAddFlags) |
| - (ERECT_FRAME | NO_STRING_CHECK_LEFT_IN_STUB)); |
| + StringAddStub string_add_left_stub( |
| + (StringAddFlags)(STRING_ADD_CHECK_RIGHT | STRING_ADD_ERECT_FRAME)); |
| GenerateRegisterArgsPush(masm); |
| __ TailCallStub(&string_add_left_stub); |
| @@ -2010,8 +2010,8 @@ void BinaryOpStub::GenerateAddStrings(MacroAssembler* masm) { |
| __ CmpObjectType(right, FIRST_NONSTRING_TYPE, ecx); |
| __ j(above_equal, &call_runtime, Label::kNear); |
| - StringAddStub string_add_right_stub((StringAddFlags) |
| - (ERECT_FRAME | NO_STRING_CHECK_RIGHT_IN_STUB)); |
| + StringAddStub string_add_right_stub( |
| + (StringAddFlags)(STRING_ADD_CHECK_LEFT | STRING_ADD_ERECT_FRAME)); |
| GenerateRegisterArgsPush(masm); |
| __ TailCallStub(&string_add_right_stub); |
| @@ -5383,7 +5383,9 @@ void StringAddStub::Generate(MacroAssembler* masm) { |
| __ mov(edx, Operand(esp, 1 * kPointerSize)); // Second argument. |
| // Make sure that both arguments are strings if not known in advance. |
| - if ((flags_ & NO_STRING_ADD_FLAGS) != 0) { |
| + // Otherwise, at least one of the arguments is definitely a string, |
| + // and we convert the one that is not known to be a string. |
| + if ((flags_ & STRING_ADD_CHECK_BOTH) == STRING_ADD_CHECK_BOTH) { |
|
mvstanton
2013/07/19 11:44:53
What about an assert in this case that STRING_ADD_
Benedikt Meurer
2013/07/19 11:46:51
You mean both are on?
Benedikt Meurer
2013/07/19 11:52:30
Done.
|
| __ JumpIfSmi(eax, &call_runtime); |
| __ CmpObjectType(eax, FIRST_NONSTRING_TYPE, ebx); |
| __ j(above_equal, &call_runtime); |
| @@ -5392,20 +5394,16 @@ void StringAddStub::Generate(MacroAssembler* masm) { |
| __ JumpIfSmi(edx, &call_runtime); |
| __ CmpObjectType(edx, FIRST_NONSTRING_TYPE, ebx); |
| __ j(above_equal, &call_runtime); |
| - } else { |
| - // Here at least one of the arguments is definitely a string. |
| - // We convert the one that is not known to be a string. |
| - if ((flags_ & NO_STRING_CHECK_LEFT_IN_STUB) == 0) { |
| - ASSERT((flags_ & NO_STRING_CHECK_RIGHT_IN_STUB) != 0); |
| - GenerateConvertArgument(masm, 2 * kPointerSize, eax, ebx, ecx, edi, |
| - &call_builtin); |
| - builtin_id = Builtins::STRING_ADD_RIGHT; |
| - } else if ((flags_ & NO_STRING_CHECK_RIGHT_IN_STUB) == 0) { |
| - ASSERT((flags_ & NO_STRING_CHECK_LEFT_IN_STUB) != 0); |
| - GenerateConvertArgument(masm, 1 * kPointerSize, edx, ebx, ecx, edi, |
| - &call_builtin); |
| - builtin_id = Builtins::STRING_ADD_LEFT; |
| - } |
| + } else if ((flags_ & STRING_ADD_CHECK_LEFT) == STRING_ADD_CHECK_LEFT) { |
| + ASSERT((flags_ & STRING_ADD_CHECK_RIGHT) == 0); |
| + GenerateConvertArgument(masm, 2 * kPointerSize, eax, ebx, ecx, edi, |
| + &call_builtin); |
| + builtin_id = Builtins::STRING_ADD_RIGHT; |
| + } else if ((flags_ & STRING_ADD_CHECK_RIGHT) == STRING_ADD_CHECK_RIGHT) { |
| + ASSERT((flags_ & STRING_ADD_CHECK_LEFT) == 0); |
| + GenerateConvertArgument(masm, 1 * kPointerSize, edx, ebx, ecx, edi, |
| + &call_builtin); |
| + builtin_id = Builtins::STRING_ADD_LEFT; |
| } |
| // Both arguments are strings. |
| @@ -5691,7 +5689,7 @@ void StringAddStub::Generate(MacroAssembler* masm) { |
| __ Drop(2); |
| // Just jump to runtime to add the two strings. |
| __ bind(&call_runtime); |
| - if ((flags_ & ERECT_FRAME) != 0) { |
| + if ((flags_ & STRING_ADD_ERECT_FRAME) != 0) { |
| GenerateRegisterArgsPop(masm, ecx); |
| // Build a frame |
| { |
| @@ -5706,7 +5704,7 @@ void StringAddStub::Generate(MacroAssembler* masm) { |
| if (call_builtin.is_linked()) { |
| __ bind(&call_builtin); |
| - if ((flags_ & ERECT_FRAME) != 0) { |
| + if ((flags_ & STRING_ADD_ERECT_FRAME) != 0) { |
| GenerateRegisterArgsPop(masm, ecx); |
| // Build a frame |
| { |