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 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 if (output_count_ - 1 == frame_index) iterator->Done(); | 503 if (output_count_ - 1 == frame_index) iterator->Done(); |
504 } | 504 } |
505 | 505 |
506 | 506 |
507 #define __ masm()-> | 507 #define __ masm()-> |
508 | 508 |
509 void Deoptimizer::EntryGenerator::Generate() { | 509 void Deoptimizer::EntryGenerator::Generate() { |
510 GeneratePrologue(); | 510 GeneratePrologue(); |
511 CpuFeatures::Scope scope(SSE2); | 511 CpuFeatures::Scope scope(SSE2); |
512 | 512 |
| 513 Isolate* isolate = masm()->isolate(); |
| 514 |
513 // Save all general purpose registers before messing with them. | 515 // Save all general purpose registers before messing with them. |
514 const int kNumberOfRegisters = Register::kNumRegisters; | 516 const int kNumberOfRegisters = Register::kNumRegisters; |
515 | 517 |
516 const int kDoubleRegsSize = kDoubleSize * | 518 const int kDoubleRegsSize = kDoubleSize * |
517 XMMRegister::kNumAllocatableRegisters; | 519 XMMRegister::kNumAllocatableRegisters; |
518 __ sub(Operand(esp), Immediate(kDoubleRegsSize)); | 520 __ sub(Operand(esp), Immediate(kDoubleRegsSize)); |
519 for (int i = 0; i < XMMRegister::kNumAllocatableRegisters; ++i) { | 521 for (int i = 0; i < XMMRegister::kNumAllocatableRegisters; ++i) { |
520 XMMRegister xmm_reg = XMMRegister::FromAllocationIndex(i); | 522 XMMRegister xmm_reg = XMMRegister::FromAllocationIndex(i); |
521 int offset = i * kDoubleSize; | 523 int offset = i * kDoubleSize; |
522 __ movdbl(Operand(esp, offset), xmm_reg); | 524 __ movdbl(Operand(esp, offset), xmm_reg); |
(...skipping 20 matching lines...) Expand all Loading... |
543 __ neg(edx); | 545 __ neg(edx); |
544 | 546 |
545 // Allocate a new deoptimizer object. | 547 // Allocate a new deoptimizer object. |
546 __ PrepareCallCFunction(5, eax); | 548 __ PrepareCallCFunction(5, eax); |
547 __ mov(eax, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | 549 __ mov(eax, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
548 __ mov(Operand(esp, 0 * kPointerSize), eax); // Function. | 550 __ mov(Operand(esp, 0 * kPointerSize), eax); // Function. |
549 __ mov(Operand(esp, 1 * kPointerSize), Immediate(type())); // Bailout type. | 551 __ mov(Operand(esp, 1 * kPointerSize), Immediate(type())); // Bailout type. |
550 __ mov(Operand(esp, 2 * kPointerSize), ebx); // Bailout id. | 552 __ mov(Operand(esp, 2 * kPointerSize), ebx); // Bailout id. |
551 __ mov(Operand(esp, 3 * kPointerSize), ecx); // Code address or 0. | 553 __ mov(Operand(esp, 3 * kPointerSize), ecx); // Code address or 0. |
552 __ mov(Operand(esp, 4 * kPointerSize), edx); // Fp-to-sp delta. | 554 __ mov(Operand(esp, 4 * kPointerSize), edx); // Fp-to-sp delta. |
553 __ CallCFunction(ExternalReference::new_deoptimizer_function(), 5); | 555 __ CallCFunction(ExternalReference::new_deoptimizer_function(isolate), 5); |
554 | 556 |
555 // Preserve deoptimizer object in register eax and get the input | 557 // Preserve deoptimizer object in register eax and get the input |
556 // frame descriptor pointer. | 558 // frame descriptor pointer. |
557 __ mov(ebx, Operand(eax, Deoptimizer::input_offset())); | 559 __ mov(ebx, Operand(eax, Deoptimizer::input_offset())); |
558 | 560 |
559 // Fill in the input registers. | 561 // Fill in the input registers. |
560 for (int i = kNumberOfRegisters - 1; i >= 0; i--) { | 562 for (int i = kNumberOfRegisters - 1; i >= 0; i--) { |
561 int offset = (i * kPointerSize) + FrameDescription::registers_offset(); | 563 int offset = (i * kPointerSize) + FrameDescription::registers_offset(); |
562 __ pop(Operand(ebx, offset)); | 564 __ pop(Operand(ebx, offset)); |
563 } | 565 } |
(...skipping 27 matching lines...) Expand all Loading... |
591 __ bind(&pop_loop); | 593 __ bind(&pop_loop); |
592 __ pop(Operand(edx, 0)); | 594 __ pop(Operand(edx, 0)); |
593 __ add(Operand(edx), Immediate(sizeof(uint32_t))); | 595 __ add(Operand(edx), Immediate(sizeof(uint32_t))); |
594 __ cmp(ecx, Operand(esp)); | 596 __ cmp(ecx, Operand(esp)); |
595 __ j(not_equal, &pop_loop); | 597 __ j(not_equal, &pop_loop); |
596 | 598 |
597 // Compute the output frame in the deoptimizer. | 599 // Compute the output frame in the deoptimizer. |
598 __ push(eax); | 600 __ push(eax); |
599 __ PrepareCallCFunction(1, ebx); | 601 __ PrepareCallCFunction(1, ebx); |
600 __ mov(Operand(esp, 0 * kPointerSize), eax); | 602 __ mov(Operand(esp, 0 * kPointerSize), eax); |
601 __ CallCFunction(ExternalReference::compute_output_frames_function(), 1); | 603 __ CallCFunction( |
| 604 ExternalReference::compute_output_frames_function(isolate), 1); |
602 __ pop(eax); | 605 __ pop(eax); |
603 | 606 |
604 // Replace the current frame with the output frames. | 607 // Replace the current frame with the output frames. |
605 Label outer_push_loop, inner_push_loop; | 608 Label outer_push_loop, inner_push_loop; |
606 // Outer loop state: eax = current FrameDescription**, edx = one past the | 609 // Outer loop state: eax = current FrameDescription**, edx = one past the |
607 // last FrameDescription**. | 610 // last FrameDescription**. |
608 __ mov(edx, Operand(eax, Deoptimizer::output_count_offset())); | 611 __ mov(edx, Operand(eax, Deoptimizer::output_count_offset())); |
609 __ mov(eax, Operand(eax, Deoptimizer::output_offset())); | 612 __ mov(eax, Operand(eax, Deoptimizer::output_offset())); |
610 __ lea(edx, Operand(eax, edx, times_4, 0)); | 613 __ lea(edx, Operand(eax, edx, times_4, 0)); |
611 __ bind(&outer_push_loop); | 614 __ bind(&outer_push_loop); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 } | 667 } |
665 __ bind(&done); | 668 __ bind(&done); |
666 } | 669 } |
667 | 670 |
668 #undef __ | 671 #undef __ |
669 | 672 |
670 | 673 |
671 } } // namespace v8::internal | 674 } } // namespace v8::internal |
672 | 675 |
673 #endif // V8_TARGET_ARCH_IA32 | 676 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |