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

Side by Side Diff: src/arm/deoptimizer-arm.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/arm/code-stubs-arm.cc ('k') | src/arm/macro-assembler-arm.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 } 597 }
598 598
599 599
600 #define __ masm()-> 600 #define __ masm()->
601 601
602 // This code tries to be close to ia32 code so that any changes can be 602 // This code tries to be close to ia32 code so that any changes can be
603 // easily ported. 603 // easily ported.
604 void Deoptimizer::EntryGenerator::Generate() { 604 void Deoptimizer::EntryGenerator::Generate() {
605 GeneratePrologue(); 605 GeneratePrologue();
606 606
607 Isolate* isolate = masm()->isolate();
608
609 // Save all general purpose registers before messing with them. 607 // Save all general purpose registers before messing with them.
610 const int kNumberOfRegisters = Register::kNumRegisters; 608 const int kNumberOfRegisters = Register::kNumRegisters;
611 609
612 // Everything but pc, lr and ip which will be saved but not restored. 610 // Everything but pc, lr and ip which will be saved but not restored.
613 RegList restored_regs = kJSCallerSaved | kCalleeSaved | ip.bit(); 611 RegList restored_regs = kJSCallerSaved | kCalleeSaved | ip.bit();
614 612
615 const int kDoubleRegsSize = 613 const int kDoubleRegsSize =
616 kDoubleSize * DwVfpRegister::kMaxNumAllocatableRegisters; 614 kDoubleSize * DwVfpRegister::kMaxNumAllocatableRegisters;
617 615
618 // Save all allocatable VFP registers before messing with them. 616 // Save all allocatable VFP registers before messing with them.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 __ sub(r4, fp, r4); 656 __ sub(r4, fp, r4);
659 657
660 // Allocate a new deoptimizer object. 658 // Allocate a new deoptimizer object.
661 // Pass four arguments in r0 to r3 and fifth argument on stack. 659 // Pass four arguments in r0 to r3 and fifth argument on stack.
662 __ PrepareCallCFunction(6, r5); 660 __ PrepareCallCFunction(6, r5);
663 __ ldr(r0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 661 __ ldr(r0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
664 __ mov(r1, Operand(type())); // bailout type, 662 __ mov(r1, Operand(type())); // bailout type,
665 // r2: bailout id already loaded. 663 // r2: bailout id already loaded.
666 // r3: code address or 0 already loaded. 664 // r3: code address or 0 already loaded.
667 __ str(r4, MemOperand(sp, 0 * kPointerSize)); // Fp-to-sp delta. 665 __ str(r4, MemOperand(sp, 0 * kPointerSize)); // Fp-to-sp delta.
668 __ mov(r5, Operand(ExternalReference::isolate_address())); 666 __ mov(r5, Operand(ExternalReference::isolate_address(isolate())));
669 __ str(r5, MemOperand(sp, 1 * kPointerSize)); // Isolate. 667 __ str(r5, MemOperand(sp, 1 * kPointerSize)); // Isolate.
670 // Call Deoptimizer::New(). 668 // Call Deoptimizer::New().
671 { 669 {
672 AllowExternalCallThatCantCauseGC scope(masm()); 670 AllowExternalCallThatCantCauseGC scope(masm());
673 __ CallCFunction(ExternalReference::new_deoptimizer_function(isolate), 6); 671 __ CallCFunction(ExternalReference::new_deoptimizer_function(isolate()), 6);
674 } 672 }
675 673
676 // Preserve "deoptimizer" object in register r0 and get the input 674 // Preserve "deoptimizer" object in register r0 and get the input
677 // frame descriptor pointer to r1 (deoptimizer->input_); 675 // frame descriptor pointer to r1 (deoptimizer->input_);
678 __ ldr(r1, MemOperand(r0, Deoptimizer::input_offset())); 676 __ ldr(r1, MemOperand(r0, Deoptimizer::input_offset()));
679 677
680 // Copy core registers into FrameDescription::registers_[kNumRegisters]. 678 // Copy core registers into FrameDescription::registers_[kNumRegisters].
681 ASSERT(Register::kNumRegisters == kNumberOfRegisters); 679 ASSERT(Register::kNumRegisters == kNumberOfRegisters);
682 for (int i = 0; i < kNumberOfRegisters; i++) { 680 for (int i = 0; i < kNumberOfRegisters; i++) {
683 int offset = (i * kPointerSize) + FrameDescription::registers_offset(); 681 int offset = (i * kPointerSize) + FrameDescription::registers_offset();
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 __ b(ne, &pop_loop); 722 __ b(ne, &pop_loop);
725 723
726 // Compute the output frame in the deoptimizer. 724 // Compute the output frame in the deoptimizer.
727 __ push(r0); // Preserve deoptimizer object across call. 725 __ push(r0); // Preserve deoptimizer object across call.
728 // r0: deoptimizer object; r1: scratch. 726 // r0: deoptimizer object; r1: scratch.
729 __ PrepareCallCFunction(1, r1); 727 __ PrepareCallCFunction(1, r1);
730 // Call Deoptimizer::ComputeOutputFrames(). 728 // Call Deoptimizer::ComputeOutputFrames().
731 { 729 {
732 AllowExternalCallThatCantCauseGC scope(masm()); 730 AllowExternalCallThatCantCauseGC scope(masm());
733 __ CallCFunction( 731 __ CallCFunction(
734 ExternalReference::compute_output_frames_function(isolate), 1); 732 ExternalReference::compute_output_frames_function(isolate()), 1);
735 } 733 }
736 __ pop(r0); // Restore deoptimizer object (class Deoptimizer). 734 __ pop(r0); // Restore deoptimizer object (class Deoptimizer).
737 735
738 // Replace the current (input) frame with the output frames. 736 // Replace the current (input) frame with the output frames.
739 Label outer_push_loop, inner_push_loop, 737 Label outer_push_loop, inner_push_loop,
740 outer_loop_header, inner_loop_header; 738 outer_loop_header, inner_loop_header;
741 // Outer loop state: r4 = current "FrameDescription** output_", 739 // Outer loop state: r4 = current "FrameDescription** output_",
742 // r1 = one past the last FrameDescription**. 740 // r1 = one past the last FrameDescription**.
743 __ ldr(r1, MemOperand(r0, Deoptimizer::output_count_offset())); 741 __ ldr(r1, MemOperand(r0, Deoptimizer::output_count_offset()));
744 __ ldr(r4, MemOperand(r0, Deoptimizer::output_offset())); // r4 is output_. 742 __ ldr(r4, MemOperand(r0, Deoptimizer::output_offset())); // r4 is output_.
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 __ push(ip); 824 __ push(ip);
827 __ b(&done); 825 __ b(&done);
828 ASSERT(masm()->pc_offset() - start == table_entry_size_); 826 ASSERT(masm()->pc_offset() - start == table_entry_size_);
829 } 827 }
830 __ bind(&done); 828 __ bind(&done);
831 } 829 }
832 830
833 #undef __ 831 #undef __
834 832
835 } } // namespace v8::internal 833 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/code-stubs-arm.cc ('k') | src/arm/macro-assembler-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698