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 4101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4112 ASSERT(IsAligned(frame_offset, kPointerSize)); | 4112 ASSERT(IsAligned(frame_offset, kPointerSize)); |
4113 __ movq(Operand(rbp, frame_offset), value); | 4113 __ movq(Operand(rbp, frame_offset), value); |
4114 } | 4114 } |
4115 | 4115 |
4116 | 4116 |
4117 void FullCodeGenerator::LoadContextField(Register dst, int context_index) { | 4117 void FullCodeGenerator::LoadContextField(Register dst, int context_index) { |
4118 __ movq(dst, ContextOperand(rsi, context_index)); | 4118 __ movq(dst, ContextOperand(rsi, context_index)); |
4119 } | 4119 } |
4120 | 4120 |
4121 | 4121 |
4122 void FullCodeGenerator::PushFunctionArgumentForContextAllocation() { | 4122 void FullCodeGenerator::PushFunctionArgumentForContextAllocation( |
| 4123 Register scratch) { |
4123 Scope* declaration_scope = scope()->DeclarationScope(); | 4124 Scope* declaration_scope = scope()->DeclarationScope(); |
4124 if (declaration_scope->is_global_scope()) { | 4125 if (declaration_scope->is_global_scope()) { |
4125 // Contexts nested in the global context have a canonical empty function | 4126 // Contexts nested in the global context have a canonical empty function |
4126 // as their closure, not the anonymous closure containing the global | 4127 // as their closure, not the anonymous closure containing the global |
4127 // code. Pass a smi sentinel and let the runtime look up the empty | 4128 // code. |
4128 // function. | 4129 __ movq(scratch, GlobalObjectOperand()); |
4129 __ Push(Smi::FromInt(0)); | 4130 __ movq(scratch, FieldOperand(scratch, GlobalObject::kGlobalContextOffset)); |
| 4131 __ push(ContextOperand(scratch, Context::CLOSURE_INDEX)); |
4130 } else if (declaration_scope->is_eval_scope()) { | 4132 } else if (declaration_scope->is_eval_scope()) { |
4131 // Contexts created by a call to eval have the same closure as the | 4133 // Contexts created by a call to eval have the same closure as the |
4132 // context calling eval, not the anonymous closure containing the eval | 4134 // context calling eval, not the anonymous closure containing the eval |
4133 // code. Fetch it from the context. | 4135 // code. Fetch it from the context. |
4134 __ push(ContextOperand(rsi, Context::CLOSURE_INDEX)); | 4136 __ push(ContextOperand(rsi, Context::CLOSURE_INDEX)); |
4135 } else { | 4137 } else { |
4136 ASSERT(declaration_scope->is_function_scope()); | 4138 ASSERT(declaration_scope->is_function_scope()); |
4137 __ push(Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); | 4139 __ push(Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); |
4138 } | 4140 } |
4139 } | 4141 } |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4196 *context_length = 0; | 4198 *context_length = 0; |
4197 return previous_; | 4199 return previous_; |
4198 } | 4200 } |
4199 | 4201 |
4200 | 4202 |
4201 #undef __ | 4203 #undef __ |
4202 | 4204 |
4203 } } // namespace v8::internal | 4205 } } // namespace v8::internal |
4204 | 4206 |
4205 #endif // V8_TARGET_ARCH_X64 | 4207 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |