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

Side by Side Diff: runtime/vm/flow_graph_compiler_x64.cc

Issue 132163005: Version 1.1.0-dev.5.7 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/dart/
Patch Set: Created 6 years, 11 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 | « runtime/vm/flow_graph_compiler_mips.cc ('k') | runtime/vm/flow_graph_inliner.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 (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64.
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
7 7
8 #include "vm/flow_graph_compiler.h" 8 #include "vm/flow_graph_compiler.h"
9 9
10 #include "vm/ast_printer.h" 10 #include "vm/ast_printer.h"
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 // type check runtime call is the checked value. 715 // type check runtime call is the checked value.
716 __ Drop(6); 716 __ Drop(6);
717 __ popq(RAX); 717 __ popq(RAX);
718 718
719 __ Bind(&is_assignable); 719 __ Bind(&is_assignable);
720 __ popq(RDX); // Remove pushed instantiator type arguments. 720 __ popq(RDX); // Remove pushed instantiator type arguments.
721 __ popq(RCX); // Remove pushed instantiator. 721 __ popq(RCX); // Remove pushed instantiator.
722 } 722 }
723 723
724 724
725 void FlowGraphCompiler::EmitTrySyncMove(intptr_t dest_offset,
726 Location loc,
727 bool* push_emitted) {
728 const Address dest(RBP, dest_offset);
729 if (loc.IsConstant()) {
730 if (!*push_emitted) {
731 __ pushq(RAX);
732 *push_emitted = true;
733 }
734 __ LoadObject(RAX, loc.constant(), PP);
735 __ movq(dest, RAX);
736 } else if (loc.IsRegister()) {
737 if (*push_emitted && loc.reg() == RAX) {
738 __ movq(RAX, Address(RSP, 0));
739 __ movq(dest, RAX);
740 } else {
741 __ movq(dest, loc.reg());
742 }
743 } else {
744 Address src = loc.ToStackSlotAddress();
745 if (!src.Equals(dest)) {
746 if (!*push_emitted) {
747 __ pushq(RAX);
748 *push_emitted = true;
749 }
750 __ movq(RAX, src);
751 __ movq(dest, RAX);
752 }
753 }
754 }
755
756
757 void FlowGraphCompiler::EmitTrySync(Instruction* instr, intptr_t try_index) {
758 ASSERT(is_optimizing());
759 Environment* env = instr->env();
760 CatchBlockEntryInstr* catch_block =
761 flow_graph().graph_entry()->GetCatchEntry(try_index);
762 const GrowableArray<Definition*>* idefs = catch_block->initial_definitions();
763 // Parameters.
764 intptr_t i = 0;
765 bool push_emitted = false;
766 const intptr_t num_non_copied_params = flow_graph().num_non_copied_params();
767 const intptr_t param_base = kParamEndSlotFromFp + num_non_copied_params;
768 for (; i < num_non_copied_params; ++i) {
769 if ((*idefs)[i]->IsConstant()) continue; // Common constants
770 Location loc = env->LocationAt(i);
771 EmitTrySyncMove((param_base - i) * kWordSize, loc, &push_emitted);
772 }
773
774 // Process locals. Skip exception_var and stacktrace_var.
775 intptr_t local_base = kFirstLocalSlotFromFp + num_non_copied_params;
776 intptr_t ex_idx = local_base - catch_block->exception_var().index();
777 intptr_t st_idx = local_base - catch_block->stacktrace_var().index();
778 for (; i < flow_graph().variable_count(); ++i) {
779 if (i == ex_idx || i == st_idx) continue;
780 if ((*idefs)[i]->IsConstant()) continue;
781 Location loc = env->LocationAt(i);
782 EmitTrySyncMove((local_base - i) * kWordSize, loc, &push_emitted);
783 // Update safepoint bitmap to indicate that the target location
784 // now contains a pointer.
785 instr->locs()->stack_bitmap()->Set(i - num_non_copied_params, true);
786 }
787 if (push_emitted) {
788 __ popq(RAX);
789 }
790 }
791
792
793 void FlowGraphCompiler::EmitInstructionEpilogue(Instruction* instr) { 725 void FlowGraphCompiler::EmitInstructionEpilogue(Instruction* instr) {
794 if (is_optimizing()) return; 726 if (is_optimizing()) return;
795 Definition* defn = instr->AsDefinition(); 727 Definition* defn = instr->AsDefinition();
796 if ((defn != NULL) && defn->is_used()) { 728 if ((defn != NULL) && defn->is_used()) {
797 __ pushq(defn->locs()->out().reg()); 729 __ pushq(defn->locs()->out().reg());
798 } 730 }
799 } 731 }
800 732
801 733
802 void FlowGraphCompiler::CopyParameters() { 734 void FlowGraphCompiler::CopyParameters() {
(...skipping 1104 matching lines...) Expand 10 before | Expand all | Expand 10 after
1907 __ movups(reg, Address(RSP, 0)); 1839 __ movups(reg, Address(RSP, 0));
1908 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP); 1840 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP);
1909 } 1841 }
1910 1842
1911 1843
1912 #undef __ 1844 #undef __
1913 1845
1914 } // namespace dart 1846 } // namespace dart
1915 1847
1916 #endif // defined TARGET_ARCH_X64 1848 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_mips.cc ('k') | runtime/vm/flow_graph_inliner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698