| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/crankshaft/hydrogen.h" | 5 #include "src/crankshaft/hydrogen.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <sstream> | 8 #include <sstream> |
| 9 | 9 |
| 10 #include "src/allocation-site-scopes.h" | 10 #include "src/allocation-site-scopes.h" |
| (...skipping 2350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2361 return object; | 2361 return object; |
| 2362 } | 2362 } |
| 2363 | 2363 |
| 2364 | 2364 |
| 2365 HValue* HGraphBuilder::BuildAddStringLengths(HValue* left_length, | 2365 HValue* HGraphBuilder::BuildAddStringLengths(HValue* left_length, |
| 2366 HValue* right_length) { | 2366 HValue* right_length) { |
| 2367 // Compute the combined string length and check against max string length. | 2367 // Compute the combined string length and check against max string length. |
| 2368 HValue* length = AddUncasted<HAdd>(left_length, right_length); | 2368 HValue* length = AddUncasted<HAdd>(left_length, right_length); |
| 2369 // Check that length <= kMaxLength <=> length < MaxLength + 1. | 2369 // Check that length <= kMaxLength <=> length < MaxLength + 1. |
| 2370 HValue* max_length = Add<HConstant>(String::kMaxLength + 1); | 2370 HValue* max_length = Add<HConstant>(String::kMaxLength + 1); |
| 2371 if (top_info()->IsStub() || !isolate()->IsStringLengthOverflowIntact()) { | 2371 if (top_info()->IsStub()) { |
| 2372 // This is a mitigation for crbug.com/627934; the real fix | 2372 // This is a mitigation for crbug.com/627934; the real fix |
| 2373 // will be to migrate the StringAddStub to TurboFan one day. | 2373 // will be to migrate the StringAddStub to TurboFan one day. |
| 2374 IfBuilder if_invalid(this); | 2374 IfBuilder if_invalid(this); |
| 2375 if_invalid.If<HCompareNumericAndBranch>(length, max_length, Token::GT); | 2375 if_invalid.If<HCompareNumericAndBranch>(length, max_length, Token::GT); |
| 2376 if_invalid.Then(); | 2376 if_invalid.Then(); |
| 2377 { | 2377 { |
| 2378 Add<HCallRuntime>( | 2378 Add<HCallRuntime>( |
| 2379 Runtime::FunctionForId(Runtime::kThrowInvalidStringLength), 0); | 2379 Runtime::FunctionForId(Runtime::kThrowInvalidStringLength), 0); |
| 2380 } | 2380 } |
| 2381 if_invalid.End(); | 2381 if_invalid.End(); |
| 2382 } else { | 2382 } else { |
| 2383 graph()->MarkDependsOnStringLengthOverflow(); | |
| 2384 Add<HBoundsCheck>(length, max_length); | 2383 Add<HBoundsCheck>(length, max_length); |
| 2385 } | 2384 } |
| 2386 return length; | 2385 return length; |
| 2387 } | 2386 } |
| 2388 | 2387 |
| 2389 | 2388 |
| 2390 HValue* HGraphBuilder::BuildCreateConsString( | 2389 HValue* HGraphBuilder::BuildCreateConsString( |
| 2391 HValue* length, | 2390 HValue* length, |
| 2392 HValue* left, | 2391 HValue* left, |
| 2393 HValue* right, | 2392 HValue* right, |
| (...skipping 10950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13344 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13343 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 13345 } | 13344 } |
| 13346 | 13345 |
| 13347 #ifdef DEBUG | 13346 #ifdef DEBUG |
| 13348 graph_->Verify(false); // No full verify. | 13347 graph_->Verify(false); // No full verify. |
| 13349 #endif | 13348 #endif |
| 13350 } | 13349 } |
| 13351 | 13350 |
| 13352 } // namespace internal | 13351 } // namespace internal |
| 13353 } // namespace v8 | 13352 } // namespace v8 |
| OLD | NEW |