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 2301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2312 } | 2312 } |
2313 | 2313 |
2314 LOperand* object() { return inputs_[0]; } | 2314 LOperand* object() { return inputs_[0]; } |
2315 LOperand* index() { return inputs_[1]; } | 2315 LOperand* index() { return inputs_[1]; } |
2316 | 2316 |
2317 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex, "load-field-by-index") | 2317 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex, "load-field-by-index") |
2318 }; | 2318 }; |
2319 | 2319 |
2320 | 2320 |
2321 class LChunkBuilder; | 2321 class LChunkBuilder; |
2322 class LChunk: public ZoneObject { | 2322 class LChunk: public LChunkBase { |
2323 public: | 2323 public: |
2324 LChunk(CompilationInfo* info, HGraph* graph) | 2324 LChunk(CompilationInfo* info, HGraph* graph) |
2325 : spill_slot_count_(0), | 2325 : LChunkBase(info, graph), |
2326 num_double_slots_(0), | 2326 num_double_slots_(0) { } |
2327 info_(info), | |
2328 graph_(graph), | |
2329 instructions_(32, graph->zone()), | |
2330 pointer_maps_(8, graph->zone()), | |
2331 inlined_closures_(1, graph->zone()) { } | |
2332 | |
2333 void AddInstruction(LInstruction* instruction, HBasicBlock* block); | |
2334 LConstantOperand* DefineConstantOperand(HConstant* constant); | |
2335 Handle<Object> LookupLiteral(LConstantOperand* operand) const; | |
2336 Representation LookupLiteralRepresentation(LConstantOperand* operand) const; | |
2337 | 2327 |
2338 int GetNextSpillIndex(bool is_double); | 2328 int GetNextSpillIndex(bool is_double); |
2339 LOperand* GetNextSpillSlot(bool is_double); | 2329 LOperand* GetNextSpillSlot(bool is_double); |
2340 | 2330 |
2341 int ParameterAt(int index); | |
2342 int GetParameterStackSlot(int index) const; | |
2343 int spill_slot_count() const { return spill_slot_count_; } | |
2344 int num_double_slots() const { return num_double_slots_; } | 2331 int num_double_slots() const { return num_double_slots_; } |
2345 CompilationInfo* info() const { return info_; } | |
2346 HGraph* graph() const { return graph_; } | |
2347 const ZoneList<LInstruction*>* instructions() const { return &instructions_; } | |
2348 void AddGapMove(int index, LOperand* from, LOperand* to); | |
2349 LGap* GetGapAt(int index) const; | |
2350 bool IsGapAt(int index) const; | |
2351 int NearestGapPos(int index) const; | |
2352 void MarkEmptyBlocks(); | |
2353 const ZoneList<LPointerMap*>* pointer_maps() const { return &pointer_maps_; } | |
2354 LLabel* GetLabel(int block_id) const { | |
2355 HBasicBlock* block = graph_->blocks()->at(block_id); | |
2356 int first_instruction = block->first_instruction_index(); | |
2357 return LLabel::cast(instructions_[first_instruction]); | |
2358 } | |
2359 int LookupDestination(int block_id) const { | |
2360 LLabel* cur = GetLabel(block_id); | |
2361 while (cur->replacement() != NULL) { | |
2362 cur = cur->replacement(); | |
2363 } | |
2364 return cur->block_id(); | |
2365 } | |
2366 Label* GetAssemblyLabel(int block_id) const { | |
2367 LLabel* label = GetLabel(block_id); | |
2368 ASSERT(!label->HasReplacement()); | |
2369 return label->label(); | |
2370 } | |
2371 | |
2372 const ZoneList<Handle<JSFunction> >* inlined_closures() const { | |
2373 return &inlined_closures_; | |
2374 } | |
2375 | |
2376 void AddInlinedClosure(Handle<JSFunction> closure) { | |
2377 inlined_closures_.Add(closure, zone()); | |
2378 } | |
2379 | |
2380 Zone* zone() const { return graph_->zone(); } | |
2381 | 2332 |
2382 private: | 2333 private: |
2383 int spill_slot_count_; | |
2384 int num_double_slots_; | 2334 int num_double_slots_; |
2385 CompilationInfo* info_; | |
2386 HGraph* const graph_; | |
2387 ZoneList<LInstruction*> instructions_; | |
2388 ZoneList<LPointerMap*> pointer_maps_; | |
2389 ZoneList<Handle<JSFunction> > inlined_closures_; | |
2390 }; | 2335 }; |
2391 | 2336 |
2392 | 2337 |
2393 class LChunkBuilder BASE_EMBEDDED { | 2338 class LChunkBuilder BASE_EMBEDDED { |
2394 public: | 2339 public: |
2395 LChunkBuilder(CompilationInfo* info, HGraph* graph, LAllocator* allocator) | 2340 LChunkBuilder(CompilationInfo* info, HGraph* graph, LAllocator* allocator) |
2396 : chunk_(NULL), | 2341 : chunk_(NULL), |
2397 info_(info), | 2342 info_(info), |
2398 graph_(graph), | 2343 graph_(graph), |
2399 zone_(graph->zone()), | 2344 zone_(graph->zone()), |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2546 | 2491 |
2547 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); | 2492 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); |
2548 }; | 2493 }; |
2549 | 2494 |
2550 #undef DECLARE_HYDROGEN_ACCESSOR | 2495 #undef DECLARE_HYDROGEN_ACCESSOR |
2551 #undef DECLARE_CONCRETE_INSTRUCTION | 2496 #undef DECLARE_CONCRETE_INSTRUCTION |
2552 | 2497 |
2553 } } // namespace v8::internal | 2498 } } // namespace v8::internal |
2554 | 2499 |
2555 #endif // V8_IA32_LITHIUM_IA32_H_ | 2500 #endif // V8_IA32_LITHIUM_IA32_H_ |
OLD | NEW |