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

Side by Side Diff: src/fast-codegen.cc

Issue 603004: Add last use data flow information to the fast code generator.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 10 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/data-flow.cc ('k') | test/mjsunit/compiler/simple-binary-op.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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 421
422 422
423 #define __ ACCESS_MASM(masm()) 423 #define __ ACCESS_MASM(masm())
424 424
425 Handle<Code> FastCodeGenerator::MakeCode(CompilationInfo* info) { 425 Handle<Code> FastCodeGenerator::MakeCode(CompilationInfo* info) {
426 // Label the AST before calling MakeCodePrologue, so AST node numbers are 426 // Label the AST before calling MakeCodePrologue, so AST node numbers are
427 // printed with the AST. 427 // printed with the AST.
428 AstLabeler labeler; 428 AstLabeler labeler;
429 labeler.Label(info); 429 labeler.Label(info);
430 430
431 LivenessAnalyzer analyzer;
432 analyzer.Analyze(info->function());
433
431 CodeGenerator::MakeCodePrologue(info); 434 CodeGenerator::MakeCodePrologue(info);
432 435
433 const int kInitialBufferSize = 4 * KB; 436 const int kInitialBufferSize = 4 * KB;
434 MacroAssembler masm(NULL, kInitialBufferSize); 437 MacroAssembler masm(NULL, kInitialBufferSize);
435 438
436 // Generate the fast-path code. 439 // Generate the fast-path code.
437 FastCodeGenerator fast_cgen(&masm); 440 FastCodeGenerator fast_cgen(&masm);
438 fast_cgen.Generate(info); 441 fast_cgen.Generate(info);
439 if (fast_cgen.HasStackOverflow()) { 442 if (fast_cgen.HasStackOverflow()) {
440 ASSERT(!Top::has_pending_exception()); 443 ASSERT(!Top::has_pending_exception());
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 ASSERT(lookup.IsValid()); 580 ASSERT(lookup.IsValid());
578 ASSERT(lookup.IsDontDelete()); 581 ASSERT(lookup.IsDontDelete());
579 Handle<Object> cell(info()->global_object()->GetPropertyCell(&lookup)); 582 Handle<Object> cell(info()->global_object()->GetPropertyCell(&lookup));
580 583
581 // Global variable lookups do not have side effects, so we do not need to 584 // Global variable lookups do not have side effects, so we do not need to
582 // emit code if we are in an effect context. 585 // emit code if we are in an effect context.
583 if (!destination().is(no_reg)) { 586 if (!destination().is(no_reg)) {
584 Comment cmnt(masm(), ";; Global"); 587 Comment cmnt(masm(), ";; Global");
585 if (FLAG_print_ir) { 588 if (FLAG_print_ir) {
586 SmartPointer<char> name = expr->name()->ToCString(); 589 SmartPointer<char> name = expr->name()->ToCString();
587 PrintF("%d: t%d = Global(%s)\n", expr->num(), expr->num(), *name); 590 PrintF("%d: t%d = Global(%s) // last_use = %d\n", expr->num(),
591 expr->num(), *name, expr->var_def()->last_use()->num());
588 } 592 }
589 EmitGlobalVariableLoad(cell); 593 EmitGlobalVariableLoad(cell);
590 } 594 }
591 } 595 }
592 596
593 597
594 void FastCodeGenerator::VisitLiteral(Literal* expr) { 598 void FastCodeGenerator::VisitLiteral(Literal* expr) {
595 UNREACHABLE(); 599 UNREACHABLE();
596 } 600 }
597 601
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 ASSERT(prop->obj()->AsVariableProxy()->var()->is_this()); 635 ASSERT(prop->obj()->AsVariableProxy()->var()->is_this());
632 ASSERT(prop->key()->IsPropertyName()); 636 ASSERT(prop->key()->IsPropertyName());
633 Handle<String> name = 637 Handle<String> name =
634 Handle<String>::cast(prop->key()->AsLiteral()->handle()); 638 Handle<String>::cast(prop->key()->AsLiteral()->handle());
635 639
636 Comment cmnt(masm(), ";; Store to this"); 640 Comment cmnt(masm(), ";; Store to this");
637 if (FLAG_print_ir) { 641 if (FLAG_print_ir) {
638 SmartPointer<char> name_string = name->ToCString(); 642 SmartPointer<char> name_string = name->ToCString();
639 PrintF("%d: ", expr->num()); 643 PrintF("%d: ", expr->num());
640 if (!destination().is(no_reg)) PrintF("t%d = ", expr->num()); 644 if (!destination().is(no_reg)) PrintF("t%d = ", expr->num());
641 PrintF("Store(this, \"%s\", t%d)\n", *name_string, expr->value()->num()); 645 PrintF("Store(this, \"%s\", t%d) // last_use(this) = %d\n", *name_string,
646 expr->value()->num(),
647 expr->var_def()->last_use()->num());
642 } 648 }
643 649
644 EmitThisPropertyStore(name); 650 EmitThisPropertyStore(name);
645 } 651 }
646 652
647 653
648 void FastCodeGenerator::VisitThrow(Throw* expr) { 654 void FastCodeGenerator::VisitThrow(Throw* expr) {
649 UNREACHABLE(); 655 UNREACHABLE();
650 } 656 }
651 657
652 658
653 void FastCodeGenerator::VisitProperty(Property* expr) { 659 void FastCodeGenerator::VisitProperty(Property* expr) {
654 ASSERT_NOT_NULL(expr->obj()->AsVariableProxy()); 660 ASSERT_NOT_NULL(expr->obj()->AsVariableProxy());
655 ASSERT(expr->obj()->AsVariableProxy()->var()->is_this()); 661 ASSERT(expr->obj()->AsVariableProxy()->var()->is_this());
656 ASSERT(expr->key()->IsPropertyName()); 662 ASSERT(expr->key()->IsPropertyName());
657 if (!destination().is(no_reg)) { 663 if (!destination().is(no_reg)) {
658 Handle<String> name = 664 Handle<String> name =
659 Handle<String>::cast(expr->key()->AsLiteral()->handle()); 665 Handle<String>::cast(expr->key()->AsLiteral()->handle());
660 666
661 Comment cmnt(masm(), ";; Load from this"); 667 Comment cmnt(masm(), ";; Load from this");
662 if (FLAG_print_ir) { 668 if (FLAG_print_ir) {
663 SmartPointer<char> name_string = name->ToCString(); 669 SmartPointer<char> name_string = name->ToCString();
664 PrintF("%d: t%d = Load(this, \"%s\")\n", 670 PrintF("%d: t%d = Load(this, \"%s\") // last_use(this) = %d\n",
665 expr->num(), expr->num(), *name_string); 671 expr->num(), expr->num(), *name_string,
672 expr->var_def()->last_use()->num());
666 } 673 }
667 EmitThisPropertyLoad(name); 674 EmitThisPropertyLoad(name);
668 } 675 }
669 } 676 }
670 677
671 678
672 void FastCodeGenerator::VisitCall(Call* expr) { 679 void FastCodeGenerator::VisitCall(Call* expr) {
673 UNREACHABLE(); 680 UNREACHABLE();
674 } 681 }
675 682
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 731
725 732
726 void FastCodeGenerator::VisitThisFunction(ThisFunction* expr) { 733 void FastCodeGenerator::VisitThisFunction(ThisFunction* expr) {
727 UNREACHABLE(); 734 UNREACHABLE();
728 } 735 }
729 736
730 #undef __ 737 #undef __
731 738
732 739
733 } } // namespace v8::internal 740 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/data-flow.cc ('k') | test/mjsunit/compiler/simple-binary-op.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698