OLD | NEW |
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 1748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1759 for (int i = 1; i < context_chain_length; i++) { | 1759 for (int i = 1; i < context_chain_length; i++) { |
1760 mov(dst, Operand(dst, Context::SlotOffset(Context::PREVIOUS_INDEX))); | 1760 mov(dst, Operand(dst, Context::SlotOffset(Context::PREVIOUS_INDEX))); |
1761 } | 1761 } |
1762 } else { | 1762 } else { |
1763 // Slot is in the current function context. Move it into the | 1763 // Slot is in the current function context. Move it into the |
1764 // destination register in case we store into it (the write barrier | 1764 // destination register in case we store into it (the write barrier |
1765 // cannot be allowed to destroy the context in esi). | 1765 // cannot be allowed to destroy the context in esi). |
1766 mov(dst, esi); | 1766 mov(dst, esi); |
1767 } | 1767 } |
1768 | 1768 |
1769 // We should not have found a 'with' context by walking the context chain | 1769 // We should not have found a with or catch context by walking the context |
1770 // (i.e., the static scope chain and runtime context chain do not agree). | 1770 // chain (i.e., the static scope chain and runtime context chain do not |
1771 // A variable occurring in such a scope should have slot type LOOKUP and | 1771 // agree). A variable occurring in such a scope should have slot type |
1772 // not CONTEXT. | 1772 // LOOKUP and not CONTEXT. |
1773 if (emit_debug_code()) { | 1773 if (emit_debug_code()) { |
1774 cmp(dst, Operand(dst, Context::SlotOffset(Context::FCONTEXT_INDEX))); | 1774 cmp(FieldOperand(dst, HeapObject::kMapOffset), |
1775 Check(equal, "Yo dawg, I heard you liked function contexts " | 1775 isolate()->factory()->with_context_map()); |
1776 "so I put function contexts in all your contexts"); | 1776 Check(not_equal, "Variable resolved to with context."); |
| 1777 cmp(FieldOperand(dst, HeapObject::kMapOffset), |
| 1778 isolate()->factory()->with_context_map()); |
| 1779 Check(not_equal, "Variable resolved to catch context."); |
1777 } | 1780 } |
1778 } | 1781 } |
1779 | 1782 |
1780 | 1783 |
1781 void MacroAssembler::LoadGlobalFunction(int index, Register function) { | 1784 void MacroAssembler::LoadGlobalFunction(int index, Register function) { |
1782 // Load the global or builtins object from the current context. | 1785 // Load the global or builtins object from the current context. |
1783 mov(function, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX))); | 1786 mov(function, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX))); |
1784 // Load the global context from the global or builtins object. | 1787 // Load the global context from the global or builtins object. |
1785 mov(function, FieldOperand(function, GlobalObject::kGlobalContextOffset)); | 1788 mov(function, FieldOperand(function, GlobalObject::kGlobalContextOffset)); |
1786 // Load the function from the global context. | 1789 // Load the function from the global context. |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2131 | 2134 |
2132 // Check that the code was patched as expected. | 2135 // Check that the code was patched as expected. |
2133 ASSERT(masm_.pc_ == address_ + size_); | 2136 ASSERT(masm_.pc_ == address_ + size_); |
2134 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 2137 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
2135 } | 2138 } |
2136 | 2139 |
2137 | 2140 |
2138 } } // namespace v8::internal | 2141 } } // namespace v8::internal |
2139 | 2142 |
2140 #endif // V8_TARGET_ARCH_IA32 | 2143 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |