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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 __ Br(continuation); | 333 __ Br(continuation); |
334 } | 334 } |
335 | 335 |
336 | 336 |
337 // Size of an entry of the second level deopt table. | 337 // Size of an entry of the second level deopt table. |
338 // This is the code size generated by GeneratePrologue for one entry. | 338 // This is the code size generated by GeneratePrologue for one entry. |
339 const int Deoptimizer::table_entry_size_ = 2 * kInstructionSize; | 339 const int Deoptimizer::table_entry_size_ = 2 * kInstructionSize; |
340 | 340 |
341 | 341 |
342 void Deoptimizer::TableEntryGenerator::GeneratePrologue() { | 342 void Deoptimizer::TableEntryGenerator::GeneratePrologue() { |
| 343 UseScratchRegisterScope temps(masm()); |
| 344 Register entry_id = temps.AcquireX(); |
| 345 |
343 // Create a sequence of deoptimization entries. | 346 // Create a sequence of deoptimization entries. |
344 // Note that registers are still live when jumping to an entry. | 347 // Note that registers are still live when jumping to an entry. |
345 Label done; | 348 Label done; |
346 { | 349 { |
347 InstructionAccurateScope scope(masm()); | 350 InstructionAccurateScope scope(masm()); |
348 | 351 |
349 // The number of entry will never exceed kMaxNumberOfEntries. | 352 // The number of entry will never exceed kMaxNumberOfEntries. |
350 // As long as kMaxNumberOfEntries is a valid 16 bits immediate you can use | 353 // As long as kMaxNumberOfEntries is a valid 16 bits immediate you can use |
351 // a movz instruction to load the entry id. | 354 // a movz instruction to load the entry id. |
352 ASSERT(is_uint16(Deoptimizer::kMaxNumberOfEntries)); | 355 ASSERT(is_uint16(Deoptimizer::kMaxNumberOfEntries)); |
353 | 356 |
354 for (int i = 0; i < count(); i++) { | 357 for (int i = 0; i < count(); i++) { |
355 int start = masm()->pc_offset(); | 358 int start = masm()->pc_offset(); |
356 USE(start); | 359 USE(start); |
357 __ movz(masm()->Tmp0(), i); | 360 __ movz(entry_id, i); |
358 __ b(&done); | 361 __ b(&done); |
359 ASSERT(masm()->pc_offset() - start == table_entry_size_); | 362 ASSERT(masm()->pc_offset() - start == table_entry_size_); |
360 } | 363 } |
361 } | 364 } |
362 __ Bind(&done); | 365 __ Bind(&done); |
363 // TODO(all): We need to add some kind of assertion to verify that Tmp0() | 366 __ Push(entry_id); |
364 // is not clobbered by Push. | |
365 __ Push(masm()->Tmp0()); | |
366 } | 367 } |
367 | 368 |
368 | 369 |
369 void FrameDescription::SetCallerPc(unsigned offset, intptr_t value) { | 370 void FrameDescription::SetCallerPc(unsigned offset, intptr_t value) { |
370 SetFrameSlot(offset, value); | 371 SetFrameSlot(offset, value); |
371 } | 372 } |
372 | 373 |
373 | 374 |
374 void FrameDescription::SetCallerFp(unsigned offset, intptr_t value) { | 375 void FrameDescription::SetCallerFp(unsigned offset, intptr_t value) { |
375 SetFrameSlot(offset, value); | 376 SetFrameSlot(offset, value); |
376 } | 377 } |
377 | 378 |
378 | 379 |
379 #undef __ | 380 #undef __ |
380 | 381 |
381 } } // namespace v8::internal | 382 } } // namespace v8::internal |
OLD | NEW |