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

Side by Side Diff: src/x64/lithium-x64.h

Issue 21042003: Patch to enhance the source code line information for profiler. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 7 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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 200
201 201
202 #define DECLARE_HYDROGEN_ACCESSOR(type) \ 202 #define DECLARE_HYDROGEN_ACCESSOR(type) \
203 H##type* hydrogen() const { \ 203 H##type* hydrogen() const { \
204 return H##type::cast(hydrogen_value()); \ 204 return H##type::cast(hydrogen_value()); \
205 } 205 }
206 206
207 207
208 class LInstruction: public ZoneObject { 208 class LInstruction: public ZoneObject {
209 public: 209 public:
210 LInstruction() 210 LInstruction() : environment_(NULL), hydrogen_value_(NULL) {
211 : environment_(NULL), 211 bit_field_ = IsCallBits::encode(false) |
212 hydrogen_value_(NULL), 212 PositionBits::encode(RelocInfo::kNoPosition + 1);
213 is_call_(false) { } 213 }
214 214
215 virtual ~LInstruction() { } 215 virtual ~LInstruction() { }
216 216
217 virtual void CompileToNative(LCodeGen* generator) = 0; 217 virtual void CompileToNative(LCodeGen* generator) = 0;
218 virtual const char* Mnemonic() const = 0; 218 virtual const char* Mnemonic() const = 0;
219 virtual void PrintTo(StringStream* stream); 219 virtual void PrintTo(StringStream* stream);
220 virtual void PrintDataTo(StringStream* stream); 220 virtual void PrintDataTo(StringStream* stream);
221 virtual void PrintOutputOperandTo(StringStream* stream); 221 virtual void PrintOutputOperandTo(StringStream* stream);
222 222
223 enum Opcode { 223 enum Opcode {
(...skipping 19 matching lines...) Expand all
243 virtual bool IsControl() const { return false; } 243 virtual bool IsControl() const { return false; }
244 244
245 void set_environment(LEnvironment* env) { environment_ = env; } 245 void set_environment(LEnvironment* env) { environment_ = env; }
246 LEnvironment* environment() const { return environment_; } 246 LEnvironment* environment() const { return environment_; }
247 bool HasEnvironment() const { return environment_ != NULL; } 247 bool HasEnvironment() const { return environment_ != NULL; }
248 248
249 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); } 249 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); }
250 LPointerMap* pointer_map() const { return pointer_map_.get(); } 250 LPointerMap* pointer_map() const { return pointer_map_.get(); }
251 bool HasPointerMap() const { return pointer_map_.is_set(); } 251 bool HasPointerMap() const { return pointer_map_.is_set(); }
252 252
253 // The 31 bits PositionBits is used to store the int position value. And the
254 // position value may be RelocInfo::kNoPosition (-1). The accessor always
255 // +1/-1 so that the encoded value of position in bit_field_ is always >= 0
256 // and can fit into the 31 bits PositionBits.
257 void set_position(int pos) {
258 bit_field_ = PositionBits::update(bit_field_, pos + 1);
259 }
260 int position() { return PositionBits::decode(bit_field_) - 1; }
261
253 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; } 262 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; }
254 HValue* hydrogen_value() const { return hydrogen_value_; } 263 HValue* hydrogen_value() const { return hydrogen_value_; }
255 264
256 void MarkAsCall() { is_call_ = true; } 265 void MarkAsCall() { bit_field_ = IsCallBits::update(bit_field_, true); }
257 266
258 // Interface to the register allocator and iterators. 267 // Interface to the register allocator and iterators.
259 bool ClobbersTemps() const { return is_call_; } 268 bool ClobbersTemps() const { return IsCallBits::decode(bit_field_); }
260 bool ClobbersRegisters() const { return is_call_; } 269 bool ClobbersRegisters() const { return IsCallBits::decode(bit_field_); }
261 bool ClobbersDoubleRegisters() const { return is_call_; } 270 bool ClobbersDoubleRegisters() const {
271 return IsCallBits::decode(bit_field_);
272 }
262 273
263 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) { } 274 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) { }
264 275
265 // Interface to the register allocator and iterators. 276 // Interface to the register allocator and iterators.
266 bool IsMarkedAsCall() const { return is_call_; } 277 bool IsMarkedAsCall() const { return IsCallBits::decode(bit_field_); }
267 278
268 virtual bool HasResult() const = 0; 279 virtual bool HasResult() const = 0;
269 virtual LOperand* result() const = 0; 280 virtual LOperand* result() const = 0;
270 281
271 LOperand* FirstInput() { return InputAt(0); } 282 LOperand* FirstInput() { return InputAt(0); }
272 LOperand* Output() { return HasResult() ? result() : NULL; } 283 LOperand* Output() { return HasResult() ? result() : NULL; }
273 284
274 virtual bool HasInterestingComment(LCodeGen* gen) const { return true; } 285 virtual bool HasInterestingComment(LCodeGen* gen) const { return true; }
275 286
276 #ifdef DEBUG 287 #ifdef DEBUG
277 void VerifyCall(); 288 void VerifyCall();
278 #endif 289 #endif
279 290
280 private: 291 private:
281 // Iterator support. 292 // Iterator support.
282 friend class InputIterator; 293 friend class InputIterator;
283 virtual int InputCount() = 0; 294 virtual int InputCount() = 0;
284 virtual LOperand* InputAt(int i) = 0; 295 virtual LOperand* InputAt(int i) = 0;
285 296
286 friend class TempIterator; 297 friend class TempIterator;
287 virtual int TempCount() = 0; 298 virtual int TempCount() = 0;
288 virtual LOperand* TempAt(int i) = 0; 299 virtual LOperand* TempAt(int i) = 0;
289 300
290 LEnvironment* environment_; 301 LEnvironment* environment_;
291 SetOncePointer<LPointerMap> pointer_map_; 302 SetOncePointer<LPointerMap> pointer_map_;
292 HValue* hydrogen_value_; 303 HValue* hydrogen_value_;
293 bool is_call_; 304 int bit_field_;
305 class IsCallBits: public BitField<bool, 0, 1> {};
306 class PositionBits: public BitField<int, 1, 31> {};
294 }; 307 };
295 308
296 309
297 // R = number of result operands (0 or 1). 310 // R = number of result operands (0 or 1).
298 // I = number of input operands. 311 // I = number of input operands.
299 // T = number of temporary operands. 312 // T = number of temporary operands.
300 template<int R, int I, int T> 313 template<int R, int I, int T>
301 class LTemplateInstruction: public LInstruction { 314 class LTemplateInstruction: public LInstruction {
302 public: 315 public:
303 // Allow 0 or 1 output operands. 316 // Allow 0 or 1 output operands.
(...skipping 2396 matching lines...) Expand 10 before | Expand all | Expand 10 after
2700 2713
2701 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); 2714 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
2702 }; 2715 };
2703 2716
2704 #undef DECLARE_HYDROGEN_ACCESSOR 2717 #undef DECLARE_HYDROGEN_ACCESSOR
2705 #undef DECLARE_CONCRETE_INSTRUCTION 2718 #undef DECLARE_CONCRETE_INSTRUCTION
2706 2719
2707 } } // namespace v8::int 2720 } } // namespace v8::int
2708 2721
2709 #endif // V8_X64_LITHIUM_X64_H_ 2722 #endif // V8_X64_LITHIUM_X64_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698