| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 2972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2983 target_shared->set_compiler_hints(source_shared->compiler_hints()); | 2983 target_shared->set_compiler_hints(source_shared->compiler_hints()); |
| 2984 target_shared->set_native(was_native); | 2984 target_shared->set_native(was_native); |
| 2985 | 2985 |
| 2986 // Set the code of the target function. | 2986 // Set the code of the target function. |
| 2987 target->ReplaceCode(source_shared->code()); | 2987 target->ReplaceCode(source_shared->code()); |
| 2988 ASSERT(target->next_function_link()->IsUndefined()); | 2988 ASSERT(target->next_function_link()->IsUndefined()); |
| 2989 | 2989 |
| 2990 // Make sure we get a fresh copy of the literal vector to avoid cross | 2990 // Make sure we get a fresh copy of the literal vector to avoid cross |
| 2991 // context contamination. | 2991 // context contamination. |
| 2992 Handle<Context> context(source->context()); | 2992 Handle<Context> context(source->context()); |
| 2993 Handle<ConstantPoolArray> constant_pool(source->constant_pool()); |
| 2993 int number_of_literals = source->NumberOfLiterals(); | 2994 int number_of_literals = source->NumberOfLiterals(); |
| 2994 Handle<FixedArray> literals = | 2995 Handle<FixedArray> literals = |
| 2995 isolate->factory()->NewFixedArray(number_of_literals, TENURED); | 2996 isolate->factory()->NewFixedArray(number_of_literals, TENURED); |
| 2996 if (number_of_literals > 0) { | 2997 if (number_of_literals > 0) { |
| 2997 literals->set(JSFunction::kLiteralNativeContextIndex, | 2998 literals->set(JSFunction::kLiteralNativeContextIndex, |
| 2998 context->native_context()); | 2999 context->native_context()); |
| 2999 } | 3000 } |
| 3000 target->set_context(*context); | 3001 target->set_context(*context); |
| 3002 target->set_constant_pool(*constant_pool); |
| 3001 target->set_literals(*literals); | 3003 target->set_literals(*literals); |
| 3002 | 3004 |
| 3003 if (isolate->logger()->is_logging_code_events() || | 3005 if (isolate->logger()->is_logging_code_events() || |
| 3004 isolate->cpu_profiler()->is_profiling()) { | 3006 isolate->cpu_profiler()->is_profiling()) { |
| 3005 isolate->logger()->LogExistingFunction( | 3007 isolate->logger()->LogExistingFunction( |
| 3006 source_shared, Handle<Code>(source_shared->code())); | 3008 source_shared, Handle<Code>(source_shared->code())); |
| 3007 } | 3009 } |
| 3008 | 3010 |
| 3009 return *target; | 3011 return *target; |
| 3010 } | 3012 } |
| (...skipping 11904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14915 // Handle last resort GC and make sure to allow future allocations | 14917 // Handle last resort GC and make sure to allow future allocations |
| 14916 // to grow the heap without causing GCs (if possible). | 14918 // to grow the heap without causing GCs (if possible). |
| 14917 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14919 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 14918 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14920 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 14919 "Runtime::PerformGC"); | 14921 "Runtime::PerformGC"); |
| 14920 } | 14922 } |
| 14921 } | 14923 } |
| 14922 | 14924 |
| 14923 | 14925 |
| 14924 } } // namespace v8::internal | 14926 } } // namespace v8::internal |
| OLD | NEW |