| 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); |
| 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 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 749 LEnvironment* environment) { | 747 LEnvironment* environment) { |
| 750 Deoptimizer::BailoutType bailout_type = info()->IsStub() | 748 Deoptimizer::BailoutType bailout_type = info()->IsStub() |
| 751 ? Deoptimizer::LAZY | 749 ? Deoptimizer::LAZY |
| 752 : Deoptimizer::EAGER; | 750 : Deoptimizer::EAGER; |
| 753 DeoptimizeIf(cc, environment, bailout_type); | 751 DeoptimizeIf(cc, environment, bailout_type); |
| 754 } | 752 } |
| 755 | 753 |
| 756 | 754 |
| 757 void LCodeGen::RegisterDependentCodeForEmbeddedMaps(Handle<Code> code) { | 755 void LCodeGen::RegisterDependentCodeForEmbeddedMaps(Handle<Code> code) { |
| 758 ZoneList<Handle<Map> > maps(1, zone()); | 756 ZoneList<Handle<Map> > maps(1, zone()); |
| 757 ZoneList<Handle<JSObject> > objects(1, zone()); |
| 759 int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); | 758 int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); |
| 760 for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) { | 759 for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) { |
| 761 RelocInfo::Mode mode = it.rinfo()->rmode(); | 760 if (Code::IsWeakEmbeddedObject(code->kind(), it.rinfo()->target_object())) { |
| 762 if (mode == RelocInfo::EMBEDDED_OBJECT && | 761 if (it.rinfo()->target_object()->IsMap()) { |
| 763 it.rinfo()->target_object()->IsMap()) { | 762 Handle<Map> map(Map::cast(it.rinfo()->target_object())); |
| 764 Handle<Map> map(Map::cast(it.rinfo()->target_object())); | |
| 765 if (map->CanTransition()) { | |
| 766 maps.Add(map, zone()); | 763 maps.Add(map, zone()); |
| 764 } else if (it.rinfo()->target_object()->IsJSObject()) { |
| 765 Handle<JSObject> object(JSObject::cast(it.rinfo()->target_object())); |
| 766 objects.Add(object, zone()); |
| 767 } | 767 } |
| 768 } | 768 } |
| 769 } | 769 } |
| 770 #ifdef VERIFY_HEAP | 770 #ifdef VERIFY_HEAP |
| 771 // This disables verification of weak embedded maps after full GC. | 771 // This disables verification of weak embedded maps after full GC. |
| 772 // AddDependentCode can cause a GC, which would observe the state where | 772 // AddDependentCode can cause a GC, which would observe the state where |
| 773 // this code is not yet in the depended code lists of the embedded maps. | 773 // this code is not yet in the depended code lists of the embedded maps. |
| 774 NoWeakEmbeddedMapsVerificationScope disable_verification_of_embedded_maps; | 774 NoWeakEmbeddedMapsVerificationScope disable_verification_of_embedded_maps; |
| 775 #endif | 775 #endif |
| 776 for (int i = 0; i < maps.length(); i++) { | 776 for (int i = 0; i < maps.length(); i++) { |
| 777 maps.at(i)->AddDependentCode(DependentCode::kWeaklyEmbeddedGroup, code); | 777 maps.at(i)->AddDependentCode(DependentCode::kWeaklyEmbeddedGroup, code); |
| 778 } | 778 } |
| 779 for (int i = 0; i < objects.length(); i++) { |
| 780 AddWeakObjectToCodeDependency(isolate()->heap(), objects.at(i), code); |
| 781 } |
| 779 } | 782 } |
| 780 | 783 |
| 781 | 784 |
| 782 void LCodeGen::PopulateDeoptimizationData(Handle<Code> code) { | 785 void LCodeGen::PopulateDeoptimizationData(Handle<Code> code) { |
| 783 int length = deoptimizations_.length(); | 786 int length = deoptimizations_.length(); |
| 784 if (length == 0) return; | 787 if (length == 0) return; |
| 785 Handle<DeoptimizationInputData> data = | 788 Handle<DeoptimizationInputData> data = |
| 786 factory()->NewDeoptimizationInputData(length, TENURED); | 789 factory()->NewDeoptimizationInputData(length, TENURED); |
| 787 | 790 |
| 788 Handle<ByteArray> translations = | 791 Handle<ByteArray> translations = |
| (...skipping 4725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5514 FixedArray::kHeaderSize - kPointerSize)); | 5517 FixedArray::kHeaderSize - kPointerSize)); |
| 5515 __ bind(&done); | 5518 __ bind(&done); |
| 5516 } | 5519 } |
| 5517 | 5520 |
| 5518 | 5521 |
| 5519 #undef __ | 5522 #undef __ |
| 5520 | 5523 |
| 5521 } } // namespace v8::internal | 5524 } } // namespace v8::internal |
| 5522 | 5525 |
| 5523 #endif // V8_TARGET_ARCH_X64 | 5526 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |