OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
6 | 6 |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/debug/debug.h" | 10 #include "src/debug/debug.h" |
(...skipping 4713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4724 __ movp(dst, ContextOperand(rsi, context_index)); | 4724 __ movp(dst, ContextOperand(rsi, context_index)); |
4725 } | 4725 } |
4726 | 4726 |
4727 | 4727 |
4728 void FullCodeGenerator::PushFunctionArgumentForContextAllocation() { | 4728 void FullCodeGenerator::PushFunctionArgumentForContextAllocation() { |
4729 Scope* closure_scope = scope()->ClosureScope(); | 4729 Scope* closure_scope = scope()->ClosureScope(); |
4730 if (closure_scope->is_script_scope() || | 4730 if (closure_scope->is_script_scope() || |
4731 closure_scope->is_module_scope()) { | 4731 closure_scope->is_module_scope()) { |
4732 // Contexts nested in the native context have a canonical empty function | 4732 // Contexts nested in the native context have a canonical empty function |
4733 // as their closure, not the anonymous closure containing the global | 4733 // as their closure, not the anonymous closure containing the global |
4734 // code. Pass a smi sentinel and let the runtime look up the empty | 4734 // code. |
4735 // function. | 4735 __ movp(rax, GlobalObjectOperand()); |
4736 __ Push(Smi::FromInt(0)); | 4736 __ movp(rax, FieldOperand(rax, JSGlobalObject::kNativeContextOffset)); |
| 4737 __ Push(ContextOperand(rax, Context::CLOSURE_INDEX)); |
4737 } else if (closure_scope->is_eval_scope()) { | 4738 } else if (closure_scope->is_eval_scope()) { |
4738 // Contexts created by a call to eval have the same closure as the | 4739 // Contexts created by a call to eval have the same closure as the |
4739 // context calling eval, not the anonymous closure containing the eval | 4740 // context calling eval, not the anonymous closure containing the eval |
4740 // code. Fetch it from the context. | 4741 // code. Fetch it from the context. |
4741 __ Push(ContextOperand(rsi, Context::CLOSURE_INDEX)); | 4742 __ Push(ContextOperand(rsi, Context::CLOSURE_INDEX)); |
4742 } else { | 4743 } else { |
4743 DCHECK(closure_scope->is_function_scope()); | 4744 DCHECK(closure_scope->is_function_scope()); |
4744 __ Push(Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); | 4745 __ Push(Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); |
4745 } | 4746 } |
4746 } | 4747 } |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4886 Assembler::target_address_at(call_target_address, | 4887 Assembler::target_address_at(call_target_address, |
4887 unoptimized_code)); | 4888 unoptimized_code)); |
4888 return OSR_AFTER_STACK_CHECK; | 4889 return OSR_AFTER_STACK_CHECK; |
4889 } | 4890 } |
4890 | 4891 |
4891 | 4892 |
4892 } // namespace internal | 4893 } // namespace internal |
4893 } // namespace v8 | 4894 } // namespace v8 |
4894 | 4895 |
4895 #endif // V8_TARGET_ARCH_X64 | 4896 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |