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

Side by Side Diff: src/x64/full-codegen-x64.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/scopes.cc ('k') | test/mjsunit/harmony/debug-blockscopes.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 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 589 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 600
601 MemOperand FullCodeGenerator::StackOperand(Variable* var) { 601 MemOperand FullCodeGenerator::StackOperand(Variable* var) {
602 ASSERT(var->IsStackAllocated()); 602 ASSERT(var->IsStackAllocated());
603 // Offset is negative because higher indexes are at lower addresses. 603 // Offset is negative because higher indexes are at lower addresses.
604 int offset = -var->index() * kPointerSize; 604 int offset = -var->index() * kPointerSize;
605 // Adjust by a (parameter or local) base offset. 605 // Adjust by a (parameter or local) base offset.
606 if (var->IsParameter()) { 606 if (var->IsParameter()) {
607 offset += (info_->scope()->num_parameters() + 1) * kPointerSize; 607 offset += (info_->scope()->num_parameters() + 1) * kPointerSize;
608 } else { 608 } else {
609 offset += JavaScriptFrameConstants::kLocal0Offset; 609 offset += JavaScriptFrameConstants::kLocal0Offset;
610 // Test if the variable is from a nested block scope.
611 if (info_->scope() != var->scope()) {
612 // Skip handlers and stack locals from enclosing block scopes.
613 offset -= var->scope()->stack_slots_depth() * kPointerSize;
614 }
610 } 615 }
611 return Operand(rbp, offset); 616 return Operand(rbp, offset);
612 } 617 }
613 618
614 619
615 MemOperand FullCodeGenerator::VarOperand(Variable* var, Register scratch) { 620 MemOperand FullCodeGenerator::VarOperand(Variable* var, Register scratch) {
616 ASSERT(var->IsContextSlot() || var->IsStackAllocated()); 621 ASSERT(var->IsContextSlot() || var->IsStackAllocated());
617 if (var->IsContextSlot()) { 622 if (var->IsContextSlot()) {
618 int context_chain_length = scope()->ContextChainLength(var->scope()); 623 int context_chain_length = scope()->ContextChainLength(var->scope());
619 __ LoadContext(scratch, context_chain_length); 624 __ LoadContext(scratch, context_chain_length);
(...skipping 3726 matching lines...) Expand 10 before | Expand all | Expand 10 after
4346 *context_length = 0; 4351 *context_length = 0;
4347 return previous_; 4352 return previous_;
4348 } 4353 }
4349 4354
4350 4355
4351 #undef __ 4356 #undef __
4352 4357
4353 } } // namespace v8::internal 4358 } } // namespace v8::internal
4354 4359
4355 #endif // V8_TARGET_ARCH_X64 4360 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/scopes.cc ('k') | test/mjsunit/harmony/debug-blockscopes.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698