| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/lithium-codegen.h" | 7 #include "src/lithium-codegen.h" |
| 8 | 8 |
| 9 #if V8_TARGET_ARCH_IA32 | 9 #if V8_TARGET_ARCH_IA32 |
| 10 #include "src/ia32/lithium-ia32.h" // NOLINT | 10 #include "src/ia32/lithium-ia32.h" // NOLINT |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 zone_(info->zone()), | 49 zone_(info->zone()), |
| 50 status_(UNUSED), | 50 status_(UNUSED), |
| 51 current_block_(-1), | 51 current_block_(-1), |
| 52 current_instruction_(-1), | 52 current_instruction_(-1), |
| 53 instructions_(chunk->instructions()), | 53 instructions_(chunk->instructions()), |
| 54 last_lazy_deopt_pc_(0) { | 54 last_lazy_deopt_pc_(0) { |
| 55 } | 55 } |
| 56 | 56 |
| 57 | 57 |
| 58 bool LCodeGenBase::GenerateBody() { | 58 bool LCodeGenBase::GenerateBody() { |
| 59 ASSERT(is_generating()); | 59 DCHECK(is_generating()); |
| 60 bool emit_instructions = true; | 60 bool emit_instructions = true; |
| 61 LCodeGen* codegen = static_cast<LCodeGen*>(this); | 61 LCodeGen* codegen = static_cast<LCodeGen*>(this); |
| 62 for (current_instruction_ = 0; | 62 for (current_instruction_ = 0; |
| 63 !is_aborted() && current_instruction_ < instructions_->length(); | 63 !is_aborted() && current_instruction_ < instructions_->length(); |
| 64 current_instruction_++) { | 64 current_instruction_++) { |
| 65 LInstruction* instr = instructions_->at(current_instruction_); | 65 LInstruction* instr = instructions_->at(current_instruction_); |
| 66 | 66 |
| 67 // Don't emit code for basic blocks with a replacement. | 67 // Don't emit code for basic blocks with a replacement. |
| 68 if (instr->IsLabel()) { | 68 if (instr->IsLabel()) { |
| 69 emit_instructions = !LLabel::cast(instr)->HasReplacement() && | 69 emit_instructions = !LLabel::cast(instr)->HasReplacement() && |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 Handle<Code> code) { | 161 Handle<Code> code) { |
| 162 Heap* heap = isolate->heap(); | 162 Heap* heap = isolate->heap(); |
| 163 heap->EnsureWeakObjectToCodeTable(); | 163 heap->EnsureWeakObjectToCodeTable(); |
| 164 Handle<DependentCode> dep(heap->LookupWeakObjectToCodeDependency(object)); | 164 Handle<DependentCode> dep(heap->LookupWeakObjectToCodeDependency(object)); |
| 165 dep = DependentCode::Insert(dep, DependentCode::kWeakCodeGroup, code); | 165 dep = DependentCode::Insert(dep, DependentCode::kWeakCodeGroup, code); |
| 166 heap->AddWeakObjectToCodeDependency(object, dep); | 166 heap->AddWeakObjectToCodeDependency(object, dep); |
| 167 } | 167 } |
| 168 | 168 |
| 169 | 169 |
| 170 void LCodeGenBase::RegisterWeakObjectsInOptimizedCode(Handle<Code> code) { | 170 void LCodeGenBase::RegisterWeakObjectsInOptimizedCode(Handle<Code> code) { |
| 171 ASSERT(code->is_optimized_code()); | 171 DCHECK(code->is_optimized_code()); |
| 172 ZoneList<Handle<Map> > maps(1, zone()); | 172 ZoneList<Handle<Map> > maps(1, zone()); |
| 173 ZoneList<Handle<JSObject> > objects(1, zone()); | 173 ZoneList<Handle<JSObject> > objects(1, zone()); |
| 174 ZoneList<Handle<Cell> > cells(1, zone()); | 174 ZoneList<Handle<Cell> > cells(1, zone()); |
| 175 int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | | 175 int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | |
| 176 RelocInfo::ModeMask(RelocInfo::CELL); | 176 RelocInfo::ModeMask(RelocInfo::CELL); |
| 177 for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) { | 177 for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) { |
| 178 RelocInfo::Mode mode = it.rinfo()->rmode(); | 178 RelocInfo::Mode mode = it.rinfo()->rmode(); |
| 179 if (mode == RelocInfo::CELL && | 179 if (mode == RelocInfo::CELL && |
| 180 code->IsWeakObjectInOptimizedCode(it.rinfo()->target_cell())) { | 180 code->IsWeakObjectInOptimizedCode(it.rinfo()->target_cell())) { |
| 181 Handle<Cell> cell(it.rinfo()->target_cell()); | 181 Handle<Cell> cell(it.rinfo()->target_cell()); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 chunk_->AddDeprecationDependency(map); | 227 chunk_->AddDeprecationDependency(map); |
| 228 } | 228 } |
| 229 | 229 |
| 230 | 230 |
| 231 void LCodeGenBase::AddStabilityDependency(Handle<Map> map) { | 231 void LCodeGenBase::AddStabilityDependency(Handle<Map> map) { |
| 232 if (!map->is_stable()) return Abort(kMapBecameUnstable); | 232 if (!map->is_stable()) return Abort(kMapBecameUnstable); |
| 233 chunk_->AddStabilityDependency(map); | 233 chunk_->AddStabilityDependency(map); |
| 234 } | 234 } |
| 235 | 235 |
| 236 } } // namespace v8::internal | 236 } } // namespace v8::internal |
| OLD | NEW |