Index: src/ia32/code-stubs-ia32.cc |
diff --git a/src/ia32/code-stubs-ia32.cc b/src/ia32/code-stubs-ia32.cc |
index 2287b63775c9c1927ae796689f28eb42e84a179d..471114cbe4f219e04cb4b921de79326f6d3bebff 100644 |
--- a/src/ia32/code-stubs-ia32.cc |
+++ b/src/ia32/code-stubs-ia32.cc |
@@ -6162,7 +6162,11 @@ void SubStringStub::Generate(MacroAssembler* masm) { |
__ sub(ecx, edx); |
__ cmp(ecx, FieldOperand(eax, String::kLengthOffset)); |
Label not_original_string; |
- __ j(not_equal, ¬_original_string, Label::kNear); |
+ // Shorter than original string's length: an actual substring. |
+ __ j(below, ¬_original_string, Label::kNear); |
+ // Longer than original string's length or negative: unsafe arguments. |
+ __ j(above, &runtime); |
+ // Return original string. |
Counters* counters = masm->isolate()->counters(); |
__ IncrementCounter(counters->sub_string_native(), 1); |
__ ret(3 * kPointerSize); |