| OLD | NEW |
| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 GenerateDeferredCode() && | 96 GenerateDeferredCode() && |
| 97 GenerateJumpTable() && | 97 GenerateJumpTable() && |
| 98 GenerateSafepointTable(); | 98 GenerateSafepointTable(); |
| 99 } | 99 } |
| 100 | 100 |
| 101 | 101 |
| 102 void LCodeGen::FinishCode(Handle<Code> code) { | 102 void LCodeGen::FinishCode(Handle<Code> code) { |
| 103 ASSERT(is_done()); | 103 ASSERT(is_done()); |
| 104 code->set_stack_slots(GetStackSlotCount()); | 104 code->set_stack_slots(GetStackSlotCount()); |
| 105 code->set_safepoint_table_offset(safepoints_.GetCodeOffset()); | 105 code->set_safepoint_table_offset(safepoints_.GetCodeOffset()); |
| 106 if (FLAG_weak_embedded_maps_in_optimized_code) { | 106 RegisterDependentCodeForEmbeddedMaps(code); |
| 107 RegisterDependentCodeForEmbeddedMaps(code); | |
| 108 } | |
| 109 PopulateDeoptimizationData(code); | 107 PopulateDeoptimizationData(code); |
| 110 if (!info()->IsStub()) { | 108 if (!info()->IsStub()) { |
| 111 Deoptimizer::EnsureRelocSpaceForLazyDeoptimization(code); | 109 Deoptimizer::EnsureRelocSpaceForLazyDeoptimization(code); |
| 112 } | 110 } |
| 113 info()->CommitDependencies(code); | 111 info()->CommitDependencies(code); |
| 114 } | 112 } |
| 115 | 113 |
| 116 | 114 |
| 117 void LCodeGen::Abort(BailoutReason reason) { | 115 void LCodeGen::Abort(BailoutReason reason) { |
| 118 info()->set_bailout_reason(reason); | 116 info()->set_bailout_reason(reason); |
| (...skipping 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1155 | 1153 |
| 1156 void LCodeGen::DeoptimizeIf(Condition cc, | 1154 void LCodeGen::DeoptimizeIf(Condition cc, |
| 1157 LEnvironment* environment) { | 1155 LEnvironment* environment) { |
| 1158 Deoptimizer::BailoutType bailout_type = info()->IsStub() | 1156 Deoptimizer::BailoutType bailout_type = info()->IsStub() |
| 1159 ? Deoptimizer::LAZY | 1157 ? Deoptimizer::LAZY |
| 1160 : Deoptimizer::EAGER; | 1158 : Deoptimizer::EAGER; |
| 1161 DeoptimizeIf(cc, environment, bailout_type); | 1159 DeoptimizeIf(cc, environment, bailout_type); |
| 1162 } | 1160 } |
| 1163 | 1161 |
| 1164 | 1162 |
| 1165 void LCodeGen::RegisterDependentCodeForEmbeddedMaps(Handle<Code> code) { | |
| 1166 ZoneList<Handle<Map> > maps(1, zone()); | |
| 1167 ZoneList<Handle<JSObject> > objects(1, zone()); | |
| 1168 int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); | |
| 1169 for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) { | |
| 1170 if (Code::IsWeakEmbeddedObject(code->kind(), it.rinfo()->target_object())) { | |
| 1171 if (it.rinfo()->target_object()->IsMap()) { | |
| 1172 Handle<Map> map(Map::cast(it.rinfo()->target_object())); | |
| 1173 maps.Add(map, zone()); | |
| 1174 } else if (it.rinfo()->target_object()->IsJSObject()) { | |
| 1175 Handle<JSObject> object(JSObject::cast(it.rinfo()->target_object())); | |
| 1176 objects.Add(object, zone()); | |
| 1177 } | |
| 1178 } | |
| 1179 } | |
| 1180 #ifdef VERIFY_HEAP | |
| 1181 // This disables verification of weak embedded objects after full GC. | |
| 1182 // AddDependentCode can cause a GC, which would observe the state where | |
| 1183 // this code is not yet in the depended code lists of the embedded maps. | |
| 1184 NoWeakObjectVerificationScope disable_verification_of_embedded_objects; | |
| 1185 #endif | |
| 1186 for (int i = 0; i < maps.length(); i++) { | |
| 1187 maps.at(i)->AddDependentCode(DependentCode::kWeaklyEmbeddedGroup, code); | |
| 1188 } | |
| 1189 for (int i = 0; i < objects.length(); i++) { | |
| 1190 AddWeakObjectToCodeDependency(isolate()->heap(), objects.at(i), code); | |
| 1191 } | |
| 1192 } | |
| 1193 | |
| 1194 | |
| 1195 void LCodeGen::PopulateDeoptimizationData(Handle<Code> code) { | 1163 void LCodeGen::PopulateDeoptimizationData(Handle<Code> code) { |
| 1196 int length = deoptimizations_.length(); | 1164 int length = deoptimizations_.length(); |
| 1197 if (length == 0) return; | 1165 if (length == 0) return; |
| 1198 Handle<DeoptimizationInputData> data = | 1166 Handle<DeoptimizationInputData> data = |
| 1199 factory()->NewDeoptimizationInputData(length, TENURED); | 1167 factory()->NewDeoptimizationInputData(length, TENURED); |
| 1200 | 1168 |
| 1201 Handle<ByteArray> translations = | 1169 Handle<ByteArray> translations = |
| 1202 translations_.CreateByteArray(isolate()->factory()); | 1170 translations_.CreateByteArray(isolate()->factory()); |
| 1203 data->SetTranslationByteArray(*translations); | 1171 data->SetTranslationByteArray(*translations); |
| 1204 data->SetInlinedFunctionCount(Smi::FromInt(inlined_function_count_)); | 1172 data->SetInlinedFunctionCount(Smi::FromInt(inlined_function_count_)); |
| (...skipping 5229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6434 FixedArray::kHeaderSize - kPointerSize)); | 6402 FixedArray::kHeaderSize - kPointerSize)); |
| 6435 __ bind(&done); | 6403 __ bind(&done); |
| 6436 } | 6404 } |
| 6437 | 6405 |
| 6438 | 6406 |
| 6439 #undef __ | 6407 #undef __ |
| 6440 | 6408 |
| 6441 } } // namespace v8::internal | 6409 } } // namespace v8::internal |
| 6442 | 6410 |
| 6443 #endif // V8_TARGET_ARCH_IA32 | 6411 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |