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

Side by Side Diff: src/x64/macro-assembler-x64.cc

Issue 7134042: Link function contexts directly to the previous context. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Avoid calling previous on the global context. Created 9 years, 6 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/x64/code-stubs-x64.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 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 3599 matching lines...) Expand 10 before | Expand all | Expand 10 after
3610 j(not_equal, &short_loop); 3610 j(not_equal, &short_loop);
3611 3611
3612 bind(&done); 3612 bind(&done);
3613 } 3613 }
3614 } 3614 }
3615 3615
3616 3616
3617 void MacroAssembler::LoadContext(Register dst, int context_chain_length) { 3617 void MacroAssembler::LoadContext(Register dst, int context_chain_length) {
3618 if (context_chain_length > 0) { 3618 if (context_chain_length > 0) {
3619 // Move up the chain of contexts to the context containing the slot. 3619 // Move up the chain of contexts to the context containing the slot.
3620 movq(dst, Operand(rsi, Context::SlotOffset(Context::CLOSURE_INDEX))); 3620 movq(dst, Operand(rsi, Context::SlotOffset(Context::PREVIOUS_INDEX)));
3621 // Load the function context (which is the incoming, outer context).
3622 movq(dst, FieldOperand(dst, JSFunction::kContextOffset));
3623 for (int i = 1; i < context_chain_length; i++) { 3621 for (int i = 1; i < context_chain_length; i++) {
3624 movq(dst, Operand(dst, Context::SlotOffset(Context::CLOSURE_INDEX))); 3622 movq(dst, Operand(dst, Context::SlotOffset(Context::PREVIOUS_INDEX)));
3625 movq(dst, FieldOperand(dst, JSFunction::kContextOffset));
3626 } 3623 }
3627 // The context may be an intermediate context, not a function context.
3628 movq(dst, Operand(dst, Context::SlotOffset(Context::FCONTEXT_INDEX)));
3629 } else { 3624 } else {
3630 // Slot is in the current function context. Move it into the 3625 // Slot is in the current function context. Move it into the
3631 // destination register in case we store into it (the write barrier 3626 // destination register in case we store into it (the write barrier
3632 // cannot be allowed to destroy the context in rsi). 3627 // cannot be allowed to destroy the context in rsi).
3633 movq(dst, rsi); 3628 movq(dst, rsi);
3634 } 3629 }
3635 3630
3636 // We should not have found a 'with' context by walking the context chain 3631 // We should not have found a 'with' context by walking the context chain
3637 // (i.e., the static scope chain and runtime context chain do not agree). 3632 // (i.e., the static scope chain and runtime context chain do not agree).
3638 // A variable occurring in such a scope should have slot type LOOKUP and 3633 // A variable occurring in such a scope should have slot type LOOKUP and
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
3748 CPU::FlushICache(address_, size_); 3743 CPU::FlushICache(address_, size_);
3749 3744
3750 // Check that the code was patched as expected. 3745 // Check that the code was patched as expected.
3751 ASSERT(masm_.pc_ == address_ + size_); 3746 ASSERT(masm_.pc_ == address_ + size_);
3752 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); 3747 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap);
3753 } 3748 }
3754 3749
3755 } } // namespace v8::internal 3750 } } // namespace v8::internal
3756 3751
3757 #endif // V8_TARGET_ARCH_X64 3752 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/code-stubs-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698