OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 4898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4909 Result CodeGenerator::InstantiateFunction( | 4909 Result CodeGenerator::InstantiateFunction( |
4910 Handle<SharedFunctionInfo> function_info, | 4910 Handle<SharedFunctionInfo> function_info, |
4911 bool pretenure) { | 4911 bool pretenure) { |
4912 // The inevitable call will sync frame elements to memory anyway, so | 4912 // The inevitable call will sync frame elements to memory anyway, so |
4913 // we do it eagerly to allow us to push the arguments directly into | 4913 // we do it eagerly to allow us to push the arguments directly into |
4914 // place. | 4914 // place. |
4915 frame()->SyncRange(0, frame()->element_count() - 1); | 4915 frame()->SyncRange(0, frame()->element_count() - 1); |
4916 | 4916 |
4917 // Use the fast case closure allocation code that allocates in new | 4917 // Use the fast case closure allocation code that allocates in new |
4918 // space for nested functions that don't need literals cloning. | 4918 // space for nested functions that don't need literals cloning. |
4919 if (scope()->is_function_scope() && | 4919 if (!pretenure && |
| 4920 scope()->is_function_scope() && |
4920 function_info->num_literals() == 0 && | 4921 function_info->num_literals() == 0 && |
4921 !pretenure) { | 4922 !function_info->strict_mode()) { // Strict mode functions use slow path. |
4922 FastNewClosureStub stub; | 4923 FastNewClosureStub stub; |
4923 frame()->EmitPush(Immediate(function_info)); | 4924 frame()->EmitPush(Immediate(function_info)); |
4924 return frame()->CallStub(&stub, 1); | 4925 return frame()->CallStub(&stub, 1); |
4925 } else { | 4926 } else { |
4926 // Call the runtime to instantiate the function based on the | 4927 // Call the runtime to instantiate the function based on the |
4927 // shared function info. | 4928 // shared function info. |
4928 frame()->EmitPush(esi); | 4929 frame()->EmitPush(esi); |
4929 frame()->EmitPush(Immediate(function_info)); | 4930 frame()->EmitPush(Immediate(function_info)); |
4930 frame()->EmitPush(Immediate(pretenure | 4931 frame()->EmitPush(Immediate(pretenure |
4931 ? Factory::true_value() | 4932 ? Factory::true_value() |
(...skipping 5423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10355 memcpy(chunk->GetStartAddress(), desc.buffer, desc.instr_size); | 10356 memcpy(chunk->GetStartAddress(), desc.buffer, desc.instr_size); |
10356 CPU::FlushICache(chunk->GetStartAddress(), desc.instr_size); | 10357 CPU::FlushICache(chunk->GetStartAddress(), desc.instr_size); |
10357 return FUNCTION_CAST<MemCopyFunction>(chunk->GetStartAddress()); | 10358 return FUNCTION_CAST<MemCopyFunction>(chunk->GetStartAddress()); |
10358 } | 10359 } |
10359 | 10360 |
10360 #undef __ | 10361 #undef __ |
10361 | 10362 |
10362 } } // namespace v8::internal | 10363 } } // namespace v8::internal |
10363 | 10364 |
10364 #endif // V8_TARGET_ARCH_IA32 | 10365 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |