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

Side by Side Diff: src/safepoint-table.cc

Issue 6606002: Merge revision 6500-6600 from bleeding_edge to the isolates branch. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: '' Created 9 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
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2011 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
11 // with the distribution. 11 // with the distribution.
(...skipping 10 matching lines...) Expand all
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #include "v8.h" 28 #include "v8.h"
29 29
30 #include "safepoint-table.h" 30 #include "safepoint-table.h"
31 31
32 #include "deoptimizer.h"
32 #include "disasm.h" 33 #include "disasm.h"
33 #include "macro-assembler.h" 34 #include "macro-assembler.h"
34 #include "zone-inl.h" 35 #include "zone-inl.h"
35 36
36 namespace v8 { 37 namespace v8 {
37 namespace internal { 38 namespace internal {
38 39
39 40
40 bool SafepointEntry::HasRegisters() const { 41 bool SafepointEntry::HasRegisters() const {
41 ASSERT(is_valid()); 42 ASSERT(is_valid());
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 PrintF("%c", ((byte & (1 << i)) == 0) ? '0' : '1'); 114 PrintF("%c", ((byte & (1 << i)) == 0) ? '0' : '1');
114 } 115 }
115 } 116 }
116 117
117 118
118 void Safepoint::DefinePointerRegister(Register reg) { 119 void Safepoint::DefinePointerRegister(Register reg) {
119 registers_->Add(reg.code()); 120 registers_->Add(reg.code());
120 } 121 }
121 122
122 123
123 Safepoint SafepointTableBuilder::DefineSafepoint(Assembler* assembler, 124 Safepoint SafepointTableBuilder::DefineSafepoint(
124 int deoptimization_index) { 125 Assembler* assembler, Safepoint::Kind kind, int arguments,
125 ASSERT(deoptimization_index != -1); 126 int deoptimization_index) {
126 DeoptimizationInfo pc_and_deoptimization_index;
127 pc_and_deoptimization_index.pc = assembler->pc_offset();
128 pc_and_deoptimization_index.deoptimization_index = deoptimization_index;
129 pc_and_deoptimization_index.pc_after_gap = assembler->pc_offset();
130 pc_and_deoptimization_index.arguments = 0;
131 pc_and_deoptimization_index.has_doubles = false;
132 deoptimization_info_.Add(pc_and_deoptimization_index);
133 indexes_.Add(new ZoneList<int>(8));
134 registers_.Add(NULL);
135 return Safepoint(indexes_.last(), registers_.last());
136 }
137
138
139 Safepoint SafepointTableBuilder::DefineSafepointWithRegisters(
140 Assembler* assembler, int arguments, int deoptimization_index) {
141 ASSERT(deoptimization_index != -1); 127 ASSERT(deoptimization_index != -1);
142 ASSERT(arguments >= 0); 128 ASSERT(arguments >= 0);
143 DeoptimizationInfo pc_and_deoptimization_index; 129 DeoptimizationInfo pc_and_deoptimization_index;
144 pc_and_deoptimization_index.pc = assembler->pc_offset(); 130 pc_and_deoptimization_index.pc = assembler->pc_offset();
145 pc_and_deoptimization_index.deoptimization_index = deoptimization_index; 131 pc_and_deoptimization_index.deoptimization_index = deoptimization_index;
146 pc_and_deoptimization_index.pc_after_gap = assembler->pc_offset(); 132 pc_and_deoptimization_index.pc_after_gap = assembler->pc_offset();
147 pc_and_deoptimization_index.arguments = arguments; 133 pc_and_deoptimization_index.arguments = arguments;
148 pc_and_deoptimization_index.has_doubles = false; 134 pc_and_deoptimization_index.has_doubles = (kind & Safepoint::kWithDoubles);
149 deoptimization_info_.Add(pc_and_deoptimization_index); 135 deoptimization_info_.Add(pc_and_deoptimization_index);
150 indexes_.Add(new ZoneList<int>(8)); 136 indexes_.Add(new ZoneList<int>(8));
151 registers_.Add(new ZoneList<int>(4)); 137 registers_.Add((kind & Safepoint::kWithRegisters)
138 ? new ZoneList<int>(4)
139 : NULL);
152 return Safepoint(indexes_.last(), registers_.last()); 140 return Safepoint(indexes_.last(), registers_.last());
153 } 141 }
154 142
155 143
156 Safepoint SafepointTableBuilder::DefineSafepointWithRegistersAndDoubles(
157 Assembler* assembler, int arguments, int deoptimization_index) {
158 ASSERT(deoptimization_index != -1);
159 ASSERT(arguments >= 0);
160 DeoptimizationInfo pc_and_deoptimization_index;
161 pc_and_deoptimization_index.pc = assembler->pc_offset();
162 pc_and_deoptimization_index.deoptimization_index = deoptimization_index;
163 pc_and_deoptimization_index.pc_after_gap = assembler->pc_offset();
164 pc_and_deoptimization_index.arguments = arguments;
165 pc_and_deoptimization_index.has_doubles = true;
166 deoptimization_info_.Add(pc_and_deoptimization_index);
167 indexes_.Add(new ZoneList<int>(8));
168 registers_.Add(new ZoneList<int>(4));
169 return Safepoint(indexes_.last(), registers_.last());
170 }
171
172 unsigned SafepointTableBuilder::GetCodeOffset() const { 144 unsigned SafepointTableBuilder::GetCodeOffset() const {
173 ASSERT(emitted_); 145 ASSERT(emitted_);
174 return offset_; 146 return offset_;
175 } 147 }
176 148
177 149
178 void SafepointTableBuilder::Emit(Assembler* assembler, int bits_per_entry) { 150 void SafepointTableBuilder::Emit(Assembler* assembler, int bits_per_entry) {
151 // For lazy deoptimization we need space to patch a call after every call.
152 // Ensure there is always space for such patching, even if the code ends
153 // in a call.
154 int target_offset = assembler->pc_offset() + Deoptimizer::patch_size();
155 while (assembler->pc_offset() < target_offset) {
156 assembler->nop();
157 }
158
179 // Make sure the safepoint table is properly aligned. Pad with nops. 159 // Make sure the safepoint table is properly aligned. Pad with nops.
180 assembler->Align(kIntSize); 160 assembler->Align(kIntSize);
181 assembler->RecordComment(";;; Safepoint table."); 161 assembler->RecordComment(";;; Safepoint table.");
182 offset_ = assembler->pc_offset(); 162 offset_ = assembler->pc_offset();
183 163
184 // Take the register bits into account. 164 // Take the register bits into account.
185 bits_per_entry += kNumSafepointRegisters; 165 bits_per_entry += kNumSafepointRegisters;
186 166
187 // Compute the number of bytes per safepoint entry. 167 // Compute the number of bytes per safepoint entry.
188 int bytes_per_entry = 168 int bytes_per_entry =
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 unsigned gap_size = info.pc_after_gap - info.pc; 227 unsigned gap_size = info.pc_after_gap - info.pc;
248 uint32_t encoding = SafepointEntry::DeoptimizationIndexField::encode(index); 228 uint32_t encoding = SafepointEntry::DeoptimizationIndexField::encode(index);
249 encoding |= SafepointEntry::GapCodeSizeField::encode(gap_size); 229 encoding |= SafepointEntry::GapCodeSizeField::encode(gap_size);
250 encoding |= SafepointEntry::ArgumentsField::encode(info.arguments); 230 encoding |= SafepointEntry::ArgumentsField::encode(info.arguments);
251 encoding |= SafepointEntry::SaveDoublesField::encode(info.has_doubles); 231 encoding |= SafepointEntry::SaveDoublesField::encode(info.has_doubles);
252 return encoding; 232 return encoding;
253 } 233 }
254 234
255 235
256 } } // namespace v8::internal 236 } } // namespace v8::internal
OLDNEW
« src/ast.cc ('K') | « src/safepoint-table.h ('k') | src/scanner-base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698