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 #include "src/full-codegen/full-codegen.h" | 5 #include "src/full-codegen/full-codegen.h" |
6 | 6 |
7 #include "src/ast/ast-numbering.h" | 7 #include "src/ast/ast-numbering.h" |
8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
9 #include "src/ast/prettyprinter.h" | 9 #include "src/ast/prettyprinter.h" |
10 #include "src/ast/scopeinfo.h" | 10 #include "src/ast/scopeinfo.h" |
(...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
989 return; | 989 return; |
990 } | 990 } |
991 current = current->Exit(&context_length); | 991 current = current->Exit(&context_length); |
992 } | 992 } |
993 EmitReturnSequence(); | 993 EmitReturnSequence(); |
994 } | 994 } |
995 | 995 |
996 void FullCodeGenerator::EmitNewClosure(Handle<SharedFunctionInfo> info, | 996 void FullCodeGenerator::EmitNewClosure(Handle<SharedFunctionInfo> info, |
997 bool pretenure) { | 997 bool pretenure) { |
998 // Use the fast case closure allocation code that allocates in new | 998 // Use the fast case closure allocation code that allocates in new |
999 // space for nested functions that don't need literals cloning. If | 999 // space for nested functions that don't need literals cloning. If |
Michael Starzinger
2016/05/10 13:47:20
nit: Comment is outdated.
mvstanton
2016/05/24 16:31:49
Done.
| |
1000 // we're running with the --always-opt or the --prepare-always-opt | 1000 // we're running with the --always-opt or the --prepare-always-opt |
1001 // flag, we need to use the runtime function so that the new function | 1001 // flag, we need to use the runtime function so that the new function |
1002 // we are creating here gets a chance to have its code optimized and | 1002 // we are creating here gets a chance to have its code optimized and |
1003 // doesn't just get a copy of the existing unoptimized code. | 1003 // doesn't just get a copy of the existing unoptimized code. |
1004 if (!FLAG_always_opt && | 1004 if (!FLAG_always_opt && !FLAG_prepare_always_opt && !pretenure && |
1005 !FLAG_prepare_always_opt && | 1005 scope()->is_function_scope()) { |
1006 !pretenure && | |
1007 scope()->is_function_scope() && | |
1008 info->num_literals() == 0) { | |
1009 FastNewClosureStub stub(isolate(), info->language_mode(), info->kind()); | 1006 FastNewClosureStub stub(isolate(), info->language_mode(), info->kind()); |
1010 __ Move(stub.GetCallInterfaceDescriptor().GetRegisterParameter(0), info); | 1007 __ Move(stub.GetCallInterfaceDescriptor().GetRegisterParameter(0), info); |
1011 __ CallStub(&stub); | 1008 __ CallStub(&stub); |
1012 } else { | 1009 } else { |
1013 __ Push(info); | 1010 __ Push(info); |
1014 __ CallRuntime(pretenure ? Runtime::kNewClosure_Tenured | 1011 __ CallRuntime(pretenure ? Runtime::kNewClosure_Tenured |
1015 : Runtime::kNewClosure); | 1012 : Runtime::kNewClosure); |
1016 } | 1013 } |
1017 context()->Plug(result_register()); | 1014 context()->Plug(result_register()); |
1018 } | 1015 } |
(...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1939 return var->scope()->is_nonlinear() || | 1936 return var->scope()->is_nonlinear() || |
1940 var->initializer_position() >= proxy->position(); | 1937 var->initializer_position() >= proxy->position(); |
1941 } | 1938 } |
1942 | 1939 |
1943 | 1940 |
1944 #undef __ | 1941 #undef __ |
1945 | 1942 |
1946 | 1943 |
1947 } // namespace internal | 1944 } // namespace internal |
1948 } // namespace v8 | 1945 } // namespace v8 |
OLD | NEW |