| 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 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 #if V8_TARGET_ARCH_IA32 | 32 #if V8_TARGET_ARCH_IA32 |
| 33 #include "ia32/lithium-ia32.h" | 33 #include "ia32/lithium-ia32.h" |
| 34 #include "ia32/lithium-codegen-ia32.h" | 34 #include "ia32/lithium-codegen-ia32.h" |
| 35 #elif V8_TARGET_ARCH_X64 | 35 #elif V8_TARGET_ARCH_X64 |
| 36 #include "x64/lithium-x64.h" | 36 #include "x64/lithium-x64.h" |
| 37 #include "x64/lithium-codegen-x64.h" | 37 #include "x64/lithium-codegen-x64.h" |
| 38 #elif V8_TARGET_ARCH_ARM | 38 #elif V8_TARGET_ARCH_ARM |
| 39 #include "arm/lithium-arm.h" | 39 #include "arm/lithium-arm.h" |
| 40 #include "arm/lithium-codegen-arm.h" | 40 #include "arm/lithium-codegen-arm.h" |
| 41 #elif V8_TARGET_ARCH_A64 | |
| 42 #include "a64/lithium-a64.h" | |
| 43 #include "a64/lithium-codegen-a64.h" | |
| 44 #elif V8_TARGET_ARCH_MIPS | 41 #elif V8_TARGET_ARCH_MIPS |
| 45 #include "mips/lithium-mips.h" | 42 #include "mips/lithium-mips.h" |
| 46 #include "mips/lithium-codegen-mips.h" | 43 #include "mips/lithium-codegen-mips.h" |
| 47 #else | 44 #else |
| 48 #error Unsupported target architecture. | 45 #error Unsupported target architecture. |
| 49 #endif | 46 #endif |
| 50 | 47 |
| 51 namespace v8 { | 48 namespace v8 { |
| 52 namespace internal { | 49 namespace internal { |
| 53 | 50 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 if (FLAG_code_comments && instr->HasInterestingComment(codegen)) { | 97 if (FLAG_code_comments && instr->HasInterestingComment(codegen)) { |
| 101 Comment(";;; <@%d,#%d> %s", | 98 Comment(";;; <@%d,#%d> %s", |
| 102 current_instruction_, | 99 current_instruction_, |
| 103 instr->hydrogen_value()->id(), | 100 instr->hydrogen_value()->id(), |
| 104 instr->Mnemonic()); | 101 instr->Mnemonic()); |
| 105 } | 102 } |
| 106 | 103 |
| 107 GenerateBodyInstructionPre(instr); | 104 GenerateBodyInstructionPre(instr); |
| 108 | 105 |
| 109 HValue* value = instr->hydrogen_value(); | 106 HValue* value = instr->hydrogen_value(); |
| 110 if (!value->position().IsUnknown()) { | 107 if (value->position() != RelocInfo::kNoPosition) { |
| 111 RecordAndWritePosition( | 108 ASSERT(!graph()->info()->IsOptimizing() || |
| 112 chunk()->graph()->SourcePositionToScriptPosition(value->position())); | 109 !FLAG_emit_opt_code_positions || |
| 110 value->position() != RelocInfo::kNoPosition); |
| 111 RecordAndWritePosition(value->position()); |
| 113 } | 112 } |
| 114 | 113 |
| 115 instr->CompileToNative(codegen); | 114 instr->CompileToNative(codegen); |
| 116 | 115 |
| 117 GenerateBodyInstructionPost(instr); | 116 GenerateBodyInstructionPost(instr); |
| 118 } | 117 } |
| 119 EnsureSpaceForLazyDeopt(Deoptimizer::patch_size()); | 118 EnsureSpaceForLazyDeopt(Deoptimizer::patch_size()); |
| 120 last_lazy_deopt_pc_ = masm()->pc_offset(); | 119 last_lazy_deopt_pc_ = masm()->pc_offset(); |
| 121 return !is_aborted(); | 120 return !is_aborted(); |
| 122 } | 121 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 141 | 140 |
| 142 | 141 |
| 143 int LCodeGenBase::GetNextEmittedBlock() const { | 142 int LCodeGenBase::GetNextEmittedBlock() const { |
| 144 for (int i = current_block_ + 1; i < graph()->blocks()->length(); ++i) { | 143 for (int i = current_block_ + 1; i < graph()->blocks()->length(); ++i) { |
| 145 if (!chunk_->GetLabel(i)->HasReplacement()) return i; | 144 if (!chunk_->GetLabel(i)->HasReplacement()) return i; |
| 146 } | 145 } |
| 147 return -1; | 146 return -1; |
| 148 } | 147 } |
| 149 | 148 |
| 150 | 149 |
| 151 void LCodeGenBase::RegisterWeakObjectsInOptimizedCode(Handle<Code> code) { | 150 void LCodeGenBase::RegisterDependentCodeForEmbeddedMaps(Handle<Code> code) { |
| 152 ASSERT(code->is_optimized_code()); | |
| 153 ZoneList<Handle<Map> > maps(1, zone()); | 151 ZoneList<Handle<Map> > maps(1, zone()); |
| 154 ZoneList<Handle<JSObject> > objects(1, zone()); | 152 ZoneList<Handle<JSObject> > objects(1, zone()); |
| 155 ZoneList<Handle<Cell> > cells(1, zone()); | 153 ZoneList<Handle<Cell> > cells(1, zone()); |
| 156 int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | | 154 int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | |
| 157 RelocInfo::ModeMask(RelocInfo::CELL); | 155 RelocInfo::ModeMask(RelocInfo::CELL); |
| 158 for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) { | 156 for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) { |
| 159 RelocInfo::Mode mode = it.rinfo()->rmode(); | 157 RelocInfo::Mode mode = it.rinfo()->rmode(); |
| 160 if (mode == RelocInfo::CELL && | 158 if (mode == RelocInfo::CELL && |
| 161 code->IsWeakObjectInOptimizedCode(it.rinfo()->target_cell())) { | 159 Code::IsWeakEmbeddedObject(code->kind(), it.rinfo()->target_cell())) { |
| 162 Handle<Cell> cell(it.rinfo()->target_cell()); | 160 Handle<Cell> cell(it.rinfo()->target_cell()); |
| 163 cells.Add(cell, zone()); | 161 cells.Add(cell, zone()); |
| 164 } else if (mode == RelocInfo::EMBEDDED_OBJECT && | 162 } else if (mode == RelocInfo::EMBEDDED_OBJECT && |
| 165 code->IsWeakObjectInOptimizedCode(it.rinfo()->target_object())) { | 163 Code::IsWeakEmbeddedObject(code->kind(), it.rinfo()->target_object())) { |
| 166 if (it.rinfo()->target_object()->IsMap()) { | 164 if (it.rinfo()->target_object()->IsMap()) { |
| 167 Handle<Map> map(Map::cast(it.rinfo()->target_object())); | 165 Handle<Map> map(Map::cast(it.rinfo()->target_object())); |
| 168 maps.Add(map, zone()); | 166 maps.Add(map, zone()); |
| 169 } else if (it.rinfo()->target_object()->IsJSObject()) { | 167 } else if (it.rinfo()->target_object()->IsJSObject()) { |
| 170 Handle<JSObject> object(JSObject::cast(it.rinfo()->target_object())); | 168 Handle<JSObject> object(JSObject::cast(it.rinfo()->target_object())); |
| 171 objects.Add(object, zone()); | 169 objects.Add(object, zone()); |
| 172 } else if (it.rinfo()->target_object()->IsCell()) { | 170 } else if (it.rinfo()->target_object()->IsCell()) { |
| 173 Handle<Cell> cell(Cell::cast(it.rinfo()->target_object())); | 171 Handle<Cell> cell(Cell::cast(it.rinfo()->target_object())); |
| 174 cells.Add(cell, zone()); | 172 cells.Add(cell, zone()); |
| 175 } | 173 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 187 for (int i = 0; i < objects.length(); i++) { | 185 for (int i = 0; i < objects.length(); i++) { |
| 188 AddWeakObjectToCodeDependency(isolate()->heap(), objects.at(i), code); | 186 AddWeakObjectToCodeDependency(isolate()->heap(), objects.at(i), code); |
| 189 } | 187 } |
| 190 for (int i = 0; i < cells.length(); i++) { | 188 for (int i = 0; i < cells.length(); i++) { |
| 191 AddWeakObjectToCodeDependency(isolate()->heap(), cells.at(i), code); | 189 AddWeakObjectToCodeDependency(isolate()->heap(), cells.at(i), code); |
| 192 } | 190 } |
| 193 } | 191 } |
| 194 | 192 |
| 195 | 193 |
| 196 } } // namespace v8::internal | 194 } } // namespace v8::internal |
| OLD | NEW |