Index: src/mips/code-stubs-mips.cc |
diff --git a/src/mips/code-stubs-mips.cc b/src/mips/code-stubs-mips.cc |
index f1c6c39b05ef8fa8764278ade8cdaeb63dce7993..83ea24770ce89b59cf770395944f11cd266fca53 100644 |
--- a/src/mips/code-stubs-mips.cc |
+++ b/src/mips/code-stubs-mips.cc |
@@ -2140,8 +2140,8 @@ void BinaryOpStub::GenerateBothStringStub(MacroAssembler* masm) { |
__ GetObjectType(right, a2, a2); |
__ Branch(&call_runtime, ge, a2, Operand(FIRST_NONSTRING_TYPE)); |
- 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); |
@@ -2558,8 +2558,8 @@ void BinaryOpStub::GenerateAddStrings(MacroAssembler* masm) { |
__ GetObjectType(left, a2, a2); |
__ Branch(&left_not_string, ge, a2, Operand(FIRST_NONSTRING_TYPE)); |
- 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); |
@@ -2569,8 +2569,8 @@ void BinaryOpStub::GenerateAddStrings(MacroAssembler* masm) { |
__ GetObjectType(right, a2, a2); |
__ Branch(&call_runtime, ge, a2, Operand(FIRST_NONSTRING_TYPE)); |
- 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); |
@@ -5872,7 +5872,11 @@ void StringAddStub::Generate(MacroAssembler* masm) { |
__ lw(a1, 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(a0, a1, &call_runtime); |
// Load instance types. |
__ lw(t0, FieldMemOperand(a0, HeapObject::kMapOffset)); |
@@ -5884,20 +5888,16 @@ void StringAddStub::Generate(MacroAssembler* masm) { |
__ Or(t4, t0, Operand(t1)); |
__ And(t4, t4, Operand(kIsNotStringMask)); |
__ Branch(&call_runtime, ne, t4, Operand(zero_reg)); |
- } 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, a0, a2, a3, t0, t1, &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, a1, a2, a3, t0, t1, &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, a0, a2, a3, t0, t1, &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, a1, a2, a3, t0, t1, &call_builtin); |
+ builtin_id = Builtins::STRING_ADD_LEFT; |
} |
// Both arguments are strings. |
@@ -5948,7 +5948,7 @@ void StringAddStub::Generate(MacroAssembler* masm) { |
__ Branch(&longer_than_two, ne, t2, Operand(2)); |
// 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) { |
__ lw(t0, FieldMemOperand(a0, HeapObject::kMapOffset)); |
__ lw(t1, FieldMemOperand(a1, HeapObject::kMapOffset)); |
__ lbu(t0, FieldMemOperand(t0, Map::kInstanceTypeOffset)); |
@@ -5992,7 +5992,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) { |
__ lw(t0, FieldMemOperand(a0, HeapObject::kMapOffset)); |
__ lw(t1, FieldMemOperand(a1, HeapObject::kMapOffset)); |
__ lbu(t0, FieldMemOperand(t0, Map::kInstanceTypeOffset)); |
@@ -6075,7 +6075,7 @@ void StringAddStub::Generate(MacroAssembler* masm) { |
// t2: 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) { |
__ lw(t0, FieldMemOperand(a0, HeapObject::kMapOffset)); |
__ lw(t1, FieldMemOperand(a1, HeapObject::kMapOffset)); |
__ lbu(t0, FieldMemOperand(t0, Map::kInstanceTypeOffset)); |
@@ -6161,7 +6161,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. |
{ |
@@ -6176,7 +6176,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. |
{ |