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

Side by Side Diff: src/arm/virtual-frame-arm.cc

Issue 2249002: Fix jump targets on ARM to merge virtual frames (really this time).... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 6 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/virtual-frame-arm.h ('k') | src/codegen.h » ('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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 VirtualFrame where_to_go = *this; 65 VirtualFrame where_to_go = *this;
66 // Shuffle things around so the top of stack only in r0. 66 // Shuffle things around so the top of stack only in r0.
67 where_to_go.top_of_stack_state_ = R0_TOS; 67 where_to_go.top_of_stack_state_ = R0_TOS;
68 MergeTo(&where_to_go); 68 MergeTo(&where_to_go);
69 // Pop the register off the stack so it is detached from the frame. 69 // Pop the register off the stack so it is detached from the frame.
70 element_count_ -= 1; 70 element_count_ -= 1;
71 top_of_stack_state_ = NO_TOS_REGISTERS; 71 top_of_stack_state_ = NO_TOS_REGISTERS;
72 } 72 }
73 73
74 74
75 void VirtualFrame::MergeTo(VirtualFrame* expected) { 75 void VirtualFrame::MergeTo(const VirtualFrame* expected, Condition cond) {
76 if (Equals(expected)) return; 76 if (Equals(expected)) return;
77 MergeTOSTo(expected->top_of_stack_state_); 77 MergeTOSTo(expected->top_of_stack_state_, cond);
78 ASSERT(register_allocation_map_ == expected->register_allocation_map_); 78 ASSERT(register_allocation_map_ == expected->register_allocation_map_);
79 } 79 }
80 80
81 81
82 void VirtualFrame::MergeTOSTo( 82 void VirtualFrame::MergeTOSTo(
83 VirtualFrame::TopOfStack expected_top_of_stack_state) { 83 VirtualFrame::TopOfStack expected_top_of_stack_state, Condition cond) {
84 #define CASE_NUMBER(a, b) ((a) * TOS_STATES + (b)) 84 #define CASE_NUMBER(a, b) ((a) * TOS_STATES + (b))
85 switch (CASE_NUMBER(top_of_stack_state_, expected_top_of_stack_state)) { 85 switch (CASE_NUMBER(top_of_stack_state_, expected_top_of_stack_state)) {
86 case CASE_NUMBER(NO_TOS_REGISTERS, NO_TOS_REGISTERS): 86 case CASE_NUMBER(NO_TOS_REGISTERS, NO_TOS_REGISTERS):
87 break; 87 break;
88 case CASE_NUMBER(NO_TOS_REGISTERS, R0_TOS): 88 case CASE_NUMBER(NO_TOS_REGISTERS, R0_TOS):
89 __ pop(r0); 89 __ pop(r0, cond);
90 break; 90 break;
91 case CASE_NUMBER(NO_TOS_REGISTERS, R1_TOS): 91 case CASE_NUMBER(NO_TOS_REGISTERS, R1_TOS):
92 __ pop(r1); 92 __ pop(r1, cond);
93 break; 93 break;
94 case CASE_NUMBER(NO_TOS_REGISTERS, R0_R1_TOS): 94 case CASE_NUMBER(NO_TOS_REGISTERS, R0_R1_TOS):
95 __ pop(r0); 95 __ pop(r0, cond);
96 __ pop(r1); 96 __ pop(r1, cond);
97 break; 97 break;
98 case CASE_NUMBER(NO_TOS_REGISTERS, R1_R0_TOS): 98 case CASE_NUMBER(NO_TOS_REGISTERS, R1_R0_TOS):
99 __ pop(r1); 99 __ pop(r1, cond);
100 __ pop(r0); 100 __ pop(r0, cond);
101 break; 101 break;
102 case CASE_NUMBER(R0_TOS, NO_TOS_REGISTERS): 102 case CASE_NUMBER(R0_TOS, NO_TOS_REGISTERS):
103 __ push(r0); 103 __ push(r0, cond);
104 break; 104 break;
105 case CASE_NUMBER(R0_TOS, R0_TOS): 105 case CASE_NUMBER(R0_TOS, R0_TOS):
106 break; 106 break;
107 case CASE_NUMBER(R0_TOS, R1_TOS): 107 case CASE_NUMBER(R0_TOS, R1_TOS):
108 __ mov(r1, r0); 108 __ mov(r1, r0, LeaveCC, cond);
109 break; 109 break;
110 case CASE_NUMBER(R0_TOS, R0_R1_TOS): 110 case CASE_NUMBER(R0_TOS, R0_R1_TOS):
111 __ pop(r1); 111 __ pop(r1, cond);
112 break; 112 break;
113 case CASE_NUMBER(R0_TOS, R1_R0_TOS): 113 case CASE_NUMBER(R0_TOS, R1_R0_TOS):
114 __ mov(r1, r0); 114 __ mov(r1, r0, LeaveCC, cond);
115 __ pop(r0); 115 __ pop(r0, cond);
116 break; 116 break;
117 case CASE_NUMBER(R1_TOS, NO_TOS_REGISTERS): 117 case CASE_NUMBER(R1_TOS, NO_TOS_REGISTERS):
118 __ push(r1); 118 __ push(r1, cond);
119 break; 119 break;
120 case CASE_NUMBER(R1_TOS, R0_TOS): 120 case CASE_NUMBER(R1_TOS, R0_TOS):
121 __ mov(r0, r1); 121 __ mov(r0, r1, LeaveCC, cond);
122 break; 122 break;
123 case CASE_NUMBER(R1_TOS, R1_TOS): 123 case CASE_NUMBER(R1_TOS, R1_TOS):
124 break; 124 break;
125 case CASE_NUMBER(R1_TOS, R0_R1_TOS): 125 case CASE_NUMBER(R1_TOS, R0_R1_TOS):
126 __ mov(r0, r1); 126 __ mov(r0, r1, LeaveCC, cond);
127 __ pop(r1); 127 __ pop(r1, cond);
128 break; 128 break;
129 case CASE_NUMBER(R1_TOS, R1_R0_TOS): 129 case CASE_NUMBER(R1_TOS, R1_R0_TOS):
130 __ pop(r0); 130 __ pop(r0, cond);
131 break; 131 break;
132 case CASE_NUMBER(R0_R1_TOS, NO_TOS_REGISTERS): 132 case CASE_NUMBER(R0_R1_TOS, NO_TOS_REGISTERS):
133 __ Push(r1, r0); 133 __ Push(r1, r0, cond);
134 break; 134 break;
135 case CASE_NUMBER(R0_R1_TOS, R0_TOS): 135 case CASE_NUMBER(R0_R1_TOS, R0_TOS):
136 __ push(r1); 136 __ push(r1, cond);
137 break; 137 break;
138 case CASE_NUMBER(R0_R1_TOS, R1_TOS): 138 case CASE_NUMBER(R0_R1_TOS, R1_TOS):
139 __ push(r1); 139 __ push(r1, cond);
140 __ mov(r1, r0); 140 __ mov(r1, r0, LeaveCC, cond);
141 break; 141 break;
142 case CASE_NUMBER(R0_R1_TOS, R0_R1_TOS): 142 case CASE_NUMBER(R0_R1_TOS, R0_R1_TOS):
143 break; 143 break;
144 case CASE_NUMBER(R0_R1_TOS, R1_R0_TOS): 144 case CASE_NUMBER(R0_R1_TOS, R1_R0_TOS):
145 __ Swap(r0, r1, ip); 145 __ Swap(r0, r1, ip, cond);
146 break; 146 break;
147 case CASE_NUMBER(R1_R0_TOS, NO_TOS_REGISTERS): 147 case CASE_NUMBER(R1_R0_TOS, NO_TOS_REGISTERS):
148 __ Push(r0, r1); 148 __ Push(r0, r1, cond);
149 break; 149 break;
150 case CASE_NUMBER(R1_R0_TOS, R0_TOS): 150 case CASE_NUMBER(R1_R0_TOS, R0_TOS):
151 __ push(r0); 151 __ push(r0, cond);
152 __ mov(r0, r1); 152 __ mov(r0, r1, LeaveCC, cond);
153 break; 153 break;
154 case CASE_NUMBER(R1_R0_TOS, R1_TOS): 154 case CASE_NUMBER(R1_R0_TOS, R1_TOS):
155 __ push(r0); 155 __ push(r0, cond);
156 break; 156 break;
157 case CASE_NUMBER(R1_R0_TOS, R0_R1_TOS): 157 case CASE_NUMBER(R1_R0_TOS, R0_R1_TOS):
158 __ Swap(r0, r1, ip); 158 __ Swap(r0, r1, ip, cond);
159 break; 159 break;
160 case CASE_NUMBER(R1_R0_TOS, R1_R0_TOS): 160 case CASE_NUMBER(R1_R0_TOS, R1_R0_TOS):
161 break; 161 break;
162 default: 162 default:
163 UNREACHABLE(); 163 UNREACHABLE();
164 #undef CASE_NUMBER 164 #undef CASE_NUMBER
165 } 165 }
166 top_of_stack_state_ = expected_top_of_stack_state; 166 // A conditional merge will be followed by a conditional branch and the
167 // fall-through code will have an unchanged virtual frame state. If the
168 // merge is unconditional ('al'ways) then it might be followed by a fall
169 // through. We need to update the virtual frame state to match the code we
170 // are falling into. The final case is an unconditional merge followed by an
171 // unconditional branch, in which case it doesn't matter what we do to the
172 // virtual frame state, because the virtual frame will be invalidated.
173 if (cond == al) {
174 top_of_stack_state_ = expected_top_of_stack_state;
175 }
167 } 176 }
168 177
169 178
170 void VirtualFrame::Enter() { 179 void VirtualFrame::Enter() {
171 Comment cmnt(masm(), "[ Enter JS frame"); 180 Comment cmnt(masm(), "[ Enter JS frame");
172 181
173 #ifdef DEBUG 182 #ifdef DEBUG
174 // Verify that r1 contains a JS function. The following code relies 183 // Verify that r1 contains a JS function. The following code relies
175 // on r2 being available for use. 184 // on r2 being available for use.
176 if (FLAG_debug_code) { 185 if (FLAG_debug_code) {
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 break; 762 break;
754 } 763 }
755 ASSERT(register_allocation_map_ == 0); // Not yet implemented. 764 ASSERT(register_allocation_map_ == 0); // Not yet implemented.
756 } 765 }
757 766
758 #undef __ 767 #undef __
759 768
760 } } // namespace v8::internal 769 } } // namespace v8::internal
761 770
762 #endif // V8_TARGET_ARCH_ARM 771 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/virtual-frame-arm.h ('k') | src/codegen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698