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

Side by Side Diff: src/typing.cc

Issue 17468003: Use AST's type field and merge types for unary, binary & compare ICs (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Comments 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
« no previous file with comments | « src/typing.h ('k') | src/x64/code-stubs-x64.cc » ('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 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 Expression* arg = args->at(i); 397 Expression* arg = args->at(i);
398 CHECK_ALIVE(Visit(arg)); 398 CHECK_ALIVE(Visit(arg));
399 } 399 }
400 } 400 }
401 401
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 expr->RecordTypeFeedback(oracle()); 407 // Collect type feedback.
408 Handle<Type> op_type = oracle()->UnaryType(expr->UnaryOperationFeedbackId());
409 MergeLowerType(expr->expression(), op_type);
408 if (expr->op() == Token::NOT) { 410 if (expr->op() == Token::NOT) {
409 // TODO(rossberg): only do in test or value context. 411 // TODO(rossberg): only do in test or value context.
410 expr->expression()->RecordToBooleanTypeFeedback(oracle()); 412 expr->expression()->RecordToBooleanTypeFeedback(oracle());
411 } 413 }
412 } 414 }
413 415
414 416
415 void AstTyper::VisitCountOperation(CountOperation* expr) { 417 void AstTyper::VisitCountOperation(CountOperation* expr) {
416 ASSERT(!HasStackOverflow()); 418 ASSERT(!HasStackOverflow());
417 CHECK_ALIVE(Visit(expr->expression())); 419 CHECK_ALIVE(Visit(expr->expression()));
418 420
419 expr->RecordTypeFeedback(oracle(), zone()); 421 expr->RecordTypeFeedback(oracle(), zone());
420 Property* prop = expr->expression()->AsProperty(); 422 Property* prop = expr->expression()->AsProperty();
421 if (prop != NULL) { 423 if (prop != NULL) {
422 prop->RecordTypeFeedback(oracle(), zone()); 424 prop->RecordTypeFeedback(oracle(), zone());
423 } 425 }
424 } 426 }
425 427
426 428
427 void AstTyper::VisitBinaryOperation(BinaryOperation* expr) { 429 void AstTyper::VisitBinaryOperation(BinaryOperation* expr) {
428 ASSERT(!HasStackOverflow()); 430 ASSERT(!HasStackOverflow());
429 CHECK_ALIVE(Visit(expr->left())); 431 CHECK_ALIVE(Visit(expr->left()));
430 CHECK_ALIVE(Visit(expr->right())); 432 CHECK_ALIVE(Visit(expr->right()));
431 433
432 expr->RecordTypeFeedback(oracle()); 434 // Collect type feedback.
435 Handle<Type> left_type, right_type, result_type;
436 Maybe<int> fixed_right_arg;
437 oracle()->BinaryType(expr->BinaryOperationFeedbackId(),
438 &left_type, &right_type, &result_type, &fixed_right_arg);
439 MergeLowerType(expr->left(), left_type);
440 MergeLowerType(expr->right(), right_type);
441 expr->set_result_type(result_type);
442 expr->set_fixed_right_arg(fixed_right_arg);
433 if (expr->op() == Token::OR || expr->op() == Token::AND) { 443 if (expr->op() == Token::OR || expr->op() == Token::AND) {
434 expr->left()->RecordToBooleanTypeFeedback(oracle()); 444 expr->left()->RecordToBooleanTypeFeedback(oracle());
435 } 445 }
436 } 446 }
437 447
438 448
439 void AstTyper::VisitCompareOperation(CompareOperation* expr) { 449 void AstTyper::VisitCompareOperation(CompareOperation* expr) {
440 ASSERT(!HasStackOverflow()); 450 ASSERT(!HasStackOverflow());
441 CHECK_ALIVE(Visit(expr->left())); 451 CHECK_ALIVE(Visit(expr->left()));
442 CHECK_ALIVE(Visit(expr->right())); 452 CHECK_ALIVE(Visit(expr->right()));
443 453
444 expr->RecordTypeFeedback(oracle()); 454 // Collect type feedback.
455 Handle<Type> left_type, right_type, combined_type;
456 oracle()->CompareType(expr->CompareOperationFeedbackId(),
457 &left_type, &right_type, &combined_type);
458 MergeLowerType(expr->left(), left_type);
459 MergeLowerType(expr->right(), right_type);
460 expr->set_combined_type(combined_type);
445 } 461 }
446 462
447 463
448 void AstTyper::VisitThisFunction(ThisFunction* expr) { 464 void AstTyper::VisitThisFunction(ThisFunction* expr) {
449 ASSERT(!HasStackOverflow()); 465 ASSERT(!HasStackOverflow());
450 } 466 }
451 467
452 468
453 void AstTyper::VisitDeclarations(ZoneList<Declaration*>* decls) { 469 void AstTyper::VisitDeclarations(ZoneList<Declaration*>* decls) {
454 ASSERT(!HasStackOverflow()); 470 ASSERT(!HasStackOverflow());
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 } 525 }
510 526
511 527
512 void AstTyper::VisitModuleStatement(ModuleStatement* stmt) { 528 void AstTyper::VisitModuleStatement(ModuleStatement* stmt) {
513 ASSERT(!HasStackOverflow()); 529 ASSERT(!HasStackOverflow());
514 CHECK_ALIVE(Visit(stmt->body())); 530 CHECK_ALIVE(Visit(stmt->body()));
515 } 531 }
516 532
517 533
518 } } // namespace v8::internal 534 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/typing.h ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698