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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 GenerateBodyInstructionPost(instr); | 117 GenerateBodyInstructionPost(instr); |
118 } | 118 } |
119 EnsureSpaceForLazyDeopt(Deoptimizer::patch_size()); | 119 EnsureSpaceForLazyDeopt(Deoptimizer::patch_size()); |
120 last_lazy_deopt_pc_ = masm()->pc_offset(); | 120 last_lazy_deopt_pc_ = masm()->pc_offset(); |
121 return !is_aborted(); | 121 return !is_aborted(); |
122 } | 122 } |
123 | 123 |
124 | 124 |
125 void LCodeGenBase::CheckEnvironmentUsage() { | 125 void LCodeGenBase::CheckEnvironmentUsage() { |
126 #ifdef DEBUG | 126 #ifdef DEBUG |
127 bool live_block = true; | 127 bool dead_block = false; |
128 for (int i = 0; i < instructions_->length(); i++) { | 128 for (int i = 0; i < instructions_->length(); i++) { |
129 LInstruction* instr = instructions_->at(i); | 129 LInstruction* instr = instructions_->at(i); |
130 if (instr->IsLabel()) live_block = !LLabel::cast(instr)->HasReplacement(); | 130 HValue* hval = instr->hydrogen_value(); |
131 if (live_block && | 131 if (instr->IsLabel()) dead_block = LLabel::cast(instr)->HasReplacement(); |
132 instr->hydrogen_value()->block()->IsReachable() && | 132 if (dead_block || !hval->block()->IsReachable()) continue; |
133 instr->HasEnvironment() && | 133 |
134 !instr->environment()->has_been_used()) { | 134 HInstruction* hinstr = HInstruction::cast(hval); |
135 FunctionLiteral* lit = info_->function(); | 135 if (!hinstr->CanDeoptimize() && instr->HasEnvironment()) { |
136 V8_Fatal(__FILE__, __LINE__, "unused environment in %s <@%d,#%d> %s\n", | 136 V8_Fatal(__FILE__, __LINE__, "CanDeoptimize is wrong for %s (%s)\n", |
137 lit == NULL ? "<UNKNOWN>" : lit->name()->ToCString().get(), | 137 hinstr->Mnemonic(), instr->Mnemonic()); |
138 i, instr->hydrogen_value()->id(), instr->Mnemonic()); | 138 } |
| 139 |
| 140 if (instr->HasEnvironment() && !instr->environment()->has_been_used()) { |
| 141 V8_Fatal(__FILE__, __LINE__, "unused environment for %s (%s)\n", |
| 142 hinstr->Mnemonic(), instr->Mnemonic()); |
139 } | 143 } |
140 } | 144 } |
141 #endif | 145 #endif |
142 } | 146 } |
143 | 147 |
144 | 148 |
145 void LCodeGenBase::Comment(const char* format, ...) { | 149 void LCodeGenBase::Comment(const char* format, ...) { |
146 if (!FLAG_code_comments) return; | 150 if (!FLAG_code_comments) return; |
147 char buffer[4 * KB]; | 151 char buffer[4 * KB]; |
148 StringBuilder builder(buffer, ARRAY_SIZE(buffer)); | 152 StringBuilder builder(buffer, ARRAY_SIZE(buffer)); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 for (int i = 0; i < objects.length(); i++) { | 212 for (int i = 0; i < objects.length(); i++) { |
209 AddWeakObjectToCodeDependency(isolate()->heap(), objects.at(i), code); | 213 AddWeakObjectToCodeDependency(isolate()->heap(), objects.at(i), code); |
210 } | 214 } |
211 for (int i = 0; i < cells.length(); i++) { | 215 for (int i = 0; i < cells.length(); i++) { |
212 AddWeakObjectToCodeDependency(isolate()->heap(), cells.at(i), code); | 216 AddWeakObjectToCodeDependency(isolate()->heap(), cells.at(i), code); |
213 } | 217 } |
214 } | 218 } |
215 | 219 |
216 | 220 |
217 } } // namespace v8::internal | 221 } } // namespace v8::internal |
OLD | NEW |