| 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 Result answer = frame_->CallStub(&stub, 3); | 147 Result answer = frame_->CallStub(&stub, 3); |
| 148 frame_->Push(&answer); | 148 frame_->Push(&answer); |
| 149 } | 149 } |
| 150 | 150 |
| 151 if (scope_->num_heap_slots() > 0) { | 151 if (scope_->num_heap_slots() > 0) { |
| 152 Comment cmnt(masm_, "[ allocate local context"); | 152 Comment cmnt(masm_, "[ allocate local context"); |
| 153 // Allocate local context. | 153 // Allocate local context. |
| 154 // Get outer context and create a new context based on it. | 154 // Get outer context and create a new context based on it. |
| 155 frame_->PushFunction(); | 155 frame_->PushFunction(); |
| 156 Result context = frame_->CallRuntime(Runtime::kNewContext, 1); | 156 Result context = frame_->CallRuntime(Runtime::kNewContext, 1); |
| 157 |
| 157 // Update context local. | 158 // Update context local. |
| 158 frame_->SaveContextRegister(); | 159 frame_->SaveContextRegister(); |
| 159 | 160 |
| 160 if (kDebug) { | 161 // Verify that the runtime call result and esi agree. |
| 161 JumpTarget verified_true(this); | 162 if (FLAG_debug_code) { |
| 162 // Verify eax and esi are the same in debug mode | |
| 163 __ cmp(context.reg(), Operand(esi)); | 163 __ cmp(context.reg(), Operand(esi)); |
| 164 context.Unuse(); | 164 __ Assert(equal, "Runtime::NewContext should end up in esi"); |
| 165 verified_true.Branch(equal); | |
| 166 frame_->SpillAll(); | |
| 167 __ int3(); | |
| 168 verified_true.Bind(); | |
| 169 } | 165 } |
| 170 } | 166 } |
| 171 | 167 |
| 172 // TODO(1241774): Improve this code: | 168 // TODO(1241774): Improve this code: |
| 173 // 1) only needed if we have a context | 169 // 1) only needed if we have a context |
| 174 // 2) no need to recompute context ptr every single time | 170 // 2) no need to recompute context ptr every single time |
| 175 // 3) don't copy parameter operand code from SlotOperand! | 171 // 3) don't copy parameter operand code from SlotOperand! |
| 176 { | 172 { |
| 177 Comment cmnt2(masm_, "[ copy context parameters into .context"); | 173 Comment cmnt2(masm_, "[ copy context parameters into .context"); |
| 178 | 174 |
| (...skipping 1684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1863 Result context(this); | 1859 Result context(this); |
| 1864 if (node->is_catch_block()) { | 1860 if (node->is_catch_block()) { |
| 1865 context = frame_->CallRuntime(Runtime::kPushCatchContext, 1); | 1861 context = frame_->CallRuntime(Runtime::kPushCatchContext, 1); |
| 1866 } else { | 1862 } else { |
| 1867 context = frame_->CallRuntime(Runtime::kPushContext, 1); | 1863 context = frame_->CallRuntime(Runtime::kPushContext, 1); |
| 1868 } | 1864 } |
| 1869 | 1865 |
| 1870 // Update context local. | 1866 // Update context local. |
| 1871 frame_->SaveContextRegister(); | 1867 frame_->SaveContextRegister(); |
| 1872 | 1868 |
| 1873 if (kDebug) { | 1869 // Verify that the runtime call result and esi agree. |
| 1874 JumpTarget verified_true(this); | 1870 if (FLAG_debug_code) { |
| 1875 // Verify that the result of the runtime call and the esi register are | |
| 1876 // the same in debug mode. | |
| 1877 __ cmp(context.reg(), Operand(esi)); | 1871 __ cmp(context.reg(), Operand(esi)); |
| 1878 context.Unuse(); | 1872 __ Assert(equal, "Runtime::NewContext should end up in esi"); |
| 1879 verified_true.Branch(equal); | |
| 1880 frame_->SpillAll(); | |
| 1881 __ int3(); | |
| 1882 verified_true.Bind(); | |
| 1883 } | 1873 } |
| 1884 } | 1874 } |
| 1885 | 1875 |
| 1886 | 1876 |
| 1887 void CodeGenerator::VisitWithExitStatement(WithExitStatement* node) { | 1877 void CodeGenerator::VisitWithExitStatement(WithExitStatement* node) { |
| 1888 ASSERT(!in_spilled_code()); | 1878 ASSERT(!in_spilled_code()); |
| 1889 Comment cmnt(masm_, "[ WithExitStatement"); | 1879 Comment cmnt(masm_, "[ WithExitStatement"); |
| 1890 CodeForStatementPosition(node); | 1880 CodeForStatementPosition(node); |
| 1891 // Pop context. | 1881 // Pop context. |
| 1892 __ mov(esi, ContextOperand(esi, Context::PREVIOUS_INDEX)); | 1882 __ mov(esi, ContextOperand(esi, Context::PREVIOUS_INDEX)); |
| (...skipping 4930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6823 | 6813 |
| 6824 // Slow-case: Go through the JavaScript implementation. | 6814 // Slow-case: Go through the JavaScript implementation. |
| 6825 __ bind(&slow); | 6815 __ bind(&slow); |
| 6826 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); | 6816 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); |
| 6827 } | 6817 } |
| 6828 | 6818 |
| 6829 | 6819 |
| 6830 #undef __ | 6820 #undef __ |
| 6831 | 6821 |
| 6832 } } // namespace v8::internal | 6822 } } // namespace v8::internal |
| OLD | NEW |