OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/compiler/code-generator.h" | 5 #include "src/compiler/code-generator.h" |
6 | 6 |
7 #include "src/arm/macro-assembler-arm.h" | 7 #include "src/arm/macro-assembler-arm.h" |
8 #include "src/compiler/code-generator-impl.h" | 8 #include "src/compiler/code-generator-impl.h" |
9 #include "src/compiler/gap-resolver.h" | 9 #include "src/compiler/gap-resolver.h" |
10 #include "src/compiler/node-matchers.h" | 10 #include "src/compiler/node-matchers.h" |
(...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1233 UNREACHABLE(); | 1233 UNREACHABLE(); |
1234 } | 1234 } |
1235 | 1235 |
1236 | 1236 |
1237 void CodeGenerator::AddNopForSmiCodeInlining() { | 1237 void CodeGenerator::AddNopForSmiCodeInlining() { |
1238 // On 32-bit ARM we do not insert nops for inlined Smi code. | 1238 // On 32-bit ARM we do not insert nops for inlined Smi code. |
1239 } | 1239 } |
1240 | 1240 |
1241 | 1241 |
1242 void CodeGenerator::EnsureSpaceForLazyDeopt() { | 1242 void CodeGenerator::EnsureSpaceForLazyDeopt() { |
| 1243 if (!info()->ShouldEnsureSpaceForLazyDeopt()) { |
| 1244 return; |
| 1245 } |
| 1246 |
1243 int space_needed = Deoptimizer::patch_size(); | 1247 int space_needed = Deoptimizer::patch_size(); |
1244 if (!info()->IsStub()) { | 1248 // Ensure that we have enough space after the previous lazy-bailout |
1245 // Ensure that we have enough space after the previous lazy-bailout | 1249 // instruction for patching the code here. |
1246 // instruction for patching the code here. | 1250 int current_pc = masm()->pc_offset(); |
1247 int current_pc = masm()->pc_offset(); | 1251 if (current_pc < last_lazy_deopt_pc_ + space_needed) { |
1248 if (current_pc < last_lazy_deopt_pc_ + space_needed) { | 1252 // Block literal pool emission for duration of padding. |
1249 // Block literal pool emission for duration of padding. | 1253 v8::internal::Assembler::BlockConstPoolScope block_const_pool(masm()); |
1250 v8::internal::Assembler::BlockConstPoolScope block_const_pool(masm()); | 1254 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; |
1251 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; | 1255 DCHECK_EQ(0, padding_size % v8::internal::Assembler::kInstrSize); |
1252 DCHECK_EQ(0, padding_size % v8::internal::Assembler::kInstrSize); | 1256 while (padding_size > 0) { |
1253 while (padding_size > 0) { | 1257 __ nop(); |
1254 __ nop(); | 1258 padding_size -= v8::internal::Assembler::kInstrSize; |
1255 padding_size -= v8::internal::Assembler::kInstrSize; | |
1256 } | |
1257 } | 1259 } |
1258 } | 1260 } |
1259 } | 1261 } |
1260 | 1262 |
1261 #undef __ | 1263 #undef __ |
1262 | 1264 |
1263 } // namespace compiler | 1265 } // namespace compiler |
1264 } // namespace internal | 1266 } // namespace internal |
1265 } // namespace v8 | 1267 } // namespace v8 |
OLD | NEW |