Index: src/crankshaft/hydrogen.cc |
diff --git a/src/crankshaft/hydrogen.cc b/src/crankshaft/hydrogen.cc |
index 7fce48961f3a2c8d78d23b43b7e3a08fa9e7c77e..db60d6f3523d029b45b2cbd1cf3393b62c619b44 100644 |
--- a/src/crankshaft/hydrogen.cc |
+++ b/src/crankshaft/hydrogen.cc |
@@ -2413,7 +2413,20 @@ HValue* HGraphBuilder::BuildAddStringLengths(HValue* left_length, |
HValue* length = AddUncasted<HAdd>(left_length, right_length); |
// Check that length <= kMaxLength <=> length < MaxLength + 1. |
HValue* max_length = Add<HConstant>(String::kMaxLength + 1); |
- Add<HBoundsCheck>(length, max_length); |
+ if (top_info()->IsStub()) { |
+ // This is a mitigation for crbug.com/627934; the real fix |
+ // will be to migrate the StringAddStub to TurboFan one day. |
jgruber
2017/01/31 15:13:47
FYI: We now have a TF StringAddStub. Not sure from
Benedikt Meurer
2017/01/31 17:57:20
I think we still inline this into the BinaryOpIC f
|
+ IfBuilder if_invalid(this); |
+ if_invalid.If<HCompareNumericAndBranch>(length, max_length, Token::GT); |
+ if_invalid.Then(); |
+ { |
+ Add<HCallRuntime>( |
+ Runtime::FunctionForId(Runtime::kThrowInvalidStringLength), 0); |
+ } |
+ if_invalid.End(); |
+ } else { |
+ Add<HBoundsCheck>(length, max_length); |
+ } |
return length; |
} |