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 999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1010 void FullCodeGenerator::EmitNewClosure(Handle<SharedFunctionInfo> info, | 1010 void FullCodeGenerator::EmitNewClosure(Handle<SharedFunctionInfo> info, |
1011 bool pretenure) { | 1011 bool pretenure) { |
1012 // Use the fast case closure allocation code that allocates in new | 1012 // Use the fast case closure allocation code that allocates in new |
1013 // space for nested functions that don't need literals cloning. If | 1013 // space for nested functions that don't need literals cloning. If |
1014 // we're running with the --always-opt or the --prepare-always-opt | 1014 // we're running with the --always-opt or the --prepare-always-opt |
1015 // flag, we need to use the runtime function so that the new function | 1015 // flag, we need to use the runtime function so that the new function |
1016 // we are creating here gets a chance to have its code optimized and | 1016 // we are creating here gets a chance to have its code optimized and |
1017 // doesn't just get a copy of the existing unoptimized code. | 1017 // doesn't just get a copy of the existing unoptimized code. |
1018 if (!FLAG_always_opt && | 1018 if (!FLAG_always_opt && |
1019 !FLAG_prepare_always_opt && | 1019 !FLAG_prepare_always_opt && |
| 1020 !pretenure && |
1020 scope()->is_function_scope() && | 1021 scope()->is_function_scope() && |
1021 info->num_literals() == 0 && | 1022 info->num_literals() == 0 && |
1022 !pretenure) { | 1023 !info->strict_mode()) { // Strict mode functions go through slow path. |
1023 FastNewClosureStub stub; | 1024 FastNewClosureStub stub; |
1024 __ push(Immediate(info)); | 1025 __ push(Immediate(info)); |
1025 __ CallStub(&stub); | 1026 __ CallStub(&stub); |
1026 } else { | 1027 } else { |
1027 __ push(esi); | 1028 __ push(esi); |
1028 __ push(Immediate(info)); | 1029 __ push(Immediate(info)); |
1029 __ push(Immediate(pretenure | 1030 __ push(Immediate(pretenure |
1030 ? Factory::true_value() | 1031 ? Factory::true_value() |
1031 : Factory::false_value())); | 1032 : Factory::false_value())); |
1032 __ CallRuntime(Runtime::kNewClosure, 3); | 1033 __ CallRuntime(Runtime::kNewClosure, 3); |
(...skipping 3226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4259 // And return. | 4260 // And return. |
4260 __ ret(0); | 4261 __ ret(0); |
4261 } | 4262 } |
4262 | 4263 |
4263 | 4264 |
4264 #undef __ | 4265 #undef __ |
4265 | 4266 |
4266 } } // namespace v8::internal | 4267 } } // namespace v8::internal |
4267 | 4268 |
4268 #endif // V8_TARGET_ARCH_IA32 | 4269 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |