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

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

Issue 5667: In the code generator, avoid loading the arguments object to the... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years, 2 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/codegen-arm.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 643 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 // was allocated and copied into above. If the address was not 654 // was allocated and copied into above. If the address was not
655 // saved to TOS, we push ecx onto the stack. 655 // saved to TOS, we push ecx onto the stack.
656 656
657 // Store the arguments object. 657 // Store the arguments object.
658 // This must happen after context initialization because 658 // This must happen after context initialization because
659 // the arguments object may be stored in the context 659 // the arguments object may be stored in the context
660 if (arguments_object_allocated) { 660 if (arguments_object_allocated) {
661 ASSERT(scope->arguments() != NULL); 661 ASSERT(scope->arguments() != NULL);
662 ASSERT(scope->arguments_shadow() != NULL); 662 ASSERT(scope->arguments_shadow() != NULL);
663 Comment cmnt(masm_, "[ store arguments object"); 663 Comment cmnt(masm_, "[ store arguments object");
664 { 664 { Reference shadow_ref(this, scope->arguments_shadow());
665 Reference target(this, scope->arguments()); 665 { Reference arguments_ref(this, scope->arguments());
666 if (!arguments_object_saved) { 666 // If the newly-allocated arguments object is already on the
667 __ push(Operand(ecx)); 667 // stack, we make use of the property that references representing
668 // variables take up no space on the expression stack (ie, it
669 // doesn't matter that the stored value is actually below the
670 // reference).
671 ASSERT(arguments_ref.size() == 0);
672 ASSERT(shadow_ref.size() == 0);
673
674 // If the newly-allocated argument object is not already on the
675 // stack, we rely on the property that loading a
676 // (zero-sized) reference will not clobber the ecx register.
677 if (!arguments_object_saved) {
678 __ push(ecx);
679 }
680 SetValue(&arguments_ref);
668 } 681 }
669 SetValue(&target); 682 SetValue(&shadow_ref);
670 } 683 }
671 // The value of arguments must also be stored in .arguments. 684 __ pop(eax); // Value is no longer needed.
672 // TODO(1241813): This code can probably be improved by fusing it with
673 // the code that stores the arguments object above.
674 {
675 Reference target(this, scope->arguments_shadow());
676 Load(scope->arguments());
677 SetValue(&target);
678 }
679 } 685 }
680 686
681 // Generate code to 'execute' declarations and initialize 687 // Generate code to 'execute' declarations and initialize
682 // functions (source elements). In case of an illegal 688 // functions (source elements). In case of an illegal
683 // redeclaration we need to handle that instead of processing the 689 // redeclaration we need to handle that instead of processing the
684 // declarations. 690 // declarations.
685 if (scope->HasIllegalRedeclaration()) { 691 if (scope->HasIllegalRedeclaration()) {
686 Comment cmnt(masm_, "[ illegal redeclarations"); 692 Comment cmnt(masm_, "[ illegal redeclarations");
687 scope->VisitIllegalRedeclaration(this); 693 scope->VisitIllegalRedeclaration(this);
688 } else { 694 } else {
(...skipping 4751 matching lines...) Expand 10 before | Expand all | Expand 10 after
5440 bool is_eval) { 5446 bool is_eval) {
5441 Handle<Code> code = Ia32CodeGenerator::MakeCode(fun, script, is_eval); 5447 Handle<Code> code = Ia32CodeGenerator::MakeCode(fun, script, is_eval);
5442 if (!code.is_null()) { 5448 if (!code.is_null()) {
5443 Counters::total_compiled_code_size.Increment(code->instruction_size()); 5449 Counters::total_compiled_code_size.Increment(code->instruction_size());
5444 } 5450 }
5445 return code; 5451 return code;
5446 } 5452 }
5447 5453
5448 5454
5449 } } // namespace v8::internal 5455 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/codegen-arm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698