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

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

Issue 49029: Inline part of RawSyncElementAt, improve PrepareForCall (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 9 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/virtual-frame-arm.h ('k') | src/virtual-frame-ia32.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 2008 the V8 project authors. All rights reserved. 1 // Copyright 2008 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 frame_pointer_(kIllegalIndex) { 51 frame_pointer_(kIllegalIndex) {
52 for (int i = 0; i < parameter_count_ + 1; i++) { 52 for (int i = 0; i < parameter_count_ + 1; i++) {
53 elements_.Add(FrameElement::MemoryElement()); 53 elements_.Add(FrameElement::MemoryElement());
54 } 54 }
55 for (int i = 0; i < kNumRegisters; i++) { 55 for (int i = 0; i < kNumRegisters; i++) {
56 register_locations_[i] = kIllegalIndex; 56 register_locations_[i] = kIllegalIndex;
57 } 57 }
58 } 58 }
59 59
60 60
61 // Clear the dirty bit for the element at a given index if it is a 61 void VirtualFrame::SyncElementBelowStackPointer(int index) {
62 // valid element. The stack address corresponding to the element must 62 UNREACHABLE();
63 // be allocated on the physical stack, or the first element above the
64 // stack pointer so it can be allocated by a single push instruction.
65 void VirtualFrame::RawSyncElementAt(int index) {
66 FrameElement element = elements_[index];
67
68 if (!element.is_valid() || element.is_synced()) return;
69
70 if (index <= stack_pointer_) {
71 // Emit code to write elements below the stack pointer to their
72 // (already allocated) stack address.
73 switch (element.type()) {
74 case FrameElement::INVALID: // Fall through.
75 case FrameElement::MEMORY:
76 // There was an early bailout for invalid and synced elements
77 // (memory elements are always synced).
78 UNREACHABLE();
79 break;
80
81 case FrameElement::REGISTER:
82 __ str(element.reg(), MemOperand(fp, fp_relative(index)));
83 break;
84
85 case FrameElement::CONSTANT: {
86 Result temp = cgen_->allocator()->Allocate();
87 ASSERT(temp.is_valid());
88 __ mov(temp.reg(), Operand(element.handle()));
89 __ str(temp.reg(), MemOperand(fp, fp_relative(index)));
90 break;
91 }
92
93 case FrameElement::COPY: {
94 int backing_index = element.index();
95 FrameElement backing_element = elements_[backing_index];
96 if (backing_element.is_memory()) {
97 Result temp = cgen_->allocator()->Allocate();
98 ASSERT(temp.is_valid());
99 __ ldr(temp.reg(), MemOperand(fp, fp_relative(backing_index)));
100 __ str(temp.reg(), MemOperand(fp, fp_relative(index)));
101 } else {
102 ASSERT(backing_element.is_register());
103 __ str(backing_element.reg(), MemOperand(fp, fp_relative(index)));
104 }
105 break;
106 }
107 }
108
109 } else {
110 // Push elements above the stack pointer to allocate space and
111 // sync them. Space should have already been allocated in the
112 // actual frame for all the elements below this one.
113 ASSERT(index == stack_pointer_ + 1);
114 stack_pointer_++;
115 switch (element.type()) {
116 case FrameElement::INVALID: // Fall through.
117 case FrameElement::MEMORY:
118 // There was an early bailout for invalid and synced elements
119 // (memory elements are always synced).
120 UNREACHABLE();
121 break;
122
123 case FrameElement::REGISTER:
124 __ push(element.reg());
125 break;
126
127 case FrameElement::CONSTANT: {
128 Result temp = cgen_->allocator()->Allocate();
129 ASSERT(temp.is_valid());
130 __ mov(temp.reg(), Operand(element.handle()));
131 __ push(temp.reg());
132 break;
133 }
134
135 case FrameElement::COPY: {
136 int backing_index = element.index();
137 FrameElement backing = elements_[backing_index];
138 ASSERT(backing.is_memory() || backing.is_register());
139 if (backing.is_memory()) {
140 Result temp = cgen_->allocator()->Allocate();
141 ASSERT(temp.is_valid());
142 __ ldr(temp.reg(), MemOperand(fp, fp_relative(backing_index)));
143 __ push(temp.reg());
144 } else {
145 __ push(backing.reg());
146 }
147 break;
148 }
149 }
150 }
151
152 elements_[index].set_sync();
153 } 63 }
154 64
155 65
66 void VirtualFrame::SyncElementByPushing(int index) {
67 UNREACHABLE();
68 }
69
70
156 void VirtualFrame::MergeTo(VirtualFrame* expected) { 71 void VirtualFrame::MergeTo(VirtualFrame* expected) {
157 Comment cmnt(masm_, "[ Merge frame"); 72 Comment cmnt(masm_, "[ Merge frame");
158 // We should always be merging the code generator's current frame to an 73 // We should always be merging the code generator's current frame to an
159 // expected frame. 74 // expected frame.
160 ASSERT(cgen_->frame() == this); 75 ASSERT(cgen_->frame() == this);
161 76
162 // Adjust the stack pointer upward (toward the top of the virtual 77 // Adjust the stack pointer upward (toward the top of the virtual
163 // frame) if necessary. 78 // frame) if necessary.
164 if (stack_pointer_ < expected->stack_pointer_) { 79 if (stack_pointer_ < expected->stack_pointer_) {
165 int difference = expected->stack_pointer_ - stack_pointer_; 80 int difference = expected->stack_pointer_ - stack_pointer_;
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 ASSERT(stack_pointer_ == elements_.length() - 1); 386 ASSERT(stack_pointer_ == elements_.length() - 1);
472 elements_.Add(FrameElement::MemoryElement()); 387 elements_.Add(FrameElement::MemoryElement());
473 stack_pointer_++; 388 stack_pointer_++;
474 __ push(reg); 389 __ push(reg);
475 } 390 }
476 391
477 392
478 #undef __ 393 #undef __
479 394
480 } } // namespace v8::internal 395 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/virtual-frame-arm.h ('k') | src/virtual-frame-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698