OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 #define DECLARE_VISIT(type) virtual void Visit##type(type* node); | 52 #define DECLARE_VISIT(type) virtual void Visit##type(type* node); |
53 AST_NODE_LIST(DECLARE_VISIT) | 53 AST_NODE_LIST(DECLARE_VISIT) |
54 #undef DECLARE_VISIT | 54 #undef DECLARE_VISIT |
55 | 55 |
56 bool has_supported_syntax_; | 56 bool has_supported_syntax_; |
57 | 57 |
58 DISALLOW_COPY_AND_ASSIGN(FullCodeGenSyntaxChecker); | 58 DISALLOW_COPY_AND_ASSIGN(FullCodeGenSyntaxChecker); |
59 }; | 59 }; |
60 | 60 |
61 | 61 |
| 62 // AST node visitor which can tell whether a given statement will be breakable |
| 63 // when the code is compiled by the full compiler in the debugger. This means |
| 64 // that there will be an IC (load/store/call) in the code generated for the |
| 65 // debugger to piggybag on. |
| 66 class BreakableStatementChecker: public AstVisitor { |
| 67 public: |
| 68 BreakableStatementChecker() : is_breakable_(false) {} |
| 69 |
| 70 void Check(Statement* stmt); |
| 71 void Check(Expression* stmt); |
| 72 |
| 73 bool is_breakable() { return is_breakable_; } |
| 74 |
| 75 private: |
| 76 // AST node visit functions. |
| 77 #define DECLARE_VISIT(type) virtual void Visit##type(type* node); |
| 78 AST_NODE_LIST(DECLARE_VISIT) |
| 79 #undef DECLARE_VISIT |
| 80 |
| 81 bool is_breakable_; |
| 82 |
| 83 DISALLOW_COPY_AND_ASSIGN(BreakableStatementChecker); |
| 84 }; |
| 85 |
| 86 |
62 // ----------------------------------------------------------------------------- | 87 // ----------------------------------------------------------------------------- |
63 // Full code generator. | 88 // Full code generator. |
64 | 89 |
65 class FullCodeGenerator: public AstVisitor { | 90 class FullCodeGenerator: public AstVisitor { |
66 public: | 91 public: |
67 enum Mode { | 92 enum Mode { |
68 PRIMARY, | 93 PRIMARY, |
69 SECONDARY | 94 SECONDARY |
70 }; | 95 }; |
71 | 96 |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 void EmitNullCompare(bool strict, | 476 void EmitNullCompare(bool strict, |
452 Register obj, | 477 Register obj, |
453 Register null_const, | 478 Register null_const, |
454 Label* if_true, | 479 Label* if_true, |
455 Label* if_false, | 480 Label* if_false, |
456 Register scratch); | 481 Register scratch); |
457 | 482 |
458 void SetFunctionPosition(FunctionLiteral* fun); | 483 void SetFunctionPosition(FunctionLiteral* fun); |
459 void SetReturnPosition(FunctionLiteral* fun); | 484 void SetReturnPosition(FunctionLiteral* fun); |
460 void SetStatementPosition(Statement* stmt); | 485 void SetStatementPosition(Statement* stmt); |
| 486 void SetExpressionPosition(Expression* expr, int pos); |
461 void SetStatementPosition(int pos); | 487 void SetStatementPosition(int pos); |
462 void SetSourcePosition(int pos); | 488 void SetSourcePosition(int pos); |
463 | 489 |
464 // Non-local control flow support. | 490 // Non-local control flow support. |
465 void EnterFinallyBlock(); | 491 void EnterFinallyBlock(); |
466 void ExitFinallyBlock(); | 492 void ExitFinallyBlock(); |
467 | 493 |
468 // Loop nesting counter. | 494 // Loop nesting counter. |
469 int loop_depth() { return loop_depth_; } | 495 int loop_depth() { return loop_depth_; } |
470 void increment_loop_depth() { loop_depth_++; } | 496 void increment_loop_depth() { loop_depth_++; } |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 | 538 |
513 friend class NestedStatement; | 539 friend class NestedStatement; |
514 | 540 |
515 DISALLOW_COPY_AND_ASSIGN(FullCodeGenerator); | 541 DISALLOW_COPY_AND_ASSIGN(FullCodeGenerator); |
516 }; | 542 }; |
517 | 543 |
518 | 544 |
519 } } // namespace v8::internal | 545 } } // namespace v8::internal |
520 | 546 |
521 #endif // V8_FULL_CODEGEN_H_ | 547 #endif // V8_FULL_CODEGEN_H_ |
OLD | NEW |