Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(305)

Side by Side Diff: src/x64/lithium-codegen-x64.cc

Issue 23477061: Make objects embedded in optimized code weak. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix arm Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/serialize.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 LEnvironment* environment) { 699 LEnvironment* environment) {
702 Deoptimizer::BailoutType bailout_type = info()->IsStub() 700 Deoptimizer::BailoutType bailout_type = info()->IsStub()
703 ? Deoptimizer::LAZY 701 ? Deoptimizer::LAZY
704 : Deoptimizer::EAGER; 702 : Deoptimizer::EAGER;
705 DeoptimizeIf(cc, environment, bailout_type); 703 DeoptimizeIf(cc, environment, bailout_type);
706 } 704 }
707 705
708 706
709 void LCodeGen::RegisterDependentCodeForEmbeddedMaps(Handle<Code> code) { 707 void LCodeGen::RegisterDependentCodeForEmbeddedMaps(Handle<Code> code) {
710 ZoneList<Handle<Map> > maps(1, zone()); 708 ZoneList<Handle<Map> > maps(1, zone());
709 ZoneList<Handle<JSObject> > objects(1, zone());
711 int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); 710 int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT);
712 for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) { 711 for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) {
713 RelocInfo::Mode mode = it.rinfo()->rmode(); 712 if (Code::IsWeakEmbeddedObject(code->kind(), it.rinfo()->target_object())) {
714 if (mode == RelocInfo::EMBEDDED_OBJECT && 713 if (it.rinfo()->target_object()->IsMap()) {
715 it.rinfo()->target_object()->IsMap()) { 714 Handle<Map> map(Map::cast(it.rinfo()->target_object()));
716 Handle<Map> map(Map::cast(it.rinfo()->target_object()));
717 if (map->CanTransition()) {
718 maps.Add(map, zone()); 715 maps.Add(map, zone());
716 } else if (it.rinfo()->target_object()->IsJSObject()) {
717 Handle<JSObject> object(JSObject::cast(it.rinfo()->target_object()));
718 objects.Add(object, zone());
719 } 719 }
720 } 720 }
721 } 721 }
722 #ifdef VERIFY_HEAP 722 #ifdef VERIFY_HEAP
723 // This disables verification of weak embedded maps after full GC. 723 // This disables verification of weak embedded objects after full GC.
724 // AddDependentCode can cause a GC, which would observe the state where 724 // AddDependentCode can cause a GC, which would observe the state where
725 // this code is not yet in the depended code lists of the embedded maps. 725 // this code is not yet in the depended code lists of the embedded maps.
726 NoWeakEmbeddedMapsVerificationScope disable_verification_of_embedded_maps; 726 NoWeakObjectVerificationScope disable_verification_of_embedded_objects;
727 #endif 727 #endif
728 for (int i = 0; i < maps.length(); i++) { 728 for (int i = 0; i < maps.length(); i++) {
729 maps.at(i)->AddDependentCode(DependentCode::kWeaklyEmbeddedGroup, code); 729 maps.at(i)->AddDependentCode(DependentCode::kWeaklyEmbeddedGroup, code);
730 } 730 }
731 for (int i = 0; i < objects.length(); i++) {
732 AddWeakObjectToCodeDependency(isolate()->heap(), objects.at(i), code);
733 }
731 } 734 }
732 735
733 736
734 void LCodeGen::PopulateDeoptimizationData(Handle<Code> code) { 737 void LCodeGen::PopulateDeoptimizationData(Handle<Code> code) {
735 int length = deoptimizations_.length(); 738 int length = deoptimizations_.length();
736 if (length == 0) return; 739 if (length == 0) return;
737 Handle<DeoptimizationInputData> data = 740 Handle<DeoptimizationInputData> data =
738 factory()->NewDeoptimizationInputData(length, TENURED); 741 factory()->NewDeoptimizationInputData(length, TENURED);
739 742
740 Handle<ByteArray> translations = 743 Handle<ByteArray> translations =
(...skipping 4717 matching lines...) Expand 10 before | Expand all | Expand 10 after
5458 FixedArray::kHeaderSize - kPointerSize)); 5461 FixedArray::kHeaderSize - kPointerSize));
5459 __ bind(&done); 5462 __ bind(&done);
5460 } 5463 }
5461 5464
5462 5465
5463 #undef __ 5466 #undef __
5464 5467
5465 } } // namespace v8::internal 5468 } } // namespace v8::internal
5466 5469
5467 #endif // V8_TARGET_ARCH_X64 5470 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/serialize.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698