| 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 2495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2506 target_shared->ReplaceCode(source_shared->code()); | 2506 target_shared->ReplaceCode(source_shared->code()); |
| 2507 target_shared->set_scope_info(source_shared->scope_info()); | 2507 target_shared->set_scope_info(source_shared->scope_info()); |
| 2508 target_shared->set_length(source_shared->length()); | 2508 target_shared->set_length(source_shared->length()); |
| 2509 target_shared->set_formal_parameter_count( | 2509 target_shared->set_formal_parameter_count( |
| 2510 source_shared->formal_parameter_count()); | 2510 source_shared->formal_parameter_count()); |
| 2511 target_shared->set_script(isolate->heap()->undefined_value()); | 2511 target_shared->set_script(isolate->heap()->undefined_value()); |
| 2512 | 2512 |
| 2513 // Since we don't store the source we should never optimize this. | 2513 // Since we don't store the source we should never optimize this. |
| 2514 target_shared->code()->set_optimizable(false); | 2514 target_shared->code()->set_optimizable(false); |
| 2515 | 2515 |
| 2516 // Clear the optimization hints related to the compiled code as these | |
| 2517 // are no longer valid when the code is overwritten. | |
| 2518 target_shared->ClearThisPropertyAssignmentsInfo(); | |
| 2519 | |
| 2520 // Set the code of the target function. | 2516 // Set the code of the target function. |
| 2521 target->ReplaceCode(source_shared->code()); | 2517 target->ReplaceCode(source_shared->code()); |
| 2522 ASSERT(target->next_function_link()->IsUndefined()); | 2518 ASSERT(target->next_function_link()->IsUndefined()); |
| 2523 | 2519 |
| 2524 // Make sure we get a fresh copy of the literal vector to avoid cross | 2520 // Make sure we get a fresh copy of the literal vector to avoid cross |
| 2525 // context contamination. | 2521 // context contamination. |
| 2526 Handle<Context> context(source->context()); | 2522 Handle<Context> context(source->context()); |
| 2527 int number_of_literals = source->NumberOfLiterals(); | 2523 int number_of_literals = source->NumberOfLiterals(); |
| 2528 Handle<FixedArray> literals = | 2524 Handle<FixedArray> literals = |
| 2529 isolate->factory()->NewFixedArray(number_of_literals, TENURED); | 2525 isolate->factory()->NewFixedArray(number_of_literals, TENURED); |
| (...skipping 10994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13524 // Handle last resort GC and make sure to allow future allocations | 13520 // Handle last resort GC and make sure to allow future allocations |
| 13525 // to grow the heap without causing GCs (if possible). | 13521 // to grow the heap without causing GCs (if possible). |
| 13526 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13522 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 13527 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13523 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 13528 "Runtime::PerformGC"); | 13524 "Runtime::PerformGC"); |
| 13529 } | 13525 } |
| 13530 } | 13526 } |
| 13531 | 13527 |
| 13532 | 13528 |
| 13533 } } // namespace v8::internal | 13529 } } // namespace v8::internal |
| OLD | NEW |