Index: src/arm/code-stubs-arm.cc |
diff --git a/src/arm/code-stubs-arm.cc b/src/arm/code-stubs-arm.cc |
index 1e1a2fc51e29064ef7d63edad18b4a67125358a5..7773667b7e91c5647ed72e776ca04a087367c0f7 100644 |
--- a/src/arm/code-stubs-arm.cc |
+++ b/src/arm/code-stubs-arm.cc |
@@ -1897,8 +1897,8 @@ void BinaryOpStub::GenerateBothStringStub(MacroAssembler* masm) { |
__ CompareObjectType(right, r2, r2, FIRST_NONSTRING_TYPE); |
__ b(ge, &call_runtime); |
- 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); |
@@ -2256,8 +2256,8 @@ void BinaryOpStub::GenerateAddStrings(MacroAssembler* masm) { |
__ CompareObjectType(left, r2, r2, FIRST_NONSTRING_TYPE); |
__ b(ge, &left_not_string); |
- 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); |
@@ -2267,8 +2267,8 @@ void BinaryOpStub::GenerateAddStrings(MacroAssembler* masm) { |
__ CompareObjectType(right, r2, r2, FIRST_NONSTRING_TYPE); |
__ b(ge, &call_runtime); |
- 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); |
@@ -5494,7 +5494,11 @@ void StringAddStub::Generate(MacroAssembler* masm) { |
__ ldr(r1, MemOperand(sp, 0 * 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) { |
+ ASSERT((flags_ & STRING_ADD_CHECK_LEFT) == STRING_ADD_CHECK_LEFT); |
+ ASSERT((flags_ & STRING_ADD_CHECK_RIGHT) == STRING_ADD_CHECK_RIGHT); |
__ JumpIfEitherSmi(r0, r1, &call_runtime); |
// Load instance types. |
__ ldr(r4, FieldMemOperand(r0, HeapObject::kMapOffset)); |
@@ -5506,20 +5510,16 @@ void StringAddStub::Generate(MacroAssembler* masm) { |
__ tst(r4, Operand(kIsNotStringMask)); |
__ tst(r5, Operand(kIsNotStringMask), eq); |
__ b(ne, &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, 1 * kPointerSize, r0, r2, r3, r4, r5, &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, 0 * kPointerSize, r1, r2, r3, r4, r5, &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, 1 * kPointerSize, r0, r2, r3, r4, r5, &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, 0 * kPointerSize, r1, r2, r3, r4, r5, &call_builtin); |
+ builtin_id = Builtins::STRING_ADD_LEFT; |
} |
// Both arguments are strings. |
@@ -5567,7 +5567,7 @@ void StringAddStub::Generate(MacroAssembler* masm) { |
__ b(ne, &longer_than_two); |
// Check that both strings are non-external ASCII strings. |
- if (flags_ != NO_STRING_ADD_FLAGS) { |
+ if ((flags_ & STRING_ADD_CHECK_BOTH) != STRING_ADD_CHECK_BOTH) { |
__ ldr(r4, FieldMemOperand(r0, HeapObject::kMapOffset)); |
__ ldr(r5, FieldMemOperand(r1, HeapObject::kMapOffset)); |
__ ldrb(r4, FieldMemOperand(r4, Map::kInstanceTypeOffset)); |
@@ -5615,7 +5615,7 @@ void StringAddStub::Generate(MacroAssembler* masm) { |
// If result is not supposed to be flat, allocate a cons string object. |
// If both strings are ASCII the result is an ASCII cons string. |
- if (flags_ != NO_STRING_ADD_FLAGS) { |
+ if ((flags_ & STRING_ADD_CHECK_BOTH) != STRING_ADD_CHECK_BOTH) { |
__ ldr(r4, FieldMemOperand(r0, HeapObject::kMapOffset)); |
__ ldr(r5, FieldMemOperand(r1, HeapObject::kMapOffset)); |
__ ldrb(r4, FieldMemOperand(r4, Map::kInstanceTypeOffset)); |
@@ -5698,7 +5698,7 @@ void StringAddStub::Generate(MacroAssembler* masm) { |
// r6: sum of lengths. |
Label first_prepared, second_prepared; |
__ bind(&string_add_flat_result); |
- if (flags_ != NO_STRING_ADD_FLAGS) { |
+ if ((flags_ & STRING_ADD_CHECK_BOTH) != STRING_ADD_CHECK_BOTH) { |
__ ldr(r4, FieldMemOperand(r0, HeapObject::kMapOffset)); |
__ ldr(r5, FieldMemOperand(r1, HeapObject::kMapOffset)); |
__ ldrb(r4, FieldMemOperand(r4, Map::kInstanceTypeOffset)); |
@@ -5786,7 +5786,7 @@ void StringAddStub::Generate(MacroAssembler* masm) { |
// 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); |
// Build a frame |
{ |
@@ -5801,7 +5801,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); |
// Build a frame |
{ |