Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(213)

Side by Side Diff: src/crankshaft/hydrogen.cc

Issue 2589823003: [crankshaft] Properly handle OOB string accesses. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-665793.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 7490 matching lines...) Expand 10 before | Expand all | Expand 10 after
7501 7501
7502 7502
7503 void HOptimizedGraphBuilder::BuildLoad(Property* expr, 7503 void HOptimizedGraphBuilder::BuildLoad(Property* expr,
7504 BailoutId ast_id) { 7504 BailoutId ast_id) {
7505 HInstruction* instr = NULL; 7505 HInstruction* instr = NULL;
7506 if (expr->IsStringAccess() && expr->GetKeyType() == ELEMENT) { 7506 if (expr->IsStringAccess() && expr->GetKeyType() == ELEMENT) {
7507 HValue* index = Pop(); 7507 HValue* index = Pop();
7508 HValue* string = Pop(); 7508 HValue* string = Pop();
7509 HInstruction* char_code = BuildStringCharCodeAt(string, index); 7509 HInstruction* char_code = BuildStringCharCodeAt(string, index);
7510 AddInstruction(char_code); 7510 AddInstruction(char_code);
7511 if (char_code->IsConstant()) {
7512 HConstant* c_code = HConstant::cast(char_code);
7513 if (c_code->HasNumberValue() && std::isnan(c_code->DoubleValue())) {
7514 Add<HDeoptimize>(DeoptimizeReason::kOutOfBounds, Deoptimizer::EAGER);
7515 }
7516 }
7511 instr = NewUncasted<HStringCharFromCode>(char_code); 7517 instr = NewUncasted<HStringCharFromCode>(char_code);
7512 7518
7513 } else if (expr->key()->IsPropertyName()) { 7519 } else if (expr->key()->IsPropertyName()) {
7514 Handle<String> name = expr->key()->AsLiteral()->AsPropertyName(); 7520 Handle<String> name = expr->key()->AsLiteral()->AsPropertyName();
7515 HValue* object = Pop(); 7521 HValue* object = Pop();
7516 7522
7517 HValue* value = BuildNamedAccess(LOAD, ast_id, expr->LoadId(), expr, 7523 HValue* value = BuildNamedAccess(LOAD, ast_id, expr->LoadId(), expr,
7518 expr->PropertyFeedbackSlot(), object, name, 7524 expr->PropertyFeedbackSlot(), object, name,
7519 NULL, expr->IsUninitialized()); 7525 NULL, expr->IsUninitialized());
7520 if (value == NULL) return; 7526 if (value == NULL) return;
(...skipping 5458 matching lines...) Expand 10 before | Expand all | Expand 10 after
12979 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 12985 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
12980 } 12986 }
12981 12987
12982 #ifdef DEBUG 12988 #ifdef DEBUG
12983 graph_->Verify(false); // No full verify. 12989 graph_->Verify(false); // No full verify.
12984 #endif 12990 #endif
12985 } 12991 }
12986 12992
12987 } // namespace internal 12993 } // namespace internal
12988 } // namespace v8 12994 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-665793.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698