OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 for (int i = 0; i < jump_table_.length(); i++) { | 268 for (int i = 0; i < jump_table_.length(); i++) { |
269 __ bind(&jump_table_[i].label); | 269 __ bind(&jump_table_[i].label); |
270 __ Jump(jump_table_[i].address, RelocInfo::RUNTIME_ENTRY); | 270 __ Jump(jump_table_[i].address, RelocInfo::RUNTIME_ENTRY); |
271 } | 271 } |
272 return !is_aborted(); | 272 return !is_aborted(); |
273 } | 273 } |
274 | 274 |
275 | 275 |
276 bool LCodeGen::GenerateDeferredCode() { | 276 bool LCodeGen::GenerateDeferredCode() { |
277 ASSERT(is_generating()); | 277 ASSERT(is_generating()); |
278 Label last_jump; | |
279 if (deferred_.length() > 0) { | 278 if (deferred_.length() > 0) { |
280 for (int i = 0; !is_aborted() && i < deferred_.length(); i++) { | 279 for (int i = 0; !is_aborted() && i < deferred_.length(); i++) { |
281 LDeferredCode* code = deferred_[i]; | 280 LDeferredCode* code = deferred_[i]; |
282 __ bind(code->entry()); | 281 __ bind(code->entry()); |
283 code->Generate(); | 282 code->Generate(); |
284 #ifdef DEBUG | |
285 if (i == (deferred_.length() - 1)) { | |
286 __ bind(&last_jump); | |
287 } | |
288 #endif | |
289 __ jmp(code->exit()); | 283 __ jmp(code->exit()); |
290 } | 284 } |
291 | 285 |
292 // Reserve some space to ensure that the last piece of deferred code | 286 // Pad code to ensure that the last piece of deferred code have |
293 // have room for lazy bailout. | 287 // room for lazy bailout. |
294 int padding = | 288 while ((masm()->pc_offset() - LastSafepointEnd()) |
295 Deoptimizer::patch_size() - masm_->SizeOfCodeGeneratedSince(&last_jump); | 289 < Deoptimizer::patch_size()) { |
296 if (padding > 0) { | 290 int padding = masm()->pc_offset() - LastSafepointEnd(); |
297 while (padding > 9) { | 291 if (padding > 9) { |
298 __ nop(9); | 292 __ nop(9); |
299 padding -= 9; | 293 } else { |
| 294 __ nop(padding); |
300 } | 295 } |
301 __ nop(padding); | |
302 } | 296 } |
303 | |
304 ASSERT(Deoptimizer::patch_size() <= | |
305 masm_->SizeOfCodeGeneratedSince(&last_jump)); | |
306 } | 297 } |
307 | 298 |
308 // Deferred code is the last part of the instruction sequence. Mark | 299 // Deferred code is the last part of the instruction sequence. Mark |
309 // the generated code as done unless we bailed out. | 300 // the generated code as done unless we bailed out. |
310 if (!is_aborted()) status_ = DONE; | 301 if (!is_aborted()) status_ = DONE; |
311 return !is_aborted(); | 302 return !is_aborted(); |
312 } | 303 } |
313 | 304 |
314 | 305 |
315 bool LCodeGen::GenerateSafepointTable() { | 306 bool LCodeGen::GenerateSafepointTable() { |
(...skipping 3752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4068 RegisterEnvironmentForDeoptimization(environment); | 4059 RegisterEnvironmentForDeoptimization(environment); |
4069 ASSERT(osr_pc_offset_ == -1); | 4060 ASSERT(osr_pc_offset_ == -1); |
4070 osr_pc_offset_ = masm()->pc_offset(); | 4061 osr_pc_offset_ = masm()->pc_offset(); |
4071 } | 4062 } |
4072 | 4063 |
4073 #undef __ | 4064 #undef __ |
4074 | 4065 |
4075 } } // namespace v8::internal | 4066 } } // namespace v8::internal |
4076 | 4067 |
4077 #endif // V8_TARGET_ARCH_X64 | 4068 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |