| 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 4242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4253 void CodeGenerator::InstantiateFunction( | 4253 void CodeGenerator::InstantiateFunction( |
| 4254 Handle<SharedFunctionInfo> function_info, | 4254 Handle<SharedFunctionInfo> function_info, |
| 4255 bool pretenure) { | 4255 bool pretenure) { |
| 4256 // The inevitable call will sync frame elements to memory anyway, so | 4256 // The inevitable call will sync frame elements to memory anyway, so |
| 4257 // we do it eagerly to allow us to push the arguments directly into | 4257 // we do it eagerly to allow us to push the arguments directly into |
| 4258 // place. | 4258 // place. |
| 4259 frame_->SyncRange(0, frame_->element_count() - 1); | 4259 frame_->SyncRange(0, frame_->element_count() - 1); |
| 4260 | 4260 |
| 4261 // Use the fast case closure allocation code that allocates in new | 4261 // Use the fast case closure allocation code that allocates in new |
| 4262 // space for nested functions that don't need literals cloning. | 4262 // space for nested functions that don't need literals cloning. |
| 4263 if (scope()->is_function_scope() && | 4263 if (!pretenure && |
| 4264 scope()->is_function_scope() && |
| 4264 function_info->num_literals() == 0 && | 4265 function_info->num_literals() == 0 && |
| 4265 !pretenure) { | 4266 !function_info->strict_mode()) { // Strict mode functions use slow path. |
| 4266 FastNewClosureStub stub; | 4267 FastNewClosureStub stub; |
| 4267 frame_->Push(function_info); | 4268 frame_->Push(function_info); |
| 4268 Result answer = frame_->CallStub(&stub, 1); | 4269 Result answer = frame_->CallStub(&stub, 1); |
| 4269 frame_->Push(&answer); | 4270 frame_->Push(&answer); |
| 4270 } else { | 4271 } else { |
| 4271 // Call the runtime to instantiate the function based on the | 4272 // Call the runtime to instantiate the function based on the |
| 4272 // shared function info. | 4273 // shared function info. |
| 4273 frame_->EmitPush(rsi); | 4274 frame_->EmitPush(rsi); |
| 4274 frame_->EmitPush(function_info); | 4275 frame_->EmitPush(function_info); |
| 4275 frame_->EmitPush(pretenure | 4276 frame_->EmitPush(pretenure |
| (...skipping 4559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8835 } | 8836 } |
| 8836 | 8837 |
| 8837 #endif | 8838 #endif |
| 8838 | 8839 |
| 8839 | 8840 |
| 8840 #undef __ | 8841 #undef __ |
| 8841 | 8842 |
| 8842 } } // namespace v8::internal | 8843 } } // namespace v8::internal |
| 8843 | 8844 |
| 8844 #endif // V8_TARGET_ARCH_X64 | 8845 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |