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 2964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2975 target_shared->set_compiler_hints(source_shared->compiler_hints()); | 2975 target_shared->set_compiler_hints(source_shared->compiler_hints()); |
2976 target_shared->set_native(was_native); | 2976 target_shared->set_native(was_native); |
2977 | 2977 |
2978 // Set the code of the target function. | 2978 // Set the code of the target function. |
2979 target->ReplaceCode(source_shared->code()); | 2979 target->ReplaceCode(source_shared->code()); |
2980 ASSERT(target->next_function_link()->IsUndefined()); | 2980 ASSERT(target->next_function_link()->IsUndefined()); |
2981 | 2981 |
2982 // Make sure we get a fresh copy of the literal vector to avoid cross | 2982 // Make sure we get a fresh copy of the literal vector to avoid cross |
2983 // context contamination. | 2983 // context contamination. |
2984 Handle<Context> context(source->context()); | 2984 Handle<Context> context(source->context()); |
| 2985 Handle<ConstantPoolArray> constant_pool(source->constant_pool()); |
2985 int number_of_literals = source->NumberOfLiterals(); | 2986 int number_of_literals = source->NumberOfLiterals(); |
2986 Handle<FixedArray> literals = | 2987 Handle<FixedArray> literals = |
2987 isolate->factory()->NewFixedArray(number_of_literals, TENURED); | 2988 isolate->factory()->NewFixedArray(number_of_literals, TENURED); |
2988 if (number_of_literals > 0) { | 2989 if (number_of_literals > 0) { |
2989 literals->set(JSFunction::kLiteralNativeContextIndex, | 2990 literals->set(JSFunction::kLiteralNativeContextIndex, |
2990 context->native_context()); | 2991 context->native_context()); |
2991 } | 2992 } |
2992 target->set_context(*context); | 2993 target->set_context(*context); |
| 2994 target->set_constant_pool(*constant_pool); |
2993 target->set_literals(*literals); | 2995 target->set_literals(*literals); |
2994 | 2996 |
2995 if (isolate->logger()->is_logging_code_events() || | 2997 if (isolate->logger()->is_logging_code_events() || |
2996 isolate->cpu_profiler()->is_profiling()) { | 2998 isolate->cpu_profiler()->is_profiling()) { |
2997 isolate->logger()->LogExistingFunction( | 2999 isolate->logger()->LogExistingFunction( |
2998 source_shared, Handle<Code>(source_shared->code())); | 3000 source_shared, Handle<Code>(source_shared->code())); |
2999 } | 3001 } |
3000 | 3002 |
3001 return *target; | 3003 return *target; |
3002 } | 3004 } |
(...skipping 11904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14907 // Handle last resort GC and make sure to allow future allocations | 14909 // Handle last resort GC and make sure to allow future allocations |
14908 // to grow the heap without causing GCs (if possible). | 14910 // to grow the heap without causing GCs (if possible). |
14909 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14911 isolate->counters()->gc_last_resort_from_js()->Increment(); |
14910 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14912 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
14911 "Runtime::PerformGC"); | 14913 "Runtime::PerformGC"); |
14912 } | 14914 } |
14913 } | 14915 } |
14914 | 14916 |
14915 | 14917 |
14916 } } // namespace v8::internal | 14918 } } // namespace v8::internal |
OLD | NEW |