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 4193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4204 ASSERT_EQ(POINTER_SIZE_ALIGN(frame_offset), frame_offset); | 4204 ASSERT_EQ(POINTER_SIZE_ALIGN(frame_offset), frame_offset); |
4205 __ mov(Operand(ebp, frame_offset), value); | 4205 __ mov(Operand(ebp, frame_offset), value); |
4206 } | 4206 } |
4207 | 4207 |
4208 | 4208 |
4209 void FullCodeGenerator::LoadContextField(Register dst, int context_index) { | 4209 void FullCodeGenerator::LoadContextField(Register dst, int context_index) { |
4210 __ mov(dst, ContextOperand(esi, context_index)); | 4210 __ mov(dst, ContextOperand(esi, context_index)); |
4211 } | 4211 } |
4212 | 4212 |
4213 | 4213 |
| 4214 void FullCodeGenerator::PushFunctionArgumentForContextAllocation() { |
| 4215 if (scope()->is_global_scope()) { |
| 4216 // Contexts nested in the global context have a canonical empty function |
| 4217 // as their closure, not the anonymous closure containing the global |
| 4218 // code. Pass a smi sentinel and let the runtime look up the empty |
| 4219 // function. |
| 4220 __ push(Immediate(Smi::FromInt(0))); |
| 4221 } else if (scope()->is_eval_scope()) { |
| 4222 // Contexts created by a call to eval have the same closure as the |
| 4223 // context calling eval, not the anonymous closure containing the eval |
| 4224 // code. Fetch it from the context. |
| 4225 __ push(ContextOperand(esi, Context::CLOSURE_INDEX)); |
| 4226 } else { |
| 4227 ASSERT(scope()->is_function_scope()); |
| 4228 __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
| 4229 } |
| 4230 } |
| 4231 |
| 4232 |
4214 // ---------------------------------------------------------------------------- | 4233 // ---------------------------------------------------------------------------- |
4215 // Non-local control flow support. | 4234 // Non-local control flow support. |
4216 | 4235 |
4217 void FullCodeGenerator::EnterFinallyBlock() { | 4236 void FullCodeGenerator::EnterFinallyBlock() { |
4218 // Cook return address on top of stack (smi encoded Code* delta) | 4237 // Cook return address on top of stack (smi encoded Code* delta) |
4219 ASSERT(!result_register().is(edx)); | 4238 ASSERT(!result_register().is(edx)); |
4220 __ mov(edx, Operand(esp, 0)); | 4239 __ mov(edx, Operand(esp, 0)); |
4221 __ sub(Operand(edx), Immediate(masm_->CodeObject())); | 4240 __ sub(Operand(edx), Immediate(masm_->CodeObject())); |
4222 ASSERT_EQ(1, kSmiTagSize + kSmiShiftSize); | 4241 ASSERT_EQ(1, kSmiTagSize + kSmiShiftSize); |
4223 ASSERT_EQ(0, kSmiTag); | 4242 ASSERT_EQ(0, kSmiTag); |
(...skipping 16 matching lines...) Expand all Loading... |
4240 // And return. | 4259 // And return. |
4241 __ ret(0); | 4260 __ ret(0); |
4242 } | 4261 } |
4243 | 4262 |
4244 | 4263 |
4245 #undef __ | 4264 #undef __ |
4246 | 4265 |
4247 } } // namespace v8::internal | 4266 } } // namespace v8::internal |
4248 | 4267 |
4249 #endif // V8_TARGET_ARCH_IA32 | 4268 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |