| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 Result answer = frame_->CallStub(&stub, 3); | 183 Result answer = frame_->CallStub(&stub, 3); |
| 184 frame_->Push(&answer); | 184 frame_->Push(&answer); |
| 185 } | 185 } |
| 186 | 186 |
| 187 if (scope_->num_heap_slots() > 0) { | 187 if (scope_->num_heap_slots() > 0) { |
| 188 Comment cmnt(masm_, "[ allocate local context"); | 188 Comment cmnt(masm_, "[ allocate local context"); |
| 189 // Allocate local context. | 189 // Allocate local context. |
| 190 // Get outer context and create a new context based on it. | 190 // Get outer context and create a new context based on it. |
| 191 frame_->PushFunction(); | 191 frame_->PushFunction(); |
| 192 Result context = frame_->CallRuntime(Runtime::kNewContext, 1); | 192 Result context = frame_->CallRuntime(Runtime::kNewContext, 1); |
| 193 // Update context local. |
| 194 frame_->SaveContextRegister(); |
| 193 | 195 |
| 194 if (kDebug) { | 196 if (kDebug) { |
| 195 JumpTarget verified_true(this); | 197 JumpTarget verified_true(this); |
| 196 // Verify eax and esi are the same in debug mode | 198 // Verify eax and esi are the same in debug mode |
| 197 __ cmp(context.reg(), Operand(esi)); | 199 __ cmp(context.reg(), Operand(esi)); |
| 198 context.Unuse(); | 200 context.Unuse(); |
| 199 verified_true.Branch(equal); | 201 verified_true.Branch(equal); |
| 200 frame_->SpillAll(); | 202 frame_->SpillAll(); |
| 201 __ int3(); | 203 __ int3(); |
| 202 verified_true.Bind(); | 204 verified_true.Bind(); |
| 203 } | 205 } |
| 204 // Update context local. | |
| 205 frame_->SaveContextRegister(); | |
| 206 } | 206 } |
| 207 | 207 |
| 208 // TODO(1241774): Improve this code: | 208 // TODO(1241774): Improve this code: |
| 209 // 1) only needed if we have a context | 209 // 1) only needed if we have a context |
| 210 // 2) no need to recompute context ptr every single time | 210 // 2) no need to recompute context ptr every single time |
| 211 // 3) don't copy parameter operand code from SlotOperand! | 211 // 3) don't copy parameter operand code from SlotOperand! |
| 212 { | 212 { |
| 213 Comment cmnt2(masm_, "[ copy context parameters into .context"); | 213 Comment cmnt2(masm_, "[ copy context parameters into .context"); |
| 214 | 214 |
| 215 // Note that iteration order is relevant here! If we have the same | 215 // Note that iteration order is relevant here! If we have the same |
| (...skipping 1549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1765 Comment cmnt(masm_, "[ WithEnterStatement"); | 1765 Comment cmnt(masm_, "[ WithEnterStatement"); |
| 1766 CodeForStatementPosition(node); | 1766 CodeForStatementPosition(node); |
| 1767 Load(node->expression()); | 1767 Load(node->expression()); |
| 1768 Result context(this); | 1768 Result context(this); |
| 1769 if (node->is_catch_block()) { | 1769 if (node->is_catch_block()) { |
| 1770 context = frame_->CallRuntime(Runtime::kPushCatchContext, 1); | 1770 context = frame_->CallRuntime(Runtime::kPushCatchContext, 1); |
| 1771 } else { | 1771 } else { |
| 1772 context = frame_->CallRuntime(Runtime::kPushContext, 1); | 1772 context = frame_->CallRuntime(Runtime::kPushContext, 1); |
| 1773 } | 1773 } |
| 1774 | 1774 |
| 1775 // Update context local. |
| 1776 frame_->SaveContextRegister(); |
| 1777 |
| 1775 if (kDebug) { | 1778 if (kDebug) { |
| 1776 JumpTarget verified_true(this); | 1779 JumpTarget verified_true(this); |
| 1777 // Verify that the result of the runtime call and the esi register are | 1780 // Verify that the result of the runtime call and the esi register are |
| 1778 // the same in debug mode. | 1781 // the same in debug mode. |
| 1779 __ cmp(context.reg(), Operand(esi)); | 1782 __ cmp(context.reg(), Operand(esi)); |
| 1780 context.Unuse(); | 1783 context.Unuse(); |
| 1781 verified_true.Branch(equal); | 1784 verified_true.Branch(equal); |
| 1782 frame_->SpillAll(); | 1785 frame_->SpillAll(); |
| 1783 __ int3(); | 1786 __ int3(); |
| 1784 verified_true.Bind(); | 1787 verified_true.Bind(); |
| 1785 } | 1788 } |
| 1786 | |
| 1787 // Update context local. | |
| 1788 frame_->SaveContextRegister(); | |
| 1789 } | 1789 } |
| 1790 | 1790 |
| 1791 | 1791 |
| 1792 void CodeGenerator::VisitWithExitStatement(WithExitStatement* node) { | 1792 void CodeGenerator::VisitWithExitStatement(WithExitStatement* node) { |
| 1793 ASSERT(!in_spilled_code()); | 1793 ASSERT(!in_spilled_code()); |
| 1794 Comment cmnt(masm_, "[ WithExitStatement"); | 1794 Comment cmnt(masm_, "[ WithExitStatement"); |
| 1795 CodeForStatementPosition(node); | 1795 CodeForStatementPosition(node); |
| 1796 // Pop context. | 1796 // Pop context. |
| 1797 __ mov(esi, ContextOperand(esi, Context::PREVIOUS_INDEX)); | 1797 __ mov(esi, ContextOperand(esi, Context::PREVIOUS_INDEX)); |
| 1798 // Update context local. | 1798 // Update context local. |
| (...skipping 4551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6350 | 6350 |
| 6351 // Slow-case: Go through the JavaScript implementation. | 6351 // Slow-case: Go through the JavaScript implementation. |
| 6352 __ bind(&slow); | 6352 __ bind(&slow); |
| 6353 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); | 6353 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); |
| 6354 } | 6354 } |
| 6355 | 6355 |
| 6356 | 6356 |
| 6357 #undef __ | 6357 #undef __ |
| 6358 | 6358 |
| 6359 } } // namespace v8::internal | 6359 } } // namespace v8::internal |
| OLD | NEW |