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

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

Issue 12256038: Register dependent codes before populating deoptimization data, which can cause GC. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 10 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/arm/lithium-codegen-arm.h ('k') | src/ia32/lithium-codegen-ia32.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 GenerateDeferredCode() && 76 GenerateDeferredCode() &&
77 GenerateDeoptJumpTable() && 77 GenerateDeoptJumpTable() &&
78 GenerateSafepointTable(); 78 GenerateSafepointTable();
79 } 79 }
80 80
81 81
82 void LCodeGen::FinishCode(Handle<Code> code) { 82 void LCodeGen::FinishCode(Handle<Code> code) {
83 ASSERT(is_done()); 83 ASSERT(is_done());
84 code->set_stack_slots(GetStackSlotCount()); 84 code->set_stack_slots(GetStackSlotCount());
85 code->set_safepoint_table_offset(safepoints_.GetCodeOffset()); 85 code->set_safepoint_table_offset(safepoints_.GetCodeOffset());
86 if (FLAG_weak_embedded_maps_in_optimized_code) {
87 RegisterDependentCodeForEmbeddedMaps(code);
88 }
86 PopulateDeoptimizationData(code); 89 PopulateDeoptimizationData(code);
87 } 90 }
88 91
89 92
90 void LCodeGen::Abort(const char* reason) { 93 void LCodeGen::Abort(const char* reason) {
91 info()->set_bailout_reason(reason); 94 info()->set_bailout_reason(reason);
92 status_ = ABORTED; 95 status_ = ABORTED;
93 } 96 }
94 97
95 98
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 (deopt_jump_table_.last().is_lazy_deopt != needs_lazy_deopt) || 860 (deopt_jump_table_.last().is_lazy_deopt != needs_lazy_deopt) ||
858 (deopt_jump_table_.last().needs_frame != !frame_is_built_)) { 861 (deopt_jump_table_.last().needs_frame != !frame_is_built_)) {
859 JumpTableEntry table_entry(entry, !frame_is_built_, needs_lazy_deopt); 862 JumpTableEntry table_entry(entry, !frame_is_built_, needs_lazy_deopt);
860 deopt_jump_table_.Add(table_entry, zone()); 863 deopt_jump_table_.Add(table_entry, zone());
861 } 864 }
862 __ b(cc, &deopt_jump_table_.last().label); 865 __ b(cc, &deopt_jump_table_.last().label);
863 } 866 }
864 } 867 }
865 868
866 869
870 void LCodeGen::RegisterDependentCodeForEmbeddedMaps(Handle<Code> code) {
871 ZoneList<Handle<Map> > maps(1, zone());
872 int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT);
873 for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) {
874 RelocInfo::Mode mode = it.rinfo()->rmode();
875 if (mode == RelocInfo::EMBEDDED_OBJECT &&
876 it.rinfo()->target_object()->IsMap()) {
877 Handle<Map> map(Map::cast(it.rinfo()->target_object()));
878 if (map->CanTransition()) {
879 maps.Add(map, zone());
880 }
881 }
882 }
883 #ifdef VERIFY_HEAP
884 // This disables verification of weak embedded maps after full GC.
885 // AddDependentCode can cause a GC, which would observe the state where
886 // this code is not yet in the depended code lists of the embedded maps.
887 NoWeakEmbeddedMapsVerificationScope disable_verification_of_embedded_maps;
888 #endif
889 for (int i = 0; i < maps.length(); i++) {
890 maps.at(i)->AddDependentCode(code);
891 }
892 }
893
894
867 void LCodeGen::PopulateDeoptimizationData(Handle<Code> code) { 895 void LCodeGen::PopulateDeoptimizationData(Handle<Code> code) {
868 int length = deoptimizations_.length(); 896 int length = deoptimizations_.length();
869 if (length == 0) return; 897 if (length == 0) return;
870 Handle<DeoptimizationInputData> data = 898 Handle<DeoptimizationInputData> data =
871 factory()->NewDeoptimizationInputData(length, TENURED); 899 factory()->NewDeoptimizationInputData(length, TENURED);
872 900
873 Handle<ByteArray> translations = translations_.CreateByteArray(); 901 Handle<ByteArray> translations = translations_.CreateByteArray();
874 data->SetTranslationByteArray(*translations); 902 data->SetTranslationByteArray(*translations);
875 data->SetInlinedFunctionCount(Smi::FromInt(inlined_function_count_)); 903 data->SetInlinedFunctionCount(Smi::FromInt(inlined_function_count_));
876 904
(...skipping 5408 matching lines...) Expand 10 before | Expand all | Expand 10 after
6285 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); 6313 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize));
6286 __ ldr(result, FieldMemOperand(scratch, 6314 __ ldr(result, FieldMemOperand(scratch,
6287 FixedArray::kHeaderSize - kPointerSize)); 6315 FixedArray::kHeaderSize - kPointerSize));
6288 __ bind(&done); 6316 __ bind(&done);
6289 } 6317 }
6290 6318
6291 6319
6292 #undef __ 6320 #undef __
6293 6321
6294 } } // namespace v8::internal 6322 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-codegen-arm.h ('k') | src/ia32/lithium-codegen-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698