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

Side by Side Diff: src/hydrogen.cc

Issue 67473007: Fix missing type feedback check for Generic*String addition. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-318671.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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 8341 matching lines...) Expand 10 before | Expand all | Expand 10 after
8352 Deoptimizer::SOFT); 8352 Deoptimizer::SOFT);
8353 right_type = handle(Type::Any(), isolate()); 8353 right_type = handle(Type::Any(), isolate());
8354 } else { 8354 } else {
8355 if (!maybe_string_add) right = TruncateToNumber(right, &right_type); 8355 if (!maybe_string_add) right = TruncateToNumber(right, &right_type);
8356 right_rep = Representation::FromType(right_type); 8356 right_rep = Representation::FromType(right_type);
8357 } 8357 }
8358 8358
8359 // Special case for string addition here. 8359 // Special case for string addition here.
8360 if (op == Token::ADD && 8360 if (op == Token::ADD &&
8361 (left_type->Is(Type::String()) || right_type->Is(Type::String()))) { 8361 (left_type->Is(Type::String()) || right_type->Is(Type::String()))) {
8362 // Validate type feedback for left argument.
8362 if (left_type->Is(Type::String())) { 8363 if (left_type->Is(Type::String())) {
8363 IfBuilder if_isstring(this); 8364 IfBuilder if_isstring(this);
8364 if_isstring.If<HIsStringAndBranch>(left); 8365 if_isstring.If<HIsStringAndBranch>(left);
8365 if_isstring.Then(); 8366 if_isstring.Then();
8366 if_isstring.ElseDeopt("Expected string for LHS of binary operation"); 8367 if_isstring.ElseDeopt("Expected string for LHS of binary operation");
8367 } else if (left_type->Is(Type::Number())) { 8368 }
8369
8370 // Validate type feedback for right argument.
8371 if (right_type->Is(Type::String())) {
8372 IfBuilder if_isstring(this);
8373 if_isstring.If<HIsStringAndBranch>(right);
8374 if_isstring.Then();
8375 if_isstring.ElseDeopt("Expected string for RHS of binary operation");
8376 }
8377
8378 // Convert left argument as necessary.
8379 if (left_type->Is(Type::Number())) {
8380 ASSERT(right_type->Is(Type::String()));
8368 left = BuildNumberToString(left, left_type); 8381 left = BuildNumberToString(left, left_type);
8369 } else { 8382 } else if (!left_type->Is(Type::String())) {
8370 ASSERT(right_type->Is(Type::String())); 8383 ASSERT(right_type->Is(Type::String()));
8371 HValue* function = AddLoadJSBuiltin(Builtins::STRING_ADD_RIGHT); 8384 HValue* function = AddLoadJSBuiltin(Builtins::STRING_ADD_RIGHT);
8372 Add<HPushArgument>(left); 8385 Add<HPushArgument>(left);
8373 Add<HPushArgument>(right); 8386 Add<HPushArgument>(right);
8374 return NewUncasted<HInvokeFunction>(function, 2); 8387 return NewUncasted<HInvokeFunction>(function, 2);
8375 } 8388 }
8376 8389
8377 if (right_type->Is(Type::String())) { 8390 // Convert right argument as necessary.
8378 IfBuilder if_isstring(this); 8391 if (right_type->Is(Type::Number())) {
8379 if_isstring.If<HIsStringAndBranch>(right); 8392 ASSERT(left_type->Is(Type::String()));
8380 if_isstring.Then();
8381 if_isstring.ElseDeopt("Expected string for RHS of binary operation");
8382 } else if (right_type->Is(Type::Number())) {
8383 right = BuildNumberToString(right, right_type); 8393 right = BuildNumberToString(right, right_type);
8384 } else { 8394 } else if (!right_type->Is(Type::String())) {
8385 ASSERT(left_type->Is(Type::String())); 8395 ASSERT(left_type->Is(Type::String()));
8386 HValue* function = AddLoadJSBuiltin(Builtins::STRING_ADD_LEFT); 8396 HValue* function = AddLoadJSBuiltin(Builtins::STRING_ADD_LEFT);
8387 Add<HPushArgument>(left); 8397 Add<HPushArgument>(left);
8388 Add<HPushArgument>(right); 8398 Add<HPushArgument>(right);
8389 return NewUncasted<HInvokeFunction>(function, 2); 8399 return NewUncasted<HInvokeFunction>(function, 2);
8390 } 8400 }
8391 8401
8392 return NewUncasted<HStringAdd>(left, right, STRING_ADD_CHECK_NONE); 8402 return NewUncasted<HStringAdd>(left, right, STRING_ADD_CHECK_NONE);
8393 } 8403 }
8394 8404
(...skipping 1937 matching lines...) Expand 10 before | Expand all | Expand 10 after
10332 if (ShouldProduceTraceOutput()) { 10342 if (ShouldProduceTraceOutput()) {
10333 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 10343 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
10334 } 10344 }
10335 10345
10336 #ifdef DEBUG 10346 #ifdef DEBUG
10337 graph_->Verify(false); // No full verify. 10347 graph_->Verify(false); // No full verify.
10338 #endif 10348 #endif
10339 } 10349 }
10340 10350
10341 } } // namespace v8::internal 10351 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-318671.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698