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

Side by Side Diff: src/typing.cc

Issue 17444011: Fix to_boolean type feedback for unary and binary ops (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 6 months 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
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 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 402
403 void AstTyper::VisitUnaryOperation(UnaryOperation* expr) { 403 void AstTyper::VisitUnaryOperation(UnaryOperation* expr) {
404 ASSERT(!HasStackOverflow()); 404 ASSERT(!HasStackOverflow());
405 CHECK_ALIVE(Visit(expr->expression())); 405 CHECK_ALIVE(Visit(expr->expression()));
406 406
407 // Collect type feedback. 407 // Collect type feedback.
408 Handle<Type> op_type = oracle()->UnaryType(expr->UnaryOperationFeedbackId()); 408 Handle<Type> op_type = oracle()->UnaryType(expr->UnaryOperationFeedbackId());
409 MergeLowerType(expr->expression(), op_type); 409 MergeLowerType(expr->expression(), op_type);
410 if (expr->op() == Token::NOT) { 410 if (expr->op() == Token::NOT) {
411 // TODO(rossberg): only do in test or value context. 411 // TODO(rossberg): only do in test or value context.
412 expr->expression()->RecordToBooleanTypeFeedback(oracle()); 412 expr->RecordToBooleanTypeFeedback(oracle(), expr->expression()->test_id());
413 } 413 }
414 } 414 }
415 415
416 416
417 void AstTyper::VisitCountOperation(CountOperation* expr) { 417 void AstTyper::VisitCountOperation(CountOperation* expr) {
418 ASSERT(!HasStackOverflow()); 418 ASSERT(!HasStackOverflow());
419 CHECK_ALIVE(Visit(expr->expression())); 419 CHECK_ALIVE(Visit(expr->expression()));
420 420
421 expr->RecordTypeFeedback(oracle(), zone()); 421 expr->RecordTypeFeedback(oracle(), zone());
422 Property* prop = expr->expression()->AsProperty(); 422 Property* prop = expr->expression()->AsProperty();
(...skipping 11 matching lines...) Expand all
434 // Collect type feedback. 434 // Collect type feedback.
435 Handle<Type> type, left_type, right_type; 435 Handle<Type> type, left_type, right_type;
436 Maybe<int> fixed_right_arg; 436 Maybe<int> fixed_right_arg;
437 oracle()->BinaryType(expr->BinaryOperationFeedbackId(), 437 oracle()->BinaryType(expr->BinaryOperationFeedbackId(),
438 &left_type, &right_type, &type, &fixed_right_arg); 438 &left_type, &right_type, &type, &fixed_right_arg);
439 MergeLowerType(expr, type); 439 MergeLowerType(expr, type);
440 MergeLowerType(expr->left(), left_type); 440 MergeLowerType(expr->left(), left_type);
441 MergeLowerType(expr->right(), right_type); 441 MergeLowerType(expr->right(), right_type);
442 expr->set_fixed_right_arg(fixed_right_arg); 442 expr->set_fixed_right_arg(fixed_right_arg);
443 if (expr->op() == Token::OR || expr->op() == Token::AND) { 443 if (expr->op() == Token::OR || expr->op() == Token::AND) {
444 expr->left()->RecordToBooleanTypeFeedback(oracle()); 444 expr->RecordToBooleanTypeFeedback(oracle(), expr->left()->test_id());
Jakob Kummerow 2013/06/24 09:25:07 I don't think this change is correct, seeing that
445 expr->RecordToBooleanTypeFeedback(oracle(), expr->right()->test_id());
445 } 446 }
446 } 447 }
447 448
448 449
449 void AstTyper::VisitCompareOperation(CompareOperation* expr) { 450 void AstTyper::VisitCompareOperation(CompareOperation* expr) {
450 ASSERT(!HasStackOverflow()); 451 ASSERT(!HasStackOverflow());
451 CHECK_ALIVE(Visit(expr->left())); 452 CHECK_ALIVE(Visit(expr->left()));
452 CHECK_ALIVE(Visit(expr->right())); 453 CHECK_ALIVE(Visit(expr->right()));
453 454
454 // Collect type feedback. 455 // Collect type feedback.
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 } 526 }
526 527
527 528
528 void AstTyper::VisitModuleStatement(ModuleStatement* stmt) { 529 void AstTyper::VisitModuleStatement(ModuleStatement* stmt) {
529 ASSERT(!HasStackOverflow()); 530 ASSERT(!HasStackOverflow());
530 CHECK_ALIVE(Visit(stmt->body())); 531 CHECK_ALIVE(Visit(stmt->body()));
531 } 532 }
532 533
533 534
534 } } // namespace v8::internal 535 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698