Index: src/ia32/code-stubs-ia32.cc |
diff --git a/src/ia32/code-stubs-ia32.cc b/src/ia32/code-stubs-ia32.cc |
index c6c1009c8cf7d28e2d8bf6ea12259783b5424a64..2e1fff226a7b47ff2b27271abb2d6ea090374ff4 100644 |
--- a/src/ia32/code-stubs-ia32.cc |
+++ b/src/ia32/code-stubs-ia32.cc |
@@ -3607,6 +3607,7 @@ void RegExpExecStub::Generate(MacroAssembler* masm) { |
__ and_(ebx, Immediate(kIsNotStringMask | kStringRepresentationMask)); |
__ j(zero, &seq_ascii_string, Label::kNear); |
+ // ebx: 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 |
@@ -3616,10 +3617,16 @@ void RegExpExecStub::Generate(MacroAssembler* masm) { |
Label cons_string, check_encoding; |
STATIC_ASSERT(kConsStringTag < kExternalStringTag); |
STATIC_ASSERT(kSlicedStringTag > kExternalStringTag); |
+ STATIC_ASSERT(kIsNotStringMask > kExternalStringTag); |
__ cmp(ebx, Immediate(kExternalStringTag)); |
__ j(less, &cons_string); |
__ j(equal, &runtime); |
+ // Catch non-string subject (should already have been guarded against). |
+ STATIC_ASSERT(kIsNotStringTag != 0); |
+ __ test(ebx, Immediate(kIsNotStringMask)); |
+ __ j(not_zero, &runtime); |
+ |
// String is sliced. |
__ mov(edi, FieldOperand(eax, SlicedString::kOffsetOffset)); |
__ mov(eax, FieldOperand(eax, SlicedString::kParentOffset)); |