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

Side by Side Diff: src/compiler.cc

Issue 384078: Fast-codegen: Added support for arguments in functions. (Closed)
Patch Set: Created 11 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
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 if (slot != NULL && slot->type() == Slot::CONTEXT) { 593 if (slot != NULL && slot->type() == Slot::CONTEXT) {
594 if (FLAG_trace_bailout) { 594 if (FLAG_trace_bailout) {
595 PrintF("function has context-allocated parameters"); 595 PrintF("function has context-allocated parameters");
596 } 596 }
597 return NORMAL; 597 return NORMAL;
598 } 598 }
599 } 599 }
600 } 600 }
601 601
602 if (scope->arguments() != NULL) { 602 if (scope->arguments() != NULL) {
603 if (FLAG_trace_bailout) PrintF("function uses 'arguments'\n"); 603 // if (FLAG_trace_bailout) PrintF("function uses 'arguments'\n");
604 return NORMAL; 604 // return NORMAL;
William Hesse 2009/11/12 09:56:49 Remove.
Lasse Reichstein 2009/11/13 08:54:37 Done.
605 } 605 }
606 606
607 has_supported_syntax_ = true; 607 has_supported_syntax_ = true;
608 VisitDeclarations(scope->declarations()); 608 VisitDeclarations(scope->declarations());
609 if (!has_supported_syntax_) return NORMAL; 609 if (!has_supported_syntax_) return NORMAL;
610 610
611 VisitStatements(fun->body()); 611 VisitStatements(fun->body());
612 return has_supported_syntax_ ? FAST : NORMAL; 612 return has_supported_syntax_ ? FAST : NORMAL;
613 } 613 }
614 614
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 } 785 }
786 786
787 787
788 void CodeGenSelector::VisitSlot(Slot* expr) { 788 void CodeGenSelector::VisitSlot(Slot* expr) {
789 UNREACHABLE(); 789 UNREACHABLE();
790 } 790 }
791 791
792 792
793 void CodeGenSelector::VisitVariableProxy(VariableProxy* expr) { 793 void CodeGenSelector::VisitVariableProxy(VariableProxy* expr) {
794 Expression* rewrite = expr->var()->rewrite(); 794 Expression* rewrite = expr->var()->rewrite();
795 // A rewrite of NULL indicates a global variable. 795 // A rewrite of NULL indicates a global variable or explict arguments access.
William Hesse 2009/11/12 09:56:49 Lie!
Lasse Reichstein 2009/11/13 08:54:37 Truthified.
796 if (rewrite != NULL) { 796 if (rewrite != NULL) {
797 // Non-global. 797 // Non-global.
798 Slot* slot = rewrite->AsSlot(); 798 Slot* slot = rewrite->AsSlot();
799 if (slot == NULL) { 799 if (slot != NULL) {
800 // This is a variable rewritten to an explicit property access 800 Slot::Type type = slot->type();
801 // on the arguments object. 801 // When LOOKUP slots are enabled, some currently dead code
802 BAILOUT("non-global/non-slot variable reference"); 802 // implementing unary typeof will become live.
803 } 803 if (type == Slot::LOOKUP) {
804 804 BAILOUT("Lookup slot");
805 Slot::Type type = slot->type(); 805 }
806 // When LOOKUP slots are enabled, some currently dead code 806 } else {
807 // implementing unary typeof will become live. 807 Property* property = rewrite->AsProperty();
William Hesse 2009/11/12 09:56:49 Put a comment, indicating what this code is for.
Lasse Reichstein 2009/11/13 08:54:37 Added
808 if (type == Slot::LOOKUP) { 808 ASSERT_NOT_NULL(property);
809 BAILOUT("Lookup slot"); 809 ASSERT_NE(Expression::kUninitialized, context_);
810 Visit(property);
811 property->set_context(context_);
Kevin Millikin (Chromium) 2009/11/12 14:23:13 I'm surprised that this works. For a variable in
810 } 812 }
811 } 813 }
812 } 814 }
813 815
814 816
815 void CodeGenSelector::VisitLiteral(Literal* expr) { 817 void CodeGenSelector::VisitLiteral(Literal* expr) {
816 /* Nothing to do. */ 818 /* Nothing to do. */
817 } 819 }
818 820
819 821
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
1107 1109
1108 void CodeGenSelector::VisitThisFunction(ThisFunction* expr) { 1110 void CodeGenSelector::VisitThisFunction(ThisFunction* expr) {
1109 BAILOUT("ThisFunction"); 1111 BAILOUT("ThisFunction");
1110 } 1112 }
1111 1113
1112 #undef BAILOUT 1114 #undef BAILOUT
1113 #undef CHECK_BAILOUT 1115 #undef CHECK_BAILOUT
1114 1116
1115 1117
1116 } } // namespace v8::internal 1118 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698