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

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

Issue 165230: Eliminate most of the jump target jumping, branching, and binding... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 4 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
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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 // All elements are in memory on ARM (ie, synced). 69 // All elements are in memory on ARM (ie, synced).
70 #ifdef DEBUG 70 #ifdef DEBUG
71 for (int i = begin; i <= end; i++) { 71 for (int i = begin; i <= end; i++) {
72 ASSERT(elements_[i].is_synced()); 72 ASSERT(elements_[i].is_synced());
73 } 73 }
74 #endif 74 #endif
75 } 75 }
76 76
77 77
78 void VirtualFrame::MergeTo(VirtualFrame* expected) { 78 void VirtualFrame::MergeTo(VirtualFrame* expected) {
79 Comment cmnt(masm(), "[ Merge frame"); 79 // ARM frames are currently always in memory.
80 // We should always be merging the code generator's current frame to an
81 // expected frame.
82 ASSERT(cgen()->frame() == this);
83
84 // Adjust the stack pointer upward (toward the top of the virtual
85 // frame) if necessary.
86 if (stack_pointer_ < expected->stack_pointer_) {
87 int difference = expected->stack_pointer_ - stack_pointer_;
88 stack_pointer_ = expected->stack_pointer_;
89 __ sub(sp, sp, Operand(difference * kPointerSize));
90 }
91
92 MergeMoveRegistersToMemory(expected);
93 MergeMoveRegistersToRegisters(expected);
94 MergeMoveMemoryToRegisters(expected);
95
96 // Fix any sync bit problems from the bottom-up, stopping when we
97 // hit the stack pointer or the top of the frame if the stack
98 // pointer is floating above the frame.
99 int limit = Min(static_cast<int>(stack_pointer_), element_count() - 1);
100 for (int i = 0; i <= limit; i++) {
101 FrameElement source = elements_[i];
102 FrameElement target = expected->elements_[i];
103 if (source.is_synced() && !target.is_synced()) {
104 elements_[i].clear_sync();
105 } else if (!source.is_synced() && target.is_synced()) {
106 SyncElementAt(i);
107 }
108 }
109
110 // Adjust the stack point downard if necessary.
111 if (stack_pointer_ > expected->stack_pointer_) {
112 int difference = stack_pointer_ - expected->stack_pointer_;
113 stack_pointer_ = expected->stack_pointer_;
114 __ add(sp, sp, Operand(difference * kPointerSize));
115 }
116
117 // At this point, the frames should be identical.
118 ASSERT(Equals(expected)); 80 ASSERT(Equals(expected));
119 } 81 }
120 82
121 83
122 void VirtualFrame::MergeMoveRegistersToMemory(VirtualFrame* expected) { 84 void VirtualFrame::MergeMoveRegistersToMemory(VirtualFrame* expected) {
123 ASSERT(stack_pointer_ >= expected->stack_pointer_); 85 UNREACHABLE();
124
125 // Move registers, constants, and copies to memory. Perform moves
126 // from the top downward in the frame in order to leave the backing
127 // stores of copies in registers.
128 // On ARM, all elements are in memory.
129
130 #ifdef DEBUG
131 int start = Min(static_cast<int>(stack_pointer_), element_count() - 1);
132 for (int i = start; i >= 0; i--) {
133 ASSERT(elements_[i].is_memory());
134 ASSERT(expected->elements_[i].is_memory());
135 }
136 #endif
137 } 86 }
138 87
139 88
140 void VirtualFrame::MergeMoveRegistersToRegisters(VirtualFrame* expected) { 89 void VirtualFrame::MergeMoveRegistersToRegisters(VirtualFrame* expected) {
90 UNREACHABLE();
141 } 91 }
142 92
143 93
144 void VirtualFrame::MergeMoveMemoryToRegisters(VirtualFrame* expected) { 94 void VirtualFrame::MergeMoveMemoryToRegisters(VirtualFrame* expected) {
95 UNREACHABLE();
145 } 96 }
146 97
147 98
148 void VirtualFrame::Enter() { 99 void VirtualFrame::Enter() {
149 Comment cmnt(masm(), "[ Enter JS frame"); 100 Comment cmnt(masm(), "[ Enter JS frame");
150 101
151 #ifdef DEBUG 102 #ifdef DEBUG
152 // Verify that r1 contains a JS function. The following code relies 103 // Verify that r1 contains a JS function. The following code relies
153 // on r2 being available for use. 104 // on r2 being available for use.
154 { Label map_check, done; 105 { Label map_check, done;
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 ASSERT(stack_pointer_ == element_count() - 1); 379 ASSERT(stack_pointer_ == element_count() - 1);
429 elements_.Add(FrameElement::MemoryElement()); 380 elements_.Add(FrameElement::MemoryElement());
430 stack_pointer_++; 381 stack_pointer_++;
431 __ push(reg); 382 __ push(reg);
432 } 383 }
433 384
434 385
435 #undef __ 386 #undef __
436 387
437 } } // namespace v8::internal 388 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698