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

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

Issue 7860045: Stack allocating block scoped variables. Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased on tip of tree. Created 9 years 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/full-codegen.cc ('k') | src/mips/full-codegen-mips.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 608
609 MemOperand FullCodeGenerator::StackOperand(Variable* var) { 609 MemOperand FullCodeGenerator::StackOperand(Variable* var) {
610 ASSERT(var->IsStackAllocated()); 610 ASSERT(var->IsStackAllocated());
611 // Offset is negative because higher indexes are at lower addresses. 611 // Offset is negative because higher indexes are at lower addresses.
612 int offset = -var->index() * kPointerSize; 612 int offset = -var->index() * kPointerSize;
613 // Adjust by a (parameter or local) base offset. 613 // Adjust by a (parameter or local) base offset.
614 if (var->IsParameter()) { 614 if (var->IsParameter()) {
615 offset += (info_->scope()->num_parameters() + 1) * kPointerSize; 615 offset += (info_->scope()->num_parameters() + 1) * kPointerSize;
616 } else { 616 } else {
617 offset += JavaScriptFrameConstants::kLocal0Offset; 617 offset += JavaScriptFrameConstants::kLocal0Offset;
618 // Test if the variable is from a nested block scope.
619 if (info_->scope() != var->scope()) {
620 // Skip handlers and stack locals from enclosing block scopes.
621 offset -= var->scope()->stack_slots_depth() * kPointerSize;
622 }
618 } 623 }
619 return Operand(ebp, offset); 624 return Operand(ebp, offset);
620 } 625 }
621 626
622 627
623 MemOperand FullCodeGenerator::VarOperand(Variable* var, Register scratch) { 628 MemOperand FullCodeGenerator::VarOperand(Variable* var, Register scratch) {
624 ASSERT(var->IsContextSlot() || var->IsStackAllocated()); 629 ASSERT(var->IsContextSlot() || var->IsStackAllocated());
625 if (var->IsContextSlot()) { 630 if (var->IsContextSlot()) {
626 int context_chain_length = scope()->ContextChainLength(var->scope()); 631 int context_chain_length = scope()->ContextChainLength(var->scope());
627 __ LoadContext(scratch, context_chain_length); 632 __ LoadContext(scratch, context_chain_length);
(...skipping 3752 matching lines...) Expand 10 before | Expand all | Expand 10 after
4380 *context_length = 0; 4385 *context_length = 0;
4381 return previous_; 4386 return previous_;
4382 } 4387 }
4383 4388
4384 4389
4385 #undef __ 4390 #undef __
4386 4391
4387 } } // namespace v8::internal 4392 } } // namespace v8::internal
4388 4393
4389 #endif // V8_TARGET_ARCH_IA32 4394 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/full-codegen.cc ('k') | src/mips/full-codegen-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698