OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1021 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1032 void FullCodeGenerator::EmitNewClosure(Handle<SharedFunctionInfo> info, | 1032 void FullCodeGenerator::EmitNewClosure(Handle<SharedFunctionInfo> info, |
1033 bool pretenure) { | 1033 bool pretenure) { |
1034 // Use the fast case closure allocation code that allocates in new | 1034 // Use the fast case closure allocation code that allocates in new |
1035 // space for nested functions that don't need literals cloning. If | 1035 // space for nested functions that don't need literals cloning. If |
1036 // we're running with the --always-opt or the --prepare-always-opt | 1036 // we're running with the --always-opt or the --prepare-always-opt |
1037 // flag, we need to use the runtime function so that the new function | 1037 // flag, we need to use the runtime function so that the new function |
1038 // we are creating here gets a chance to have its code optimized and | 1038 // we are creating here gets a chance to have its code optimized and |
1039 // doesn't just get a copy of the existing unoptimized code. | 1039 // doesn't just get a copy of the existing unoptimized code. |
1040 if (!FLAG_always_opt && | 1040 if (!FLAG_always_opt && |
1041 !FLAG_prepare_always_opt && | 1041 !FLAG_prepare_always_opt && |
| 1042 !pretenure && |
1042 scope()->is_function_scope() && | 1043 scope()->is_function_scope() && |
1043 info->num_literals() == 0 && | 1044 info->num_literals() == 0 && |
1044 !pretenure) { | 1045 !info->strict_mode()) { // Strict mode functions use slow path. |
1045 FastNewClosureStub stub; | 1046 FastNewClosureStub stub; |
1046 __ Push(info); | 1047 __ Push(info); |
1047 __ CallStub(&stub); | 1048 __ CallStub(&stub); |
1048 } else { | 1049 } else { |
1049 __ push(rsi); | 1050 __ push(rsi); |
1050 __ Push(info); | 1051 __ Push(info); |
1051 __ Push(pretenure ? Factory::true_value() : Factory::false_value()); | 1052 __ Push(pretenure ? Factory::true_value() : Factory::false_value()); |
1052 __ CallRuntime(Runtime::kNewClosure, 3); | 1053 __ CallRuntime(Runtime::kNewClosure, 3); |
1053 } | 1054 } |
1054 context()->Plug(rax); | 1055 context()->Plug(rax); |
(...skipping 2911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3966 __ ret(0); | 3967 __ ret(0); |
3967 } | 3968 } |
3968 | 3969 |
3969 | 3970 |
3970 #undef __ | 3971 #undef __ |
3971 | 3972 |
3972 | 3973 |
3973 } } // namespace v8::internal | 3974 } } // namespace v8::internal |
3974 | 3975 |
3975 #endif // V8_TARGET_ARCH_X64 | 3976 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |