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

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

Issue 6597029: [Isolates] Merge r 6300:6500 from bleeding_edge to isolates. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: Created 9 years, 10 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/runtime-profiler.cc ('k') | src/safepoint-table.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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 int gap_code_size() const { 63 int gap_code_size() const {
64 ASSERT(is_valid()); 64 ASSERT(is_valid());
65 return GapCodeSizeField::decode(info_); 65 return GapCodeSizeField::decode(info_);
66 } 66 }
67 67
68 int argument_count() const { 68 int argument_count() const {
69 ASSERT(is_valid()); 69 ASSERT(is_valid());
70 return ArgumentsField::decode(info_); 70 return ArgumentsField::decode(info_);
71 } 71 }
72 72
73 bool has_doubles() const {
74 ASSERT(is_valid());
75 return SaveDoublesField::decode(info_);
76 }
77
73 uint8_t* bits() { 78 uint8_t* bits() {
74 ASSERT(is_valid()); 79 ASSERT(is_valid());
75 return bits_; 80 return bits_;
76 } 81 }
77 82
78 bool HasRegisters() const; 83 bool HasRegisters() const;
79 bool HasRegisterAt(int reg_index) const; 84 bool HasRegisterAt(int reg_index) const;
80 85
81 // Reserve 13 bits for the gap code size. On ARM a constant pool can be 86 // Reserve 13 bits for the gap code size. On ARM a constant pool can be
82 // emitted when generating the gap code. The size of the const pool is less 87 // emitted when generating the gap code. The size of the const pool is less
83 // than what can be represented in 12 bits, so 13 bits gives room for having 88 // than what can be represented in 12 bits, so 13 bits gives room for having
84 // instructions before potentially emitting a constant pool. 89 // instructions before potentially emitting a constant pool.
85 static const int kGapCodeSizeBits = 13; 90 static const int kGapCodeSizeBits = 13;
86 static const int kArgumentsFieldBits = 3; 91 static const int kArgumentsFieldBits = 3;
92 static const int kSaveDoublesFieldBits = 1;
87 static const int kDeoptIndexBits = 93 static const int kDeoptIndexBits =
88 32 - kGapCodeSizeBits - kArgumentsFieldBits; 94 32 - kGapCodeSizeBits - kArgumentsFieldBits - kSaveDoublesFieldBits;
89 class GapCodeSizeField: public BitField<unsigned, 0, kGapCodeSizeBits> {}; 95 class GapCodeSizeField: public BitField<unsigned, 0, kGapCodeSizeBits> {};
90 class DeoptimizationIndexField: public BitField<int, 96 class DeoptimizationIndexField: public BitField<int,
91 kGapCodeSizeBits, 97 kGapCodeSizeBits,
92 kDeoptIndexBits> {}; // NOLIN T 98 kDeoptIndexBits> {}; // NOLIN T
93 class ArgumentsField: public BitField<unsigned, 99 class ArgumentsField: public BitField<unsigned,
94 kGapCodeSizeBits + kDeoptIndexBits, 100 kGapCodeSizeBits + kDeoptIndexBits,
95 kArgumentsFieldBits> {}; // NOLINT 101 kArgumentsFieldBits> {}; // NOLINT
102 class SaveDoublesField: public BitField<bool,
103 kGapCodeSizeBits + kDeoptIndexBits +
104 kArgumentsFieldBits,
105 kSaveDoublesFieldBits> { }; // NOLINT
106
96 private: 107 private:
97 unsigned info_; 108 unsigned info_;
98 uint8_t* bits_; 109 uint8_t* bits_;
99 }; 110 };
100 111
101 112
102 class SafepointTable BASE_EMBEDDED { 113 class SafepointTable BASE_EMBEDDED {
103 public: 114 public:
104 explicit SafepointTable(Code* code); 115 explicit SafepointTable(Code* code);
105 116
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 int deoptimization_index = Safepoint::kNoDeoptimizationIndex); 210 int deoptimization_index = Safepoint::kNoDeoptimizationIndex);
200 211
201 // Define a new safepoint with registers on the stack for the 212 // Define a new safepoint with registers on the stack for the
202 // current position in the body and take the number of arguments on 213 // current position in the body and take the number of arguments on
203 // top of the registers into account. 214 // top of the registers into account.
204 Safepoint DefineSafepointWithRegisters( 215 Safepoint DefineSafepointWithRegisters(
205 Assembler* assembler, 216 Assembler* assembler,
206 int arguments, 217 int arguments,
207 int deoptimization_index = Safepoint::kNoDeoptimizationIndex); 218 int deoptimization_index = Safepoint::kNoDeoptimizationIndex);
208 219
220 // Define a new safepoint with all double registers and the normal
221 // registers on the stack for the current position in the body and
222 // take the number of arguments on top of the registers into account.
223 // TODO(1043) Rewrite the three SafepointTableBuilder::DefineSafepoint
224 // methods to one method that uses template arguments.
225 Safepoint DefineSafepointWithRegistersAndDoubles(
226 Assembler* assembler,
227 int arguments,
228 int deoptimization_index = Safepoint::kNoDeoptimizationIndex);
229
209 // Update the last safepoint with the size of the code generated for the gap 230 // Update the last safepoint with the size of the code generated for the gap
210 // following it. 231 // following it.
211 void SetPcAfterGap(int pc) { 232 void SetPcAfterGap(int pc) {
212 ASSERT(!deoptimization_info_.is_empty()); 233 ASSERT(!deoptimization_info_.is_empty());
213 int index = deoptimization_info_.length() - 1; 234 int index = deoptimization_info_.length() - 1;
214 deoptimization_info_[index].pc_after_gap = pc; 235 deoptimization_info_[index].pc_after_gap = pc;
215 } 236 }
216 237
217 // Emit the safepoint table after the body. The number of bits per 238 // Emit the safepoint table after the body. The number of bits per
218 // entry must be enough to hold all the pointer indexes. 239 // entry must be enough to hold all the pointer indexes.
219 void Emit(Assembler* assembler, int bits_per_entry); 240 void Emit(Assembler* assembler, int bits_per_entry);
220 241
221 private: 242 private:
222 struct DeoptimizationInfo { 243 struct DeoptimizationInfo {
223 unsigned pc; 244 unsigned pc;
224 unsigned deoptimization_index; 245 unsigned deoptimization_index;
225 unsigned pc_after_gap; 246 unsigned pc_after_gap;
226 unsigned arguments; 247 unsigned arguments;
248 bool has_doubles;
227 }; 249 };
228 250
229 uint32_t EncodeExceptPC(const DeoptimizationInfo& info); 251 uint32_t EncodeExceptPC(const DeoptimizationInfo& info);
230 252
231 ZoneList<DeoptimizationInfo> deoptimization_info_; 253 ZoneList<DeoptimizationInfo> deoptimization_info_;
232 ZoneList<ZoneList<int>*> indexes_; 254 ZoneList<ZoneList<int>*> indexes_;
233 ZoneList<ZoneList<int>*> registers_; 255 ZoneList<ZoneList<int>*> registers_;
234 256
235 bool emitted_; 257 bool emitted_;
236 unsigned offset_; 258 unsigned offset_;
237 259
238 DISALLOW_COPY_AND_ASSIGN(SafepointTableBuilder); 260 DISALLOW_COPY_AND_ASSIGN(SafepointTableBuilder);
239 }; 261 };
240 262
241 } } // namespace v8::internal 263 } } // namespace v8::internal
242 264
243 #endif // V8_SAFEPOINT_TABLE_H_ 265 #endif // V8_SAFEPOINT_TABLE_H_
OLDNEW
« no previous file with comments | « src/runtime-profiler.cc ('k') | src/safepoint-table.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698