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