| 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 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1025 current->AsTryFinally()->deferred_commands()->RecordReturn(); | 1025 current->AsTryFinally()->deferred_commands()->RecordReturn(); |
| 1026 return; | 1026 return; |
| 1027 } | 1027 } |
| 1028 current = current->Exit(&context_length); | 1028 current = current->Exit(&context_length); |
| 1029 } | 1029 } |
| 1030 EmitReturnSequence(); | 1030 EmitReturnSequence(); |
| 1031 } | 1031 } |
| 1032 | 1032 |
| 1033 void FullCodeGenerator::EmitNewClosure(Handle<SharedFunctionInfo> info, | 1033 void FullCodeGenerator::EmitNewClosure(Handle<SharedFunctionInfo> info, |
| 1034 bool pretenure) { | 1034 bool pretenure) { |
| 1035 // Use the fast case closure allocation code that allocates in new | 1035 // If we're running with the --always-opt or the --prepare-always-opt |
| 1036 // space for nested functions that don't need literals cloning. If | |
| 1037 // we're running with the --always-opt or the --prepare-always-opt | |
| 1038 // flag, we need to use the runtime function so that the new function | 1036 // flag, we need to use the runtime function so that the new function |
| 1039 // we are creating here gets a chance to have its code optimized and | 1037 // we are creating here gets a chance to have its code optimized and |
| 1040 // doesn't just get a copy of the existing unoptimized code. | 1038 // doesn't just get a copy of the existing unoptimized code. |
| 1041 if (!FLAG_always_opt && | 1039 if (!FLAG_always_opt && !FLAG_prepare_always_opt && !pretenure && |
| 1042 !FLAG_prepare_always_opt && | 1040 scope()->is_function_scope()) { |
| 1043 !pretenure && | |
| 1044 scope()->is_function_scope() && | |
| 1045 info->num_literals() == 0) { | |
| 1046 FastNewClosureStub stub(isolate(), info->language_mode(), info->kind()); | 1041 FastNewClosureStub stub(isolate(), info->language_mode(), info->kind()); |
| 1047 __ Move(stub.GetCallInterfaceDescriptor().GetRegisterParameter(0), info); | 1042 __ Move(stub.GetCallInterfaceDescriptor().GetRegisterParameter(0), info); |
| 1048 __ CallStub(&stub); | 1043 __ CallStub(&stub); |
| 1049 } else { | 1044 } else { |
| 1050 __ Push(info); | 1045 __ Push(info); |
| 1051 __ CallRuntime(pretenure ? Runtime::kNewClosure_Tenured | 1046 __ CallRuntime(pretenure ? Runtime::kNewClosure_Tenured |
| 1052 : Runtime::kNewClosure); | 1047 : Runtime::kNewClosure); |
| 1053 } | 1048 } |
| 1054 context()->Plug(result_register()); | 1049 context()->Plug(result_register()); |
| 1055 } | 1050 } |
| (...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1978 return var->scope()->is_nonlinear() || | 1973 return var->scope()->is_nonlinear() || |
| 1979 var->initializer_position() >= proxy->position(); | 1974 var->initializer_position() >= proxy->position(); |
| 1980 } | 1975 } |
| 1981 | 1976 |
| 1982 | 1977 |
| 1983 #undef __ | 1978 #undef __ |
| 1984 | 1979 |
| 1985 | 1980 |
| 1986 } // namespace internal | 1981 } // namespace internal |
| 1987 } // namespace v8 | 1982 } // namespace v8 |
| OLD | NEW |