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

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

Issue 6628012: Refactor polymorphic load and inline function graph construction. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
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 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 1899 matching lines...) Expand 10 before | Expand all | Expand 10 after
1910 1910
1911 class LStackCheck: public LTemplateInstruction<0, 0, 0> { 1911 class LStackCheck: public LTemplateInstruction<0, 0, 0> {
1912 public: 1912 public:
1913 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack-check") 1913 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack-check")
1914 }; 1914 };
1915 1915
1916 1916
1917 class LChunkBuilder; 1917 class LChunkBuilder;
1918 class LChunk: public ZoneObject { 1918 class LChunk: public ZoneObject {
1919 public: 1919 public:
1920 explicit LChunk(HGraph* graph) 1920 explicit LChunk(CompilationInfo* info, HGraph* graph)
1921 : spill_slot_count_(0), 1921 : spill_slot_count_(0),
1922 info_(info),
1922 graph_(graph), 1923 graph_(graph),
1923 instructions_(32), 1924 instructions_(32),
1924 pointer_maps_(8), 1925 pointer_maps_(8),
1925 inlined_closures_(1) { } 1926 inlined_closures_(1) { }
1926 1927
1927 void AddInstruction(LInstruction* instruction, HBasicBlock* block); 1928 void AddInstruction(LInstruction* instruction, HBasicBlock* block);
1928 LConstantOperand* DefineConstantOperand(HConstant* constant); 1929 LConstantOperand* DefineConstantOperand(HConstant* constant);
1929 Handle<Object> LookupLiteral(LConstantOperand* operand) const; 1930 Handle<Object> LookupLiteral(LConstantOperand* operand) const;
1930 Representation LookupLiteralRepresentation(LConstantOperand* operand) const; 1931 Representation LookupLiteralRepresentation(LConstantOperand* operand) const;
1931 1932
1932 int GetNextSpillIndex(bool is_double); 1933 int GetNextSpillIndex(bool is_double);
1933 LOperand* GetNextSpillSlot(bool is_double); 1934 LOperand* GetNextSpillSlot(bool is_double);
1934 1935
1935 int ParameterAt(int index); 1936 int ParameterAt(int index);
1936 int GetParameterStackSlot(int index) const; 1937 int GetParameterStackSlot(int index) const;
1937 int spill_slot_count() const { return spill_slot_count_; } 1938 int spill_slot_count() const { return spill_slot_count_; }
1939 CompilationInfo* info() const { return info_; }
1938 HGraph* graph() const { return graph_; } 1940 HGraph* graph() const { return graph_; }
1939 const ZoneList<LInstruction*>* instructions() const { return &instructions_; } 1941 const ZoneList<LInstruction*>* instructions() const { return &instructions_; }
1940 void AddGapMove(int index, LOperand* from, LOperand* to); 1942 void AddGapMove(int index, LOperand* from, LOperand* to);
1941 LGap* GetGapAt(int index) const; 1943 LGap* GetGapAt(int index) const;
1942 bool IsGapAt(int index) const; 1944 bool IsGapAt(int index) const;
1943 int NearestGapPos(int index) const; 1945 int NearestGapPos(int index) const;
1944 void MarkEmptyBlocks(); 1946 void MarkEmptyBlocks();
1945 const ZoneList<LPointerMap*>* pointer_maps() const { return &pointer_maps_; } 1947 const ZoneList<LPointerMap*>* pointer_maps() const { return &pointer_maps_; }
1946 LLabel* GetLabel(int block_id) const { 1948 LLabel* GetLabel(int block_id) const {
1947 HBasicBlock* block = graph_->blocks()->at(block_id); 1949 HBasicBlock* block = graph_->blocks()->at(block_id);
(...skipping 16 matching lines...) Expand all
1964 const ZoneList<Handle<JSFunction> >* inlined_closures() const { 1966 const ZoneList<Handle<JSFunction> >* inlined_closures() const {
1965 return &inlined_closures_; 1967 return &inlined_closures_;
1966 } 1968 }
1967 1969
1968 void AddInlinedClosure(Handle<JSFunction> closure) { 1970 void AddInlinedClosure(Handle<JSFunction> closure) {
1969 inlined_closures_.Add(closure); 1971 inlined_closures_.Add(closure);
1970 } 1972 }
1971 1973
1972 private: 1974 private:
1973 int spill_slot_count_; 1975 int spill_slot_count_;
1976 CompilationInfo* info_;
1974 HGraph* const graph_; 1977 HGraph* const graph_;
1975 ZoneList<LInstruction*> instructions_; 1978 ZoneList<LInstruction*> instructions_;
1976 ZoneList<LPointerMap*> pointer_maps_; 1979 ZoneList<LPointerMap*> pointer_maps_;
1977 ZoneList<Handle<JSFunction> > inlined_closures_; 1980 ZoneList<Handle<JSFunction> > inlined_closures_;
1978 }; 1981 };
1979 1982
1980 1983
1981 class LChunkBuilder BASE_EMBEDDED { 1984 class LChunkBuilder BASE_EMBEDDED {
1982 public: 1985 public:
1983 LChunkBuilder(HGraph* graph, LAllocator* allocator) 1986 LChunkBuilder(CompilationInfo* info, HGraph* graph, LAllocator* allocator)
1984 : chunk_(NULL), 1987 : chunk_(NULL),
1988 info_(info),
1985 graph_(graph), 1989 graph_(graph),
1986 status_(UNUSED), 1990 status_(UNUSED),
1987 current_instruction_(NULL), 1991 current_instruction_(NULL),
1988 current_block_(NULL), 1992 current_block_(NULL),
1989 next_block_(NULL), 1993 next_block_(NULL),
1990 argument_count_(0), 1994 argument_count_(0),
1991 allocator_(allocator), 1995 allocator_(allocator),
1992 position_(RelocInfo::kNoPosition), 1996 position_(RelocInfo::kNoPosition),
1993 instruction_pending_deoptimization_environment_(NULL), 1997 instruction_pending_deoptimization_environment_(NULL),
1994 pending_deoptimization_ast_id_(AstNode::kNoNumber) { } 1998 pending_deoptimization_ast_id_(AstNode::kNoNumber) { }
1995 1999
1996 // Build the sequence for the graph. 2000 // Build the sequence for the graph.
1997 LChunk* Build(); 2001 LChunk* Build();
1998 2002
1999 // Declare methods that deal with the individual node types. 2003 // Declare methods that deal with the individual node types.
2000 #define DECLARE_DO(type) LInstruction* Do##type(H##type* node); 2004 #define DECLARE_DO(type) LInstruction* Do##type(H##type* node);
2001 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO) 2005 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO)
2002 #undef DECLARE_DO 2006 #undef DECLARE_DO
2003 2007
2004 private: 2008 private:
2005 enum Status { 2009 enum Status {
2006 UNUSED, 2010 UNUSED,
2007 BUILDING, 2011 BUILDING,
2008 DONE, 2012 DONE,
2009 ABORTED 2013 ABORTED
2010 }; 2014 };
2011 2015
2012 LChunk* chunk() const { return chunk_; } 2016 LChunk* chunk() const { return chunk_; }
2017 CompilationInfo* info() const { return info_; }
2013 HGraph* graph() const { return graph_; } 2018 HGraph* graph() const { return graph_; }
2014 2019
2015 bool is_unused() const { return status_ == UNUSED; } 2020 bool is_unused() const { return status_ == UNUSED; }
2016 bool is_building() const { return status_ == BUILDING; } 2021 bool is_building() const { return status_ == BUILDING; }
2017 bool is_done() const { return status_ == DONE; } 2022 bool is_done() const { return status_ == DONE; }
2018 bool is_aborted() const { return status_ == ABORTED; } 2023 bool is_aborted() const { return status_ == ABORTED; }
2019 2024
2020 void Abort(const char* format, ...); 2025 void Abort(const char* format, ...);
2021 2026
2022 // Methods for getting operands for Use / Define / Temp. 2027 // Methods for getting operands for Use / Define / Temp.
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
2109 2114
2110 void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block); 2115 void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block);
2111 LInstruction* DoBit(Token::Value op, HBitwiseBinaryOperation* instr); 2116 LInstruction* DoBit(Token::Value op, HBitwiseBinaryOperation* instr);
2112 LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr); 2117 LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr);
2113 LInstruction* DoArithmeticD(Token::Value op, 2118 LInstruction* DoArithmeticD(Token::Value op,
2114 HArithmeticBinaryOperation* instr); 2119 HArithmeticBinaryOperation* instr);
2115 LInstruction* DoArithmeticT(Token::Value op, 2120 LInstruction* DoArithmeticT(Token::Value op,
2116 HArithmeticBinaryOperation* instr); 2121 HArithmeticBinaryOperation* instr);
2117 2122
2118 LChunk* chunk_; 2123 LChunk* chunk_;
2124 CompilationInfo* info_;
2119 HGraph* const graph_; 2125 HGraph* const graph_;
2120 Status status_; 2126 Status status_;
2121 HInstruction* current_instruction_; 2127 HInstruction* current_instruction_;
2122 HBasicBlock* current_block_; 2128 HBasicBlock* current_block_;
2123 HBasicBlock* next_block_; 2129 HBasicBlock* next_block_;
2124 int argument_count_; 2130 int argument_count_;
2125 LAllocator* allocator_; 2131 LAllocator* allocator_;
2126 int position_; 2132 int position_;
2127 LInstruction* instruction_pending_deoptimization_environment_; 2133 LInstruction* instruction_pending_deoptimization_environment_;
2128 int pending_deoptimization_ast_id_; 2134 int pending_deoptimization_ast_id_;
2129 2135
2130 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); 2136 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
2131 }; 2137 };
2132 2138
2133 #undef DECLARE_HYDROGEN_ACCESSOR 2139 #undef DECLARE_HYDROGEN_ACCESSOR
2134 #undef DECLARE_INSTRUCTION 2140 #undef DECLARE_INSTRUCTION
2135 #undef DECLARE_CONCRETE_INSTRUCTION 2141 #undef DECLARE_CONCRETE_INSTRUCTION
2136 2142
2137 } } // namespace v8::internal 2143 } } // namespace v8::internal
2138 2144
2139 #endif // V8_IA32_LITHIUM_IA32_H_ 2145 #endif // V8_IA32_LITHIUM_IA32_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698