OLD | NEW |
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 2160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2171 } | 2171 } |
2172 | 2172 |
2173 LOperand* object() { return inputs_[0]; } | 2173 LOperand* object() { return inputs_[0]; } |
2174 LOperand* index() { return inputs_[1]; } | 2174 LOperand* index() { return inputs_[1]; } |
2175 | 2175 |
2176 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex, "load-field-by-index") | 2176 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex, "load-field-by-index") |
2177 }; | 2177 }; |
2178 | 2178 |
2179 | 2179 |
2180 class LChunkBuilder; | 2180 class LChunkBuilder; |
2181 class LChunk: public ZoneObject { | 2181 class LChunk: public LChunkBase { |
2182 public: | 2182 public: |
2183 LChunk(CompilationInfo* info, HGraph* graph) | 2183 LChunk(CompilationInfo* info, HGraph* graph) |
2184 : spill_slot_count_(0), | 2184 : LChunkBase(info, graph) { } |
2185 info_(info), | |
2186 graph_(graph), | |
2187 instructions_(32, graph->zone()), | |
2188 pointer_maps_(8, graph->zone()), | |
2189 inlined_closures_(1, graph->zone()) { } | |
2190 | |
2191 void AddInstruction(LInstruction* instruction, HBasicBlock* block); | |
2192 LConstantOperand* DefineConstantOperand(HConstant* constant); | |
2193 Handle<Object> LookupLiteral(LConstantOperand* operand) const; | |
2194 Representation LookupLiteralRepresentation(LConstantOperand* operand) const; | |
2195 | 2185 |
2196 int GetNextSpillIndex(bool is_double); | 2186 int GetNextSpillIndex(bool is_double); |
2197 LOperand* GetNextSpillSlot(bool is_double); | 2187 LOperand* GetNextSpillSlot(bool is_double); |
2198 | |
2199 int ParameterAt(int index); | |
2200 int GetParameterStackSlot(int index) const; | |
2201 int spill_slot_count() const { return spill_slot_count_; } | |
2202 CompilationInfo* info() const { return info_; } | |
2203 HGraph* graph() const { return graph_; } | |
2204 const ZoneList<LInstruction*>* instructions() const { return &instructions_; } | |
2205 void AddGapMove(int index, LOperand* from, LOperand* to); | |
2206 LGap* GetGapAt(int index) const; | |
2207 bool IsGapAt(int index) const; | |
2208 int NearestGapPos(int index) const; | |
2209 void MarkEmptyBlocks(); | |
2210 const ZoneList<LPointerMap*>* pointer_maps() const { return &pointer_maps_; } | |
2211 LLabel* GetLabel(int block_id) const { | |
2212 HBasicBlock* block = graph_->blocks()->at(block_id); | |
2213 int first_instruction = block->first_instruction_index(); | |
2214 return LLabel::cast(instructions_[first_instruction]); | |
2215 } | |
2216 int LookupDestination(int block_id) const { | |
2217 LLabel* cur = GetLabel(block_id); | |
2218 while (cur->replacement() != NULL) { | |
2219 cur = cur->replacement(); | |
2220 } | |
2221 return cur->block_id(); | |
2222 } | |
2223 Label* GetAssemblyLabel(int block_id) const { | |
2224 LLabel* label = GetLabel(block_id); | |
2225 ASSERT(!label->HasReplacement()); | |
2226 return label->label(); | |
2227 } | |
2228 | |
2229 const ZoneList<Handle<JSFunction> >* inlined_closures() const { | |
2230 return &inlined_closures_; | |
2231 } | |
2232 | |
2233 void AddInlinedClosure(Handle<JSFunction> closure) { | |
2234 inlined_closures_.Add(closure, zone()); | |
2235 } | |
2236 | |
2237 Zone* zone() const { return graph_->zone(); } | |
2238 | |
2239 private: | |
2240 int spill_slot_count_; | |
2241 CompilationInfo* info_; | |
2242 HGraph* const graph_; | |
2243 ZoneList<LInstruction*> instructions_; | |
2244 ZoneList<LPointerMap*> pointer_maps_; | |
2245 ZoneList<Handle<JSFunction> > inlined_closures_; | |
2246 }; | 2188 }; |
2247 | 2189 |
2248 | 2190 |
2249 class LChunkBuilder BASE_EMBEDDED { | 2191 class LChunkBuilder BASE_EMBEDDED { |
2250 public: | 2192 public: |
2251 LChunkBuilder(CompilationInfo* info, HGraph* graph, LAllocator* allocator) | 2193 LChunkBuilder(CompilationInfo* info, HGraph* graph, LAllocator* allocator) |
2252 : chunk_(NULL), | 2194 : chunk_(NULL), |
2253 info_(info), | 2195 info_(info), |
2254 graph_(graph), | 2196 graph_(graph), |
2255 zone_(graph->zone()), | 2197 zone_(graph->zone()), |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2402 | 2344 |
2403 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); | 2345 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); |
2404 }; | 2346 }; |
2405 | 2347 |
2406 #undef DECLARE_HYDROGEN_ACCESSOR | 2348 #undef DECLARE_HYDROGEN_ACCESSOR |
2407 #undef DECLARE_CONCRETE_INSTRUCTION | 2349 #undef DECLARE_CONCRETE_INSTRUCTION |
2408 | 2350 |
2409 } } // namespace v8::int | 2351 } } // namespace v8::int |
2410 | 2352 |
2411 #endif // V8_X64_LITHIUM_X64_H_ | 2353 #endif // V8_X64_LITHIUM_X64_H_ |
OLD | NEW |