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

Side by Side Diff: src/ia32/macro-assembler-ia32.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/ia32/code-stubs-ia32.cc ('k') | src/runtime.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 1741 matching lines...) Expand 10 before | Expand all | Expand 10 after
1752 // Load the JavaScript builtin function from the builtins object. 1752 // Load the JavaScript builtin function from the builtins object.
1753 GetBuiltinFunction(edi, id); 1753 GetBuiltinFunction(edi, id);
1754 // Load the code entry point from the function into the target register. 1754 // Load the code entry point from the function into the target register.
1755 mov(target, FieldOperand(edi, JSFunction::kCodeEntryOffset)); 1755 mov(target, FieldOperand(edi, JSFunction::kCodeEntryOffset));
1756 } 1756 }
1757 1757
1758 1758
1759 void MacroAssembler::LoadContext(Register dst, int context_chain_length) { 1759 void MacroAssembler::LoadContext(Register dst, int context_chain_length) {
1760 if (context_chain_length > 0) { 1760 if (context_chain_length > 0) {
1761 // Move up the chain of contexts to the context containing the slot. 1761 // Move up the chain of contexts to the context containing the slot.
1762 mov(dst, Operand(esi, Context::SlotOffset(Context::CLOSURE_INDEX))); 1762 mov(dst, Operand(esi, Context::SlotOffset(Context::PREVIOUS_INDEX)));
1763 // Load the function context (which is the incoming, outer context).
1764 mov(dst, FieldOperand(dst, JSFunction::kContextOffset));
1765 for (int i = 1; i < context_chain_length; i++) { 1763 for (int i = 1; i < context_chain_length; i++) {
1766 mov(dst, Operand(dst, Context::SlotOffset(Context::CLOSURE_INDEX))); 1764 mov(dst, Operand(dst, Context::SlotOffset(Context::PREVIOUS_INDEX)));
1767 mov(dst, FieldOperand(dst, JSFunction::kContextOffset));
1768 } 1765 }
1769 } else { 1766 } else {
1770 // Slot is in the current function context. Move it into the 1767 // Slot is in the current function context. Move it into the
1771 // destination register in case we store into it (the write barrier 1768 // destination register in case we store into it (the write barrier
1772 // cannot be allowed to destroy the context in esi). 1769 // cannot be allowed to destroy the context in esi).
1773 mov(dst, esi); 1770 mov(dst, esi);
1774 } 1771 }
1775 1772
1776 // We should not have found a 'with' context by walking the context chain 1773 // We should not have found a 'with' context by walking the context chain
1777 // (i.e., the static scope chain and runtime context chain do not agree). 1774 // (i.e., the static scope chain and runtime context chain do not agree).
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
2139 2136
2140 // Check that the code was patched as expected. 2137 // Check that the code was patched as expected.
2141 ASSERT(masm_.pc_ == address_ + size_); 2138 ASSERT(masm_.pc_ == address_ + size_);
2142 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); 2139 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap);
2143 } 2140 }
2144 2141
2145 2142
2146 } } // namespace v8::internal 2143 } } // namespace v8::internal
2147 2144
2148 #endif // V8_TARGET_ARCH_IA32 2145 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/code-stubs-ia32.cc ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698