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

Side by Side Diff: src/hydrogen.h

Issue 18496002: Factor out OSR-related graph-building functionality from hydrogen.cc. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Extract HOsrBuilder declaration to its own header file. Created 7 years, 5 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/hydrogen.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 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 28 matching lines...) Expand all
39 39
40 namespace v8 { 40 namespace v8 {
41 namespace internal { 41 namespace internal {
42 42
43 // Forward declarations. 43 // Forward declarations.
44 class BitVector; 44 class BitVector;
45 class FunctionState; 45 class FunctionState;
46 class HEnvironment; 46 class HEnvironment;
47 class HGraph; 47 class HGraph;
48 class HLoopInformation; 48 class HLoopInformation;
49 class HOsrBuilder;
49 class HTracer; 50 class HTracer;
50 class LAllocator; 51 class LAllocator;
51 class LChunk; 52 class LChunk;
52 class LiveRange; 53 class LiveRange;
53 54
54 55
55 class HBasicBlock: public ZoneObject { 56 class HBasicBlock: public ZoneObject {
56 public: 57 public:
57 explicit HBasicBlock(HGraph* graph); 58 explicit HBasicBlock(HGraph* graph);
58 virtual ~HBasicBlock() { } 59 virtual ~HBasicBlock() { }
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 if (id >= 0 && id < values_.length()) return values_[id]; 352 if (id >= 0 && id < values_.length()) return values_[id];
352 return NULL; 353 return NULL;
353 } 354 }
354 355
355 bool Optimize(SmartArrayPointer<char>* bailout_reason); 356 bool Optimize(SmartArrayPointer<char>* bailout_reason);
356 357
357 #ifdef DEBUG 358 #ifdef DEBUG
358 void Verify(bool do_full_verify) const; 359 void Verify(bool do_full_verify) const;
359 #endif 360 #endif
360 361
361 bool has_osr_loop_entry() { 362 bool has_osr() {
362 return osr_loop_entry_.is_set(); 363 return osr_ != NULL;
363 } 364 }
364 365
365 HBasicBlock* osr_loop_entry() { 366 void set_osr(HOsrBuilder* osr) {
366 return osr_loop_entry_.get(); 367 osr_ = osr;
367 } 368 }
368 369
369 void set_osr_loop_entry(HBasicBlock* entry) { 370 HOsrBuilder* osr() {
370 osr_loop_entry_.set(entry); 371 return osr_;
371 }
372
373 ZoneList<HUnknownOSRValue*>* osr_values() {
374 return osr_values_.get();
375 }
376
377 void set_osr_values(ZoneList<HUnknownOSRValue*>* values) {
378 osr_values_.set(values);
379 } 372 }
380 373
381 int update_type_change_checksum(int delta) { 374 int update_type_change_checksum(int delta) {
382 type_change_checksum_ += delta; 375 type_change_checksum_ += delta;
383 return type_change_checksum_; 376 return type_change_checksum_;
384 } 377 }
385 378
386 void update_maximum_environment_size(int environment_size) { 379 void update_maximum_environment_size(int environment_size) {
387 if (environment_size > maximum_environment_size_) { 380 if (environment_size > maximum_environment_size_) {
388 maximum_environment_size_ = environment_size; 381 maximum_environment_size_ = environment_size;
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 SetOncePointer<HConstant> constant_0_; 481 SetOncePointer<HConstant> constant_0_;
489 SetOncePointer<HConstant> constant_1_; 482 SetOncePointer<HConstant> constant_1_;
490 SetOncePointer<HConstant> constant_minus1_; 483 SetOncePointer<HConstant> constant_minus1_;
491 SetOncePointer<HConstant> constant_true_; 484 SetOncePointer<HConstant> constant_true_;
492 SetOncePointer<HConstant> constant_false_; 485 SetOncePointer<HConstant> constant_false_;
493 SetOncePointer<HConstant> constant_the_hole_; 486 SetOncePointer<HConstant> constant_the_hole_;
494 SetOncePointer<HConstant> constant_null_; 487 SetOncePointer<HConstant> constant_null_;
495 SetOncePointer<HConstant> constant_invalid_context_; 488 SetOncePointer<HConstant> constant_invalid_context_;
496 SetOncePointer<HArgumentsObject> arguments_object_; 489 SetOncePointer<HArgumentsObject> arguments_object_;
497 490
498 SetOncePointer<HBasicBlock> osr_loop_entry_; 491 HOsrBuilder* osr_;
499 SetOncePointer<ZoneList<HUnknownOSRValue*> > osr_values_;
500 492
501 CompilationInfo* info_; 493 CompilationInfo* info_;
502 Zone* zone_; 494 Zone* zone_;
503 495
504 bool is_recursive_; 496 bool is_recursive_;
505 bool use_optimistic_licm_; 497 bool use_optimistic_licm_;
506 bool has_soft_deoptimize_; 498 bool has_soft_deoptimize_;
507 bool depends_on_empty_array_proto_elements_; 499 bool depends_on_empty_array_proto_elements_;
508 int type_change_checksum_; 500 int type_change_checksum_;
509 int maximum_environment_size_; 501 int maximum_environment_size_;
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after
1431 HInstruction* BuildGetArrayFunction(HValue* context); 1423 HInstruction* BuildGetArrayFunction(HValue* context);
1432 1424
1433 private: 1425 private:
1434 HGraphBuilder(); 1426 HGraphBuilder();
1435 CompilationInfo* info_; 1427 CompilationInfo* info_;
1436 HGraph* graph_; 1428 HGraph* graph_;
1437 HBasicBlock* current_block_; 1429 HBasicBlock* current_block_;
1438 int no_side_effects_scope_count_; 1430 int no_side_effects_scope_count_;
1439 }; 1431 };
1440 1432
1441
1442 class HOptimizedGraphBuilder: public HGraphBuilder, public AstVisitor { 1433 class HOptimizedGraphBuilder: public HGraphBuilder, public AstVisitor {
1443 public: 1434 public:
1444 // A class encapsulating (lazily-allocated) break and continue blocks for 1435 // A class encapsulating (lazily-allocated) break and continue blocks for
1445 // a breakable statement. Separated from BreakAndContinueScope so that it 1436 // a breakable statement. Separated from BreakAndContinueScope so that it
1446 // can have a separate lifetime. 1437 // can have a separate lifetime.
1447 class BreakAndContinueInfo BASE_EMBEDDED { 1438 class BreakAndContinueInfo BASE_EMBEDDED {
1448 public: 1439 public:
1449 explicit BreakAndContinueInfo(BreakableStatement* target, 1440 explicit BreakAndContinueInfo(BreakableStatement* target,
1450 int drop_extra = 0) 1441 int drop_extra = 0)
1451 : target_(target), 1442 : target_(target),
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1589 void VisitTypeof(UnaryOperation* expr); 1580 void VisitTypeof(UnaryOperation* expr);
1590 void VisitSub(UnaryOperation* expr); 1581 void VisitSub(UnaryOperation* expr);
1591 void VisitBitNot(UnaryOperation* expr); 1582 void VisitBitNot(UnaryOperation* expr);
1592 void VisitNot(UnaryOperation* expr); 1583 void VisitNot(UnaryOperation* expr);
1593 1584
1594 void VisitComma(BinaryOperation* expr); 1585 void VisitComma(BinaryOperation* expr);
1595 void VisitLogicalExpression(BinaryOperation* expr); 1586 void VisitLogicalExpression(BinaryOperation* expr);
1596 void VisitArithmeticExpression(BinaryOperation* expr); 1587 void VisitArithmeticExpression(BinaryOperation* expr);
1597 1588
1598 bool PreProcessOsrEntry(IterationStatement* statement); 1589 bool PreProcessOsrEntry(IterationStatement* statement);
1599 // True iff. we are compiling for OSR and the statement is the entry.
1600 bool HasOsrEntryAt(IterationStatement* statement);
1601 void VisitLoopBody(IterationStatement* stmt, 1590 void VisitLoopBody(IterationStatement* stmt,
1602 HBasicBlock* loop_entry, 1591 HBasicBlock* loop_entry,
1603 BreakAndContinueInfo* break_info); 1592 BreakAndContinueInfo* break_info);
1604 1593
1605 // Create a back edge in the flow graph. body_exit is the predecessor 1594 // Create a back edge in the flow graph. body_exit is the predecessor
1606 // block and loop_entry is the successor block. loop_successor is the 1595 // block and loop_entry is the successor block. loop_successor is the
1607 // block where control flow exits the loop normally (e.g., via failure of 1596 // block where control flow exits the loop normally (e.g., via failure of
1608 // the condition) and break_block is the block where control flow breaks 1597 // the condition) and break_block is the block where control flow breaks
1609 // from the loop. All blocks except loop_entry can be NULL. The return 1598 // from the loop. All blocks except loop_entry can be NULL. The return
1610 // value is the new successor block which is the join of loop_successor 1599 // value is the new successor block which is the join of loop_successor
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
1952 AstContext* ast_context_; 1941 AstContext* ast_context_;
1953 1942
1954 // A stack of breakable statements entered. 1943 // A stack of breakable statements entered.
1955 BreakAndContinueScope* break_scope_; 1944 BreakAndContinueScope* break_scope_;
1956 1945
1957 int inlined_count_; 1946 int inlined_count_;
1958 ZoneList<Handle<Object> > globals_; 1947 ZoneList<Handle<Object> > globals_;
1959 1948
1960 bool inline_bailout_; 1949 bool inline_bailout_;
1961 1950
1951 HOsrBuilder* osr_;
1952
1962 friend class FunctionState; // Pushes and pops the state stack. 1953 friend class FunctionState; // Pushes and pops the state stack.
1963 friend class AstContext; // Pushes and pops the AST context stack. 1954 friend class AstContext; // Pushes and pops the AST context stack.
1964 friend class KeyedLoadFastElementStub; 1955 friend class KeyedLoadFastElementStub;
1956 friend class HOsrBuilder;
1965 1957
1966 DISALLOW_COPY_AND_ASSIGN(HOptimizedGraphBuilder); 1958 DISALLOW_COPY_AND_ASSIGN(HOptimizedGraphBuilder);
1967 }; 1959 };
1968 1960
1969 1961
1970 Zone* AstContext::zone() const { return owner_->zone(); } 1962 Zone* AstContext::zone() const { return owner_->zone(); }
1971 1963
1972 1964
1973 class HStatistics: public Malloced { 1965 class HStatistics: public Malloced {
1974 public: 1966 public:
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
2107 EmbeddedVector<char, 64> filename_; 2099 EmbeddedVector<char, 64> filename_;
2108 HeapStringAllocator string_allocator_; 2100 HeapStringAllocator string_allocator_;
2109 StringStream trace_; 2101 StringStream trace_;
2110 int indent_; 2102 int indent_;
2111 }; 2103 };
2112 2104
2113 2105
2114 } } // namespace v8::internal 2106 } } // namespace v8::internal
2115 2107
2116 #endif // V8_HYDROGEN_H_ 2108 #endif // V8_HYDROGEN_H_
OLDNEW
« no previous file with comments | « no previous file | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698