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/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1158 | 1158 |
1159 | 1159 |
1160 void FullCodeGenerator::EmitNewClosure(Handle<SharedFunctionInfo> info, | 1160 void FullCodeGenerator::EmitNewClosure(Handle<SharedFunctionInfo> info, |
1161 bool pretenure) { | 1161 bool pretenure) { |
1162 // Use the fast case closure allocation code that allocates in new | 1162 // Use the fast case closure allocation code that allocates in new |
1163 // space for nested functions that don't need literals cloning. If | 1163 // space for nested functions that don't need literals cloning. If |
1164 // we're running with the --always-opt or the --prepare-always-opt | 1164 // we're running with the --always-opt or the --prepare-always-opt |
1165 // flag, we need to use the runtime function so that the new function | 1165 // flag, we need to use the runtime function so that the new function |
1166 // we are creating here gets a chance to have its code optimized and | 1166 // we are creating here gets a chance to have its code optimized and |
1167 // doesn't just get a copy of the existing unoptimized code. | 1167 // doesn't just get a copy of the existing unoptimized code. |
1168 if (!FLAG_always_opt && | 1168 if (!FLAG_always_opt && !FLAG_prepare_always_opt && !pretenure && |
1169 !FLAG_prepare_always_opt && | 1169 scope()->is_function_scope()) { |
1170 !pretenure && | |
1171 scope()->is_function_scope() && | |
1172 info->num_literals() == 0) { | |
1173 FastNewClosureStub stub(isolate(), info->language_mode(), info->kind()); | 1170 FastNewClosureStub stub(isolate(), info->language_mode(), info->kind()); |
1174 __ Move(rbx, info); | 1171 __ Move(rbx, info); |
1175 __ CallStub(&stub); | 1172 __ CallStub(&stub); |
1176 } else { | 1173 } else { |
1177 __ Push(info); | 1174 __ Push(info); |
1178 __ CallRuntime(pretenure ? Runtime::kNewClosure_Tenured | 1175 __ CallRuntime(pretenure ? Runtime::kNewClosure_Tenured |
1179 : Runtime::kNewClosure); | 1176 : Runtime::kNewClosure); |
1180 } | 1177 } |
1181 context()->Plug(rax); | 1178 context()->Plug(rax); |
1182 } | 1179 } |
(...skipping 3568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4751 Assembler::target_address_at(call_target_address, | 4748 Assembler::target_address_at(call_target_address, |
4752 unoptimized_code)); | 4749 unoptimized_code)); |
4753 return OSR_AFTER_STACK_CHECK; | 4750 return OSR_AFTER_STACK_CHECK; |
4754 } | 4751 } |
4755 | 4752 |
4756 | 4753 |
4757 } // namespace internal | 4754 } // namespace internal |
4758 } // namespace v8 | 4755 } // namespace v8 |
4759 | 4756 |
4760 #endif // V8_TARGET_ARCH_X64 | 4757 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |