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 4251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4262 ASSERT_EQ(POINTER_SIZE_ALIGN(frame_offset), frame_offset); | 4262 ASSERT_EQ(POINTER_SIZE_ALIGN(frame_offset), frame_offset); |
4263 __ mov(Operand(ebp, frame_offset), value); | 4263 __ mov(Operand(ebp, frame_offset), value); |
4264 } | 4264 } |
4265 | 4265 |
4266 | 4266 |
4267 void FullCodeGenerator::LoadContextField(Register dst, int context_index) { | 4267 void FullCodeGenerator::LoadContextField(Register dst, int context_index) { |
4268 __ mov(dst, ContextOperand(esi, context_index)); | 4268 __ mov(dst, ContextOperand(esi, context_index)); |
4269 } | 4269 } |
4270 | 4270 |
4271 | 4271 |
4272 void FullCodeGenerator::PushFunctionArgumentForContextAllocation() { | 4272 void FullCodeGenerator::PushFunctionArgumentForContextAllocation( |
| 4273 Register scratch) { |
4273 Scope* declaration_scope = scope()->DeclarationScope(); | 4274 Scope* declaration_scope = scope()->DeclarationScope(); |
4274 if (declaration_scope->is_global_scope()) { | 4275 if (declaration_scope->is_global_scope()) { |
4275 // Contexts nested in the global context have a canonical empty function | 4276 // Contexts nested in the global context have a canonical empty function |
4276 // as their closure, not the anonymous closure containing the global | 4277 // as their closure, not the anonymous closure containing the global |
4277 // code. Pass a smi sentinel and let the runtime look up the empty | 4278 // code. |
4278 // function. | 4279 __ mov(scratch, GlobalObjectOperand()); |
4279 __ push(Immediate(Smi::FromInt(0))); | 4280 __ mov(scratch, FieldOperand(scratch, GlobalObject::kGlobalContextOffset)); |
| 4281 __ push(ContextOperand(scratch, Context::CLOSURE_INDEX)); |
4280 } else if (declaration_scope->is_eval_scope()) { | 4282 } else if (declaration_scope->is_eval_scope()) { |
4281 // Contexts nested inside eval code have the same closure as the context | 4283 // Contexts nested inside eval code have the same closure as the context |
4282 // calling eval, not the anonymous closure containing the eval code. | 4284 // calling eval, not the anonymous closure containing the eval code. |
4283 // Fetch it from the context. | 4285 // Fetch it from the context. |
4284 __ push(ContextOperand(esi, Context::CLOSURE_INDEX)); | 4286 __ push(ContextOperand(esi, Context::CLOSURE_INDEX)); |
4285 } else { | 4287 } else { |
4286 ASSERT(declaration_scope->is_function_scope()); | 4288 ASSERT(declaration_scope->is_function_scope()); |
4287 __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | 4289 __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
4288 } | 4290 } |
4289 } | 4291 } |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4343 *context_length = 0; | 4345 *context_length = 0; |
4344 return previous_; | 4346 return previous_; |
4345 } | 4347 } |
4346 | 4348 |
4347 | 4349 |
4348 #undef __ | 4350 #undef __ |
4349 | 4351 |
4350 } } // namespace v8::internal | 4352 } } // namespace v8::internal |
4351 | 4353 |
4352 #endif // V8_TARGET_ARCH_IA32 | 4354 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |