OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 4812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4823 // using 'new'. | 4823 // using 'new'. |
4824 return Top::context()->global(); | 4824 return Top::context()->global(); |
4825 } | 4825 } |
4826 } | 4826 } |
4827 | 4827 |
4828 // The function should be compiled for the optimization hints to be available. | 4828 // The function should be compiled for the optimization hints to be available. |
4829 if (!function->shared()->is_compiled()) { | 4829 if (!function->shared()->is_compiled()) { |
4830 CompileLazyShared(Handle<SharedFunctionInfo>(function->shared()), | 4830 CompileLazyShared(Handle<SharedFunctionInfo>(function->shared()), |
4831 CLEAR_EXCEPTION, | 4831 CLEAR_EXCEPTION, |
4832 0); | 4832 0); |
| 4833 LOG(FunctionCreateEvent(*function)); |
4833 } | 4834 } |
4834 | 4835 |
4835 bool first_allocation = !function->has_initial_map(); | 4836 bool first_allocation = !function->has_initial_map(); |
4836 Handle<JSObject> result = Factory::NewJSObject(function); | 4837 Handle<JSObject> result = Factory::NewJSObject(function); |
4837 if (first_allocation) { | 4838 if (first_allocation) { |
4838 Handle<Map> map = Handle<Map>(function->initial_map()); | 4839 Handle<Map> map = Handle<Map>(function->initial_map()); |
4839 Handle<Code> stub = Handle<Code>( | 4840 Handle<Code> stub = Handle<Code>( |
4840 ComputeConstructStub(Handle<SharedFunctionInfo>(function->shared()))); | 4841 ComputeConstructStub(Handle<SharedFunctionInfo>(function->shared()))); |
4841 function->shared()->set_construct_stub(*stub); | 4842 function->shared()->set_construct_stub(*stub); |
4842 } | 4843 } |
(...skipping 3320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8163 } else { | 8164 } else { |
8164 // Handle last resort GC and make sure to allow future allocations | 8165 // Handle last resort GC and make sure to allow future allocations |
8165 // to grow the heap without causing GCs (if possible). | 8166 // to grow the heap without causing GCs (if possible). |
8166 Counters::gc_last_resort_from_js.Increment(); | 8167 Counters::gc_last_resort_from_js.Increment(); |
8167 Heap::CollectAllGarbage(false); | 8168 Heap::CollectAllGarbage(false); |
8168 } | 8169 } |
8169 } | 8170 } |
8170 | 8171 |
8171 | 8172 |
8172 } } // namespace v8::internal | 8173 } } // namespace v8::internal |
OLD | NEW |