Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 82 GenerateDeferredCode() && | 82 GenerateDeferredCode() && |
| 83 GenerateJumpTable() && | 83 GenerateJumpTable() && |
| 84 GenerateSafepointTable(); | 84 GenerateSafepointTable(); |
| 85 } | 85 } |
| 86 | 86 |
| 87 | 87 |
| 88 void LCodeGen::FinishCode(Handle<Code> code) { | 88 void LCodeGen::FinishCode(Handle<Code> code) { |
| 89 ASSERT(is_done()); | 89 ASSERT(is_done()); |
| 90 code->set_stack_slots(GetStackSlotCount()); | 90 code->set_stack_slots(GetStackSlotCount()); |
| 91 code->set_safepoint_table_offset(safepoints_.GetCodeOffset()); | 91 code->set_safepoint_table_offset(safepoints_.GetCodeOffset()); |
| 92 if (FLAG_weak_embedded_maps_in_optimized_code) { | 92 RegisterDependentCodeForEmbeddedMaps(code); |
|
Hannes Payer (out of office)
2013/10/01 13:13:50
Why did you remove that flag?
ulan
2013/10/01 14:50:29
This check is moved inside the function in IsWeakE
| |
| 93 RegisterDependentCodeForEmbeddedMaps(code); | |
| 94 } | |
| 95 PopulateDeoptimizationData(code); | 93 PopulateDeoptimizationData(code); |
| 96 info()->CommitDependencies(code); | 94 info()->CommitDependencies(code); |
| 97 } | 95 } |
| 98 | 96 |
| 99 | 97 |
| 100 void LChunkBuilder::Abort(BailoutReason reason) { | 98 void LChunkBuilder::Abort(BailoutReason reason) { |
| 101 info()->set_bailout_reason(reason); | 99 info()->set_bailout_reason(reason); |
| 102 status_ = ABORTED; | 100 status_ = ABORTED; |
| 103 } | 101 } |
| 104 | 102 |
| (...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 747 LEnvironment* environment) { | 745 LEnvironment* environment) { |
| 748 Deoptimizer::BailoutType bailout_type = info()->IsStub() | 746 Deoptimizer::BailoutType bailout_type = info()->IsStub() |
| 749 ? Deoptimizer::LAZY | 747 ? Deoptimizer::LAZY |
| 750 : Deoptimizer::EAGER; | 748 : Deoptimizer::EAGER; |
| 751 DeoptimizeIf(cc, environment, bailout_type); | 749 DeoptimizeIf(cc, environment, bailout_type); |
| 752 } | 750 } |
| 753 | 751 |
| 754 | 752 |
| 755 void LCodeGen::RegisterDependentCodeForEmbeddedMaps(Handle<Code> code) { | 753 void LCodeGen::RegisterDependentCodeForEmbeddedMaps(Handle<Code> code) { |
| 756 ZoneList<Handle<Map> > maps(1, zone()); | 754 ZoneList<Handle<Map> > maps(1, zone()); |
| 755 ZoneList<Handle<JSObject> > objects(1, zone()); | |
| 757 int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); | 756 int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); |
| 758 for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) { | 757 for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) { |
| 759 RelocInfo::Mode mode = it.rinfo()->rmode(); | 758 if (Code::IsWeakEmbeddedObject(code->kind(), it.rinfo()->target_object())) { |
| 760 if (mode == RelocInfo::EMBEDDED_OBJECT && | 759 if (it.rinfo()->target_object()->IsMap()) { |
| 761 it.rinfo()->target_object()->IsMap()) { | 760 Handle<Map> map(Map::cast(it.rinfo()->target_object())); |
| 762 Handle<Map> map(Map::cast(it.rinfo()->target_object())); | |
| 763 if (map->CanTransition()) { | |
| 764 maps.Add(map, zone()); | 761 maps.Add(map, zone()); |
| 762 } else if (it.rinfo()->target_object()->IsJSObject()) { | |
| 763 Handle<JSObject> object(JSObject::cast(it.rinfo()->target_object())); | |
| 764 objects.Add(object, zone()); | |
| 765 } | 765 } |
| 766 } | 766 } |
| 767 } | 767 } |
| 768 #ifdef VERIFY_HEAP | 768 #ifdef VERIFY_HEAP |
| 769 // This disables verification of weak embedded maps after full GC. | 769 // This disables verification of weak embedded maps after full GC. |
| 770 // AddDependentCode can cause a GC, which would observe the state where | 770 // AddDependentCode can cause a GC, which would observe the state where |
| 771 // this code is not yet in the depended code lists of the embedded maps. | 771 // this code is not yet in the depended code lists of the embedded maps. |
| 772 NoWeakEmbeddedMapsVerificationScope disable_verification_of_embedded_maps; | 772 NoWeakEmbeddedMapsVerificationScope disable_verification_of_embedded_maps; |
| 773 #endif | 773 #endif |
| 774 for (int i = 0; i < maps.length(); i++) { | 774 for (int i = 0; i < maps.length(); i++) { |
| 775 maps.at(i)->AddDependentCode(DependentCode::kWeaklyEmbeddedGroup, code); | 775 maps.at(i)->AddDependentCode(DependentCode::kWeaklyEmbeddedGroup, code); |
| 776 } | 776 } |
| 777 for (int i = 0; i < objects.length(); i++) { | |
| 778 AddWeakObjectToCodeDependency(isolate()->heap(), objects.at(i), code); | |
| 779 } | |
| 777 } | 780 } |
| 778 | 781 |
| 779 | 782 |
| 780 void LCodeGen::PopulateDeoptimizationData(Handle<Code> code) { | 783 void LCodeGen::PopulateDeoptimizationData(Handle<Code> code) { |
| 781 int length = deoptimizations_.length(); | 784 int length = deoptimizations_.length(); |
| 782 if (length == 0) return; | 785 if (length == 0) return; |
| 783 Handle<DeoptimizationInputData> data = | 786 Handle<DeoptimizationInputData> data = |
| 784 factory()->NewDeoptimizationInputData(length, TENURED); | 787 factory()->NewDeoptimizationInputData(length, TENURED); |
| 785 | 788 |
| 786 Handle<ByteArray> translations = | 789 Handle<ByteArray> translations = |
| (...skipping 4732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5519 FixedArray::kHeaderSize - kPointerSize)); | 5522 FixedArray::kHeaderSize - kPointerSize)); |
| 5520 __ bind(&done); | 5523 __ bind(&done); |
| 5521 } | 5524 } |
| 5522 | 5525 |
| 5523 | 5526 |
| 5524 #undef __ | 5527 #undef __ |
| 5525 | 5528 |
| 5526 } } // namespace v8::internal | 5529 } } // namespace v8::internal |
| 5527 | 5530 |
| 5528 #endif // V8_TARGET_ARCH_X64 | 5531 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |