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

Side by Side Diff: src/arm/lithium-arm.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 | « no previous file | src/arm/lithium-arm.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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 283
284 #define DECLARE_HYDROGEN_ACCESSOR(type) \ 284 #define DECLARE_HYDROGEN_ACCESSOR(type) \
285 H##type* hydrogen() const { \ 285 H##type* hydrogen() const { \
286 return H##type::cast(hydrogen_value()); \ 286 return H##type::cast(hydrogen_value()); \
287 } 287 }
288 288
289 289
290 class LInstruction: public ZoneObject { 290 class LInstruction: public ZoneObject {
291 public: 291 public:
292 LInstruction() 292 LInstruction()
293 : hydrogen_value_(NULL) { } 293 : environment_(NULL),
294 hydrogen_value_(NULL),
295 is_call_(false),
296 is_save_doubles_(false) { }
294 virtual ~LInstruction() { } 297 virtual ~LInstruction() { }
295 298
296 virtual void CompileToNative(LCodeGen* generator) = 0; 299 virtual void CompileToNative(LCodeGen* generator) = 0;
297 virtual const char* Mnemonic() const = 0; 300 virtual const char* Mnemonic() const = 0;
298 virtual void PrintTo(StringStream* stream); 301 virtual void PrintTo(StringStream* stream);
299 virtual void PrintDataTo(StringStream* stream) = 0; 302 virtual void PrintDataTo(StringStream* stream) = 0;
300 virtual void PrintOutputOperandTo(StringStream* stream) = 0; 303 virtual void PrintOutputOperandTo(StringStream* stream) = 0;
301 304
302 // Declare virtual type testers. 305 // Declare virtual type testers.
303 #define DECLARE_DO(type) virtual bool Is##type() const { return false; } 306 #define DECLARE_DO(type) virtual bool Is##type() const { return false; }
304 LITHIUM_ALL_INSTRUCTION_LIST(DECLARE_DO) 307 LITHIUM_ALL_INSTRUCTION_LIST(DECLARE_DO)
305 #undef DECLARE_DO 308 #undef DECLARE_DO
306 309
307 virtual bool IsControl() const { return false; } 310 virtual bool IsControl() const { return false; }
308 virtual void SetBranchTargets(int true_block_id, int false_block_id) { } 311 virtual void SetBranchTargets(int true_block_id, int false_block_id) { }
309 312
310 void set_environment(LEnvironment* env) { environment_.set(env); } 313 void set_environment(LEnvironment* env) { environment_ = env; }
311 LEnvironment* environment() const { return environment_.get(); } 314 LEnvironment* environment() const { return environment_; }
312 bool HasEnvironment() const { return environment_.is_set(); } 315 bool HasEnvironment() const { return environment_ != NULL; }
313 316
314 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); } 317 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); }
315 LPointerMap* pointer_map() const { return pointer_map_.get(); } 318 LPointerMap* pointer_map() const { return pointer_map_.get(); }
316 bool HasPointerMap() const { return pointer_map_.is_set(); } 319 bool HasPointerMap() const { return pointer_map_.is_set(); }
317 320
318 virtual bool HasResult() const = 0;
319
320 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; } 321 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; }
321 HValue* hydrogen_value() const { return hydrogen_value_; } 322 HValue* hydrogen_value() const { return hydrogen_value_; }
322 323
324 void MarkAsCall() { is_call_ = true; }
325 void MarkAsSaveDoubles() { is_save_doubles_ = true; }
326
327 // Interface to the register allocator and iterators.
328 bool IsMarkedAsCall() const { return is_call_; }
329 bool IsMarkedAsSaveDoubles() const { return is_save_doubles_; }
330
331 virtual bool HasResult() const = 0;
332 virtual LOperand* result() = 0;
333
334 virtual int InputCount() = 0;
335 virtual LOperand* InputAt(int i) = 0;
336 virtual int TempCount() = 0;
337 virtual LOperand* TempAt(int i) = 0;
338
339 LOperand* FirstInput() { return InputAt(0); }
340 LOperand* Output() { return HasResult() ? result() : NULL; }
341
323 private: 342 private:
324 SetOncePointer<LEnvironment> environment_; 343 LEnvironment* environment_;
325 SetOncePointer<LPointerMap> pointer_map_; 344 SetOncePointer<LPointerMap> pointer_map_;
326 HValue* hydrogen_value_; 345 HValue* hydrogen_value_;
346 bool is_call_;
347 bool is_save_doubles_;
327 }; 348 };
328 349
329 350
330 template<typename ElementType, int NumElements> 351 template<typename ElementType, int NumElements>
331 class OperandContainer { 352 class OperandContainer {
332 public: 353 public:
333 OperandContainer() { 354 OperandContainer() {
334 for (int i = 0; i < NumElements; i++) elems_[i] = NULL; 355 for (int i = 0; i < NumElements; i++) elems_[i] = NULL;
335 } 356 }
336 int length() { return NumElements; } 357 int length() { return NumElements; }
337 ElementType& operator[](int i) { 358 ElementType& operator[](int i) {
338 ASSERT(i < length()); 359 ASSERT(i < length());
339 return elems_[i]; 360 return elems_[i];
340 } 361 }
341 void PrintOperandsTo(StringStream* stream); 362 void PrintOperandsTo(StringStream* stream);
342 363
343 private: 364 private:
344 ElementType elems_[NumElements]; 365 ElementType elems_[NumElements];
345 }; 366 };
346 367
347 368
348 template<typename ElementType> 369 template<typename ElementType>
349 class OperandContainer<ElementType, 0> { 370 class OperandContainer<ElementType, 0> {
350 public: 371 public:
351 int length() { return 0; } 372 int length() { return 0; }
352 void PrintOperandsTo(StringStream* stream) { } 373 void PrintOperandsTo(StringStream* stream) { }
374 ElementType& operator[](int i) {
375 UNREACHABLE();
376 static ElementType t = 0;
377 return t;
378 }
353 }; 379 };
354 380
355 381
356 // R = number of result operands (0 or 1). 382 // R = number of result operands (0 or 1).
357 // I = number of input operands. 383 // I = number of input operands.
358 // T = number of temporary operands. 384 // T = number of temporary operands.
359 template<int R, int I, int T> 385 template<int R, int I, int T>
360 class LTemplateInstruction: public LInstruction { 386 class LTemplateInstruction: public LInstruction {
361 public: 387 public:
362 // Allow 0 or 1 output operands. 388 // Allow 0 or 1 output operands.
(...skipping 1407 matching lines...) Expand 10 before | Expand all | Expand 10 after
1770 public: 1796 public:
1771 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack-check") 1797 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack-check")
1772 }; 1798 };
1773 1799
1774 1800
1775 class LChunkBuilder; 1801 class LChunkBuilder;
1776 class LChunk: public ZoneObject { 1802 class LChunk: public ZoneObject {
1777 public: 1803 public:
1778 explicit LChunk(HGraph* graph); 1804 explicit LChunk(HGraph* graph);
1779 1805
1780 int AddInstruction(LInstruction* instruction, HBasicBlock* block); 1806 void AddInstruction(LInstruction* instruction, HBasicBlock* block);
1781 LConstantOperand* DefineConstantOperand(HConstant* constant); 1807 LConstantOperand* DefineConstantOperand(HConstant* constant);
1782 Handle<Object> LookupLiteral(LConstantOperand* operand) const; 1808 Handle<Object> LookupLiteral(LConstantOperand* operand) const;
1783 Representation LookupLiteralRepresentation(LConstantOperand* operand) const; 1809 Representation LookupLiteralRepresentation(LConstantOperand* operand) const;
1784 1810
1785 int GetNextSpillIndex(bool is_double); 1811 int GetNextSpillIndex(bool is_double);
1786 LOperand* GetNextSpillSlot(bool is_double); 1812 LOperand* GetNextSpillSlot(bool is_double);
1787 1813
1788 int ParameterAt(int index); 1814 int ParameterAt(int index);
1789 int GetParameterStackSlot(int index) const; 1815 int GetParameterStackSlot(int index) const;
1790 int spill_slot_count() const { return spill_slot_count_; } 1816 int spill_slot_count() const { return spill_slot_count_; }
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
1979 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); 2005 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
1980 }; 2006 };
1981 2007
1982 #undef DECLARE_HYDROGEN_ACCESSOR 2008 #undef DECLARE_HYDROGEN_ACCESSOR
1983 #undef DECLARE_INSTRUCTION 2009 #undef DECLARE_INSTRUCTION
1984 #undef DECLARE_CONCRETE_INSTRUCTION 2010 #undef DECLARE_CONCRETE_INSTRUCTION
1985 2011
1986 } } // namespace v8::internal 2012 } } // namespace v8::internal
1987 2013
1988 #endif // V8_ARM_LITHIUM_ARM_H_ 2014 #endif // V8_ARM_LITHIUM_ARM_H_
OLDNEW
« no previous file with comments | « no previous file | src/arm/lithium-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698