Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(259)

Side by Side Diff: src/mips/deoptimizer-mips.cc

Issue 14429003: Refactor ExternalReference::isolate_address() to not rely on Isolate::Current(). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/mips/code-stubs-mips.cc ('k') | src/mips/macro-assembler-mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 584
585 585
586 #define __ masm()-> 586 #define __ masm()->
587 587
588 588
589 // This code tries to be close to ia32 code so that any changes can be 589 // This code tries to be close to ia32 code so that any changes can be
590 // easily ported. 590 // easily ported.
591 void Deoptimizer::EntryGenerator::Generate() { 591 void Deoptimizer::EntryGenerator::Generate() {
592 GeneratePrologue(); 592 GeneratePrologue();
593 593
594 Isolate* isolate = masm()->isolate();
595
596 // Unlike on ARM we don't save all the registers, just the useful ones. 594 // Unlike on ARM we don't save all the registers, just the useful ones.
597 // For the rest, there are gaps on the stack, so the offsets remain the same. 595 // For the rest, there are gaps on the stack, so the offsets remain the same.
598 const int kNumberOfRegisters = Register::kNumRegisters; 596 const int kNumberOfRegisters = Register::kNumRegisters;
599 597
600 RegList restored_regs = kJSCallerSaved | kCalleeSaved; 598 RegList restored_regs = kJSCallerSaved | kCalleeSaved;
601 RegList saved_regs = restored_regs | sp.bit() | ra.bit(); 599 RegList saved_regs = restored_regs | sp.bit() | ra.bit();
602 600
603 const int kDoubleRegsSize = 601 const int kDoubleRegsSize =
604 kDoubleSize * FPURegister::kMaxNumAllocatableRegisters; 602 kDoubleSize * FPURegister::kMaxNumAllocatableRegisters;
605 603
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 __ Subu(t0, fp, t0); 644 __ Subu(t0, fp, t0);
647 645
648 // Allocate a new deoptimizer object. 646 // Allocate a new deoptimizer object.
649 // Pass four arguments in a0 to a3 and fifth & sixth arguments on stack. 647 // Pass four arguments in a0 to a3 and fifth & sixth arguments on stack.
650 __ PrepareCallCFunction(6, t1); 648 __ PrepareCallCFunction(6, t1);
651 __ lw(a0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 649 __ lw(a0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
652 __ li(a1, Operand(type())); // bailout type, 650 __ li(a1, Operand(type())); // bailout type,
653 // a2: bailout id already loaded. 651 // a2: bailout id already loaded.
654 // a3: code address or 0 already loaded. 652 // a3: code address or 0 already loaded.
655 __ sw(t0, CFunctionArgumentOperand(5)); // Fp-to-sp delta. 653 __ sw(t0, CFunctionArgumentOperand(5)); // Fp-to-sp delta.
656 __ li(t1, Operand(ExternalReference::isolate_address())); 654 __ li(t1, Operand(ExternalReference::isolate_address(isolate())));
657 __ sw(t1, CFunctionArgumentOperand(6)); // Isolate. 655 __ sw(t1, CFunctionArgumentOperand(6)); // Isolate.
658 // Call Deoptimizer::New(). 656 // Call Deoptimizer::New().
659 { 657 {
660 AllowExternalCallThatCantCauseGC scope(masm()); 658 AllowExternalCallThatCantCauseGC scope(masm());
661 __ CallCFunction(ExternalReference::new_deoptimizer_function(isolate), 6); 659 __ CallCFunction(ExternalReference::new_deoptimizer_function(isolate()), 6);
662 } 660 }
663 661
664 // Preserve "deoptimizer" object in register v0 and get the input 662 // Preserve "deoptimizer" object in register v0 and get the input
665 // frame descriptor pointer to a1 (deoptimizer->input_); 663 // frame descriptor pointer to a1 (deoptimizer->input_);
666 // Move deopt-obj to a0 for call to Deoptimizer::ComputeOutputFrames() below. 664 // Move deopt-obj to a0 for call to Deoptimizer::ComputeOutputFrames() below.
667 __ mov(a0, v0); 665 __ mov(a0, v0);
668 __ lw(a1, MemOperand(v0, Deoptimizer::input_offset())); 666 __ lw(a1, MemOperand(v0, Deoptimizer::input_offset()));
669 667
670 // Copy core registers into FrameDescription::registers_[kNumRegisters]. 668 // Copy core registers into FrameDescription::registers_[kNumRegisters].
671 ASSERT(Register::kNumRegisters == kNumberOfRegisters); 669 ASSERT(Register::kNumRegisters == kNumberOfRegisters);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 __ Branch(&pop_loop, ne, a2, Operand(sp)); 716 __ Branch(&pop_loop, ne, a2, Operand(sp));
719 717
720 // Compute the output frame in the deoptimizer. 718 // Compute the output frame in the deoptimizer.
721 __ push(a0); // Preserve deoptimizer object across call. 719 __ push(a0); // Preserve deoptimizer object across call.
722 // a0: deoptimizer object; a1: scratch. 720 // a0: deoptimizer object; a1: scratch.
723 __ PrepareCallCFunction(1, a1); 721 __ PrepareCallCFunction(1, a1);
724 // Call Deoptimizer::ComputeOutputFrames(). 722 // Call Deoptimizer::ComputeOutputFrames().
725 { 723 {
726 AllowExternalCallThatCantCauseGC scope(masm()); 724 AllowExternalCallThatCantCauseGC scope(masm());
727 __ CallCFunction( 725 __ CallCFunction(
728 ExternalReference::compute_output_frames_function(isolate), 1); 726 ExternalReference::compute_output_frames_function(isolate()), 1);
729 } 727 }
730 __ pop(a0); // Restore deoptimizer object (class Deoptimizer). 728 __ pop(a0); // Restore deoptimizer object (class Deoptimizer).
731 729
732 // Replace the current (input) frame with the output frames. 730 // Replace the current (input) frame with the output frames.
733 Label outer_push_loop, inner_push_loop, 731 Label outer_push_loop, inner_push_loop,
734 outer_loop_header, inner_loop_header; 732 outer_loop_header, inner_loop_header;
735 // Outer loop state: t0 = current "FrameDescription** output_", 733 // Outer loop state: t0 = current "FrameDescription** output_",
736 // a1 = one past the last FrameDescription**. 734 // a1 = one past the last FrameDescription**.
737 __ lw(a1, MemOperand(a0, Deoptimizer::output_count_offset())); 735 __ lw(a1, MemOperand(a0, Deoptimizer::output_count_offset()));
738 __ lw(t0, MemOperand(a0, Deoptimizer::output_offset())); // t0 is output_. 736 __ lw(t0, MemOperand(a0, Deoptimizer::output_offset())); // t0 is output_.
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
835 } 833 }
836 834
837 ASSERT_EQ(masm()->SizeOfCodeGeneratedSince(&table_start), 835 ASSERT_EQ(masm()->SizeOfCodeGeneratedSince(&table_start),
838 count() * table_entry_size_); 836 count() * table_entry_size_);
839 } 837 }
840 838
841 #undef __ 839 #undef __
842 840
843 841
844 } } // namespace v8::internal 842 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mips/code-stubs-mips.cc ('k') | src/mips/macro-assembler-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698