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 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1163 | 1163 |
1164 | 1164 |
1165 void FullCodeGenerator::EmitNewClosure(Handle<SharedFunctionInfo> info, | 1165 void FullCodeGenerator::EmitNewClosure(Handle<SharedFunctionInfo> info, |
1166 bool pretenure) { | 1166 bool pretenure) { |
1167 // Use the fast case closure allocation code that allocates in new | 1167 // Use the fast case closure allocation code that allocates in new |
1168 // space for nested functions that don't need literals cloning. If | 1168 // space for nested functions that don't need literals cloning. If |
1169 // we're running with the --always-opt or the --prepare-always-opt | 1169 // we're running with the --always-opt or the --prepare-always-opt |
1170 // flag, we need to use the runtime function so that the new function | 1170 // flag, we need to use the runtime function so that the new function |
1171 // we are creating here gets a chance to have its code optimized and | 1171 // we are creating here gets a chance to have its code optimized and |
1172 // doesn't just get a copy of the existing unoptimized code. | 1172 // doesn't just get a copy of the existing unoptimized code. |
1173 if (!FLAG_always_opt && !FLAG_prepare_always_opt && !pretenure && | 1173 if (!FLAG_always_opt && |
1174 scope()->is_function_scope()) { | 1174 !FLAG_prepare_always_opt && |
| 1175 !pretenure && |
| 1176 scope()->is_function_scope() && |
| 1177 info->num_literals() == 0) { |
1175 FastNewClosureStub stub(isolate(), info->language_mode(), info->kind()); | 1178 FastNewClosureStub stub(isolate(), info->language_mode(), info->kind()); |
1176 __ Move(rbx, info); | 1179 __ Move(rbx, info); |
1177 __ CallStub(&stub); | 1180 __ CallStub(&stub); |
1178 } else { | 1181 } else { |
1179 __ Push(info); | 1182 __ Push(info); |
1180 __ CallRuntime(pretenure ? Runtime::kNewClosure_Tenured | 1183 __ CallRuntime(pretenure ? Runtime::kNewClosure_Tenured |
1181 : Runtime::kNewClosure); | 1184 : Runtime::kNewClosure); |
1182 } | 1185 } |
1183 context()->Plug(rax); | 1186 context()->Plug(rax); |
1184 } | 1187 } |
(...skipping 3525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4710 Assembler::target_address_at(call_target_address, | 4713 Assembler::target_address_at(call_target_address, |
4711 unoptimized_code)); | 4714 unoptimized_code)); |
4712 return OSR_AFTER_STACK_CHECK; | 4715 return OSR_AFTER_STACK_CHECK; |
4713 } | 4716 } |
4714 | 4717 |
4715 | 4718 |
4716 } // namespace internal | 4719 } // namespace internal |
4717 } // namespace v8 | 4720 } // namespace v8 |
4718 | 4721 |
4719 #endif // V8_TARGET_ARCH_X64 | 4722 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |