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 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 } | 442 } |
443 | 443 |
444 RecordFunctionCompilation(Logger::LAZY_COMPILE_TAG, | 444 RecordFunctionCompilation(Logger::LAZY_COMPILE_TAG, |
445 name, | 445 name, |
446 Handle<String>(shared->inferred_name()), | 446 Handle<String>(shared->inferred_name()), |
447 start_position, | 447 start_position, |
448 info->script(), | 448 info->script(), |
449 code); | 449 code); |
450 | 450 |
451 // Update the shared function info with the compiled code and the scope info. | 451 // Update the shared function info with the compiled code and the scope info. |
| 452 // Please note, that the order of the sharedfunction initialization is |
| 453 // important since set_scope_info might trigger a GC, causing the ASSERT |
| 454 // below to be invalid if the code was flushed. By settting the code |
| 455 // object last we avoid this. |
| 456 shared->set_scope_info(*SerializedScopeInfo::Create(info->scope())); |
452 shared->set_code(*code); | 457 shared->set_code(*code); |
453 shared->set_scope_info(*SerializedScopeInfo::Create(info->scope())); | |
454 | 458 |
455 // Set the expected number of properties for instances. | 459 // Set the expected number of properties for instances. |
456 SetExpectedNofPropertiesFromEstimate(shared, lit->expected_property_count()); | 460 SetExpectedNofPropertiesFromEstimate(shared, lit->expected_property_count()); |
457 | 461 |
458 // Set the optimication hints after performing lazy compilation, as these are | 462 // Set the optimication hints after performing lazy compilation, as these are |
459 // not set when the function is set up as a lazily compiled function. | 463 // not set when the function is set up as a lazily compiled function. |
460 shared->SetThisPropertyAssignmentsInfo( | 464 shared->SetThisPropertyAssignmentsInfo( |
461 lit->has_only_simple_this_property_assignments(), | 465 lit->has_only_simple_this_property_assignments(), |
462 *lit->this_property_assignments()); | 466 *lit->this_property_assignments()); |
463 | 467 |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 PROFILE(CodeCreateEvent(Logger::ToNativeByScript(tag, *script), | 645 PROFILE(CodeCreateEvent(Logger::ToNativeByScript(tag, *script), |
642 *code, *func_name)); | 646 *code, *func_name)); |
643 OPROFILE(CreateNativeCodeRegion(*func_name, | 647 OPROFILE(CreateNativeCodeRegion(*func_name, |
644 code->instruction_start(), | 648 code->instruction_start(), |
645 code->instruction_size())); | 649 code->instruction_size())); |
646 } | 650 } |
647 } | 651 } |
648 } | 652 } |
649 | 653 |
650 } } // namespace v8::internal | 654 } } // namespace v8::internal |
OLD | NEW |