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 && | |
1043 scope()->is_function_scope() && | 1042 scope()->is_function_scope() && |
1044 info->num_literals() == 0 && | 1043 info->num_literals() == 0 && |
1045 !info->strict_mode()) { // Strict mode functions use slow path. | 1044 !pretenure) { |
1046 FastNewClosureStub stub; | 1045 FastNewClosureStub stub; |
1047 __ Push(info); | 1046 __ Push(info); |
1048 __ CallStub(&stub); | 1047 __ CallStub(&stub); |
1049 } else { | 1048 } else { |
1050 __ push(rsi); | 1049 __ push(rsi); |
1051 __ Push(info); | 1050 __ Push(info); |
1052 __ Push(pretenure ? Factory::true_value() : Factory::false_value()); | 1051 __ Push(pretenure ? Factory::true_value() : Factory::false_value()); |
1053 __ CallRuntime(Runtime::kNewClosure, 3); | 1052 __ CallRuntime(Runtime::kNewClosure, 3); |
1054 } | 1053 } |
1055 context()->Plug(rax); | 1054 context()->Plug(rax); |
(...skipping 2911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3967 __ ret(0); | 3966 __ ret(0); |
3968 } | 3967 } |
3969 | 3968 |
3970 | 3969 |
3971 #undef __ | 3970 #undef __ |
3972 | 3971 |
3973 | 3972 |
3974 } } // namespace v8::internal | 3973 } } // namespace v8::internal |
3975 | 3974 |
3976 #endif // V8_TARGET_ARCH_X64 | 3975 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |