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

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

Issue 6352006: Remove instruction summaries and provide a LIR-interface for the register all... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: addressed comments, rebased and ported to ARM and x64 Created 9 years, 11 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/lithium-allocator-inl.h ('k') | src/x64/lithium-x64.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 2011 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
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 280
281 #define DECLARE_HYDROGEN_ACCESSOR(type) \ 281 #define DECLARE_HYDROGEN_ACCESSOR(type) \
282 H##type* hydrogen() const { \ 282 H##type* hydrogen() const { \
283 return H##type::cast(hydrogen_value()); \ 283 return H##type::cast(hydrogen_value()); \
284 } 284 }
285 285
286 286
287 class LInstruction: public ZoneObject { 287 class LInstruction: public ZoneObject {
288 public: 288 public:
289 LInstruction() 289 LInstruction()
290 : hydrogen_value_(NULL) { } 290 : environment_(NULL),
291 hydrogen_value_(NULL),
292 is_call_(false),
293 is_save_doubles_(false) { }
294
291 virtual ~LInstruction() { } 295 virtual ~LInstruction() { }
292 296
293 virtual void CompileToNative(LCodeGen* generator) = 0; 297 virtual void CompileToNative(LCodeGen* generator) = 0;
294 virtual const char* Mnemonic() const = 0; 298 virtual const char* Mnemonic() const = 0;
295 virtual void PrintTo(StringStream* stream); 299 virtual void PrintTo(StringStream* stream);
296 virtual void PrintDataTo(StringStream* stream) = 0; 300 virtual void PrintDataTo(StringStream* stream) = 0;
297 virtual void PrintOutputOperandTo(StringStream* stream) = 0; 301 virtual void PrintOutputOperandTo(StringStream* stream) = 0;
298 302
299 // Declare virtual type testers. 303 // Declare virtual type testers.
300 #define DECLARE_DO(type) virtual bool Is##type() const { return false; } 304 #define DECLARE_DO(type) virtual bool Is##type() const { return false; }
301 LITHIUM_ALL_INSTRUCTION_LIST(DECLARE_DO) 305 LITHIUM_ALL_INSTRUCTION_LIST(DECLARE_DO)
302 #undef DECLARE_DO 306 #undef DECLARE_DO
303 307
304 virtual bool IsControl() const { return false; } 308 virtual bool IsControl() const { return false; }
305 virtual void SetBranchTargets(int true_block_id, int false_block_id) { } 309 virtual void SetBranchTargets(int true_block_id, int false_block_id) { }
306 310
307 void set_environment(LEnvironment* env) { environment_.set(env); } 311 void set_environment(LEnvironment* env) { environment_ = env; }
308 LEnvironment* environment() const { return environment_.get(); } 312 LEnvironment* environment() const { return environment_; }
309 bool HasEnvironment() const { return environment_.is_set(); } 313 bool HasEnvironment() const { return environment_ != NULL; }
310 314
311 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); } 315 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); }
312 LPointerMap* pointer_map() const { return pointer_map_.get(); } 316 LPointerMap* pointer_map() const { return pointer_map_.get(); }
313 bool HasPointerMap() const { return pointer_map_.is_set(); } 317 bool HasPointerMap() const { return pointer_map_.is_set(); }
314 318
315 virtual bool HasResult() const = 0;
316
317 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; } 319 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; }
318 HValue* hydrogen_value() const { return hydrogen_value_; } 320 HValue* hydrogen_value() const { return hydrogen_value_; }
319 321
322 void MarkAsCall() { is_call_ = true; }
323 void MarkAsSaveDoubles() { is_save_doubles_ = true; }
324
325 // Interface to the register allocator and iterators.
326 bool IsMarkedAsCall() const { return is_call_; }
327 bool IsMarkedAsSaveDoubles() const { return is_save_doubles_; }
328
329 virtual bool HasResult() const = 0;
330 virtual LOperand* result() = 0;
331
332 virtual int InputCount() = 0;
333 virtual LOperand* InputAt(int i) = 0;
334 virtual int TempCount() = 0;
335 virtual LOperand* TempAt(int i) = 0;
336
337 LOperand* FirstInput() { return InputAt(0); }
338 LOperand* Output() { return HasResult() ? result() : NULL; }
339
340 #ifdef DEBUG
341 void VerifyCall();
342 #endif
343
320 private: 344 private:
321 SetOncePointer<LEnvironment> environment_; 345 LEnvironment* environment_;
322 SetOncePointer<LPointerMap> pointer_map_; 346 SetOncePointer<LPointerMap> pointer_map_;
323 HValue* hydrogen_value_; 347 HValue* hydrogen_value_;
348 bool is_call_;
349 bool is_save_doubles_;
324 }; 350 };
325 351
326 352
327 template<typename ElementType, int NumElements> 353 template<typename ElementType, int NumElements>
328 class OperandContainer { 354 class OperandContainer {
329 public: 355 public:
330 OperandContainer() { 356 OperandContainer() {
331 for (int i = 0; i < NumElements; i++) elems_[i] = NULL; 357 for (int i = 0; i < NumElements; i++) elems_[i] = NULL;
332 } 358 }
333 int length() { return NumElements; } 359 int length() { return NumElements; }
334 ElementType& operator[](int i) { 360 ElementType& operator[](int i) {
335 ASSERT(i < length()); 361 ASSERT(i < length());
336 return elems_[i]; 362 return elems_[i];
337 } 363 }
338 void PrintOperandsTo(StringStream* stream); 364 void PrintOperandsTo(StringStream* stream);
339 365
340 private: 366 private:
341 ElementType elems_[NumElements]; 367 ElementType elems_[NumElements];
342 }; 368 };
343 369
344 370
345 template<typename ElementType> 371 template<typename ElementType>
346 class OperandContainer<ElementType, 0> { 372 class OperandContainer<ElementType, 0> {
347 public: 373 public:
348 int length() { return 0; } 374 int length() { return 0; }
349 void PrintOperandsTo(StringStream* stream) { } 375 void PrintOperandsTo(StringStream* stream) { }
376 ElementType& operator[](int i) {
377 UNREACHABLE();
378 static ElementType t = 0;
379 return t;
380 }
350 }; 381 };
351 382
352 383
353 // R = number of result operands (0 or 1). 384 // R = number of result operands (0 or 1).
354 // I = number of input operands. 385 // I = number of input operands.
355 // T = number of temporary operands. 386 // T = number of temporary operands.
356 template<int R, int I, int T> 387 template<int R, int I, int T>
357 class LTemplateInstruction: public LInstruction { 388 class LTemplateInstruction: public LInstruction {
358 public: 389 public:
359 // Allow 0 or 1 output operands. 390 // Allow 0 or 1 output operands.
(...skipping 1403 matching lines...) Expand 10 before | Expand all | Expand 10 after
1763 class LChunkBuilder; 1794 class LChunkBuilder;
1764 class LChunk: public ZoneObject { 1795 class LChunk: public ZoneObject {
1765 public: 1796 public:
1766 explicit LChunk(HGraph* graph) 1797 explicit LChunk(HGraph* graph)
1767 : spill_slot_count_(0), 1798 : spill_slot_count_(0),
1768 graph_(graph), 1799 graph_(graph),
1769 instructions_(32), 1800 instructions_(32),
1770 pointer_maps_(8), 1801 pointer_maps_(8),
1771 inlined_closures_(1) { } 1802 inlined_closures_(1) { }
1772 1803
1773 int AddInstruction(LInstruction* instruction, HBasicBlock* block); 1804 void AddInstruction(LInstruction* instruction, HBasicBlock* block);
1774 LConstantOperand* DefineConstantOperand(HConstant* constant); 1805 LConstantOperand* DefineConstantOperand(HConstant* constant);
1775 Handle<Object> LookupLiteral(LConstantOperand* operand) const; 1806 Handle<Object> LookupLiteral(LConstantOperand* operand) const;
1776 Representation LookupLiteralRepresentation(LConstantOperand* operand) const; 1807 Representation LookupLiteralRepresentation(LConstantOperand* operand) const;
1777 1808
1778 int GetNextSpillIndex(bool is_double); 1809 int GetNextSpillIndex(bool is_double);
1779 LOperand* GetNextSpillSlot(bool is_double); 1810 LOperand* GetNextSpillSlot(bool is_double);
1780 1811
1781 int ParameterAt(int index); 1812 int ParameterAt(int index);
1782 int GetParameterStackSlot(int index) const; 1813 int GetParameterStackSlot(int index) const;
1783 int spill_slot_count() const { return spill_slot_count_; } 1814 int spill_slot_count() const { return spill_slot_count_; }
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
1976 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); 2007 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
1977 }; 2008 };
1978 2009
1979 #undef DECLARE_HYDROGEN_ACCESSOR 2010 #undef DECLARE_HYDROGEN_ACCESSOR
1980 #undef DECLARE_INSTRUCTION 2011 #undef DECLARE_INSTRUCTION
1981 #undef DECLARE_CONCRETE_INSTRUCTION 2012 #undef DECLARE_CONCRETE_INSTRUCTION
1982 2013
1983 } } // namespace v8::int 2014 } } // namespace v8::int
1984 2015
1985 #endif // V8_X64_LITHIUM_X64_H_ 2016 #endif // V8_X64_LITHIUM_X64_H_
OLDNEW
« no previous file with comments | « src/lithium-allocator-inl.h ('k') | src/x64/lithium-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698