Index: src/arm/code-stubs-arm.cc |
diff --git a/src/arm/code-stubs-arm.cc b/src/arm/code-stubs-arm.cc |
index f471220332c187ea660afca64ea70ea0e867d1c6..65b6ed1b6d54af44d5b6f9c95209157e0479b449 100644 |
--- a/src/arm/code-stubs-arm.cc |
+++ b/src/arm/code-stubs-arm.cc |
@@ -4607,6 +4607,7 @@ void RegExpExecStub::Generate(MacroAssembler* masm) { |
// subject: Subject string |
// regexp_data: RegExp data (FixedArray) |
+ // r1: whether subject is a string and if yes, its string representation |
// Check for flat cons string or sliced string. |
// A flat cons string is a cons string where the second part is the empty |
// string. In that case the subject string is just the first part of the cons |
@@ -4616,10 +4617,16 @@ void RegExpExecStub::Generate(MacroAssembler* masm) { |
Label cons_string, check_encoding; |
STATIC_ASSERT(kConsStringTag < kExternalStringTag); |
STATIC_ASSERT(kSlicedStringTag > kExternalStringTag); |
+ STATIC_ASSERT(kIsNotStringMask > kExternalStringTag); |
__ cmp(r1, Operand(kExternalStringTag)); |
__ b(lt, &cons_string); |
__ b(eq, &runtime); |
+ // Catch non-string subject (should already have been guarded against). |
+ STATIC_ASSERT(kIsNotStringTag != 0); |
+ __ tst(r1, Immediate(kIsNotStringMask)); |
+ __ b(ne, &runtime); |
+ |
// String is sliced. |
__ ldr(r9, FieldMemOperand(subject, SlicedString::kOffsetOffset)); |
__ mov(r9, Operand(r9, ASR, kSmiTagSize)); |