OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_FULL_CODEGEN_H_ | 5 #ifndef V8_FULL_CODEGEN_H_ |
6 #define V8_FULL_CODEGEN_H_ | 6 #define V8_FULL_CODEGEN_H_ |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
11 #include "src/assert-scope.h" | 11 #include "src/assert-scope.h" |
12 #include "src/ast.h" | 12 #include "src/ast.h" |
13 #include "src/bit-vector.h" | 13 #include "src/bit-vector.h" |
14 #include "src/code-stubs.h" | 14 #include "src/code-stubs.h" |
15 #include "src/codegen.h" | 15 #include "src/codegen.h" |
16 #include "src/compiler.h" | 16 #include "src/compiler.h" |
17 #include "src/globals.h" | 17 #include "src/globals.h" |
18 #include "src/objects.h" | 18 #include "src/objects.h" |
19 #include "src/scopes.h" | 19 #include "src/scopes.h" |
20 | 20 |
21 namespace v8 { | 21 namespace v8 { |
22 namespace internal { | 22 namespace internal { |
23 | 23 |
24 // Forward declarations. | 24 // Forward declarations. |
25 class JumpPatchSite; | 25 class JumpPatchSite; |
26 | 26 |
27 // AST node visitor which can tell whether a given statement will be breakable | |
28 // when the code is compiled by the full compiler in the debugger. This means | |
29 // that there will be an IC (load/store/call) in the code generated for the | |
30 // debugger to piggybag on. | |
31 class BreakableStatementChecker: public AstVisitor { | |
32 public: | |
33 BreakableStatementChecker(Isolate* isolate, Zone* zone) | |
34 : is_breakable_(false) { | |
35 InitializeAstVisitor(isolate, zone); | |
36 } | |
37 | |
38 void Check(Statement* stmt); | |
39 void Check(Expression* stmt); | |
40 | |
41 bool is_breakable() { return is_breakable_; } | |
42 | |
43 private: | |
44 // AST node visit functions. | |
45 #define DECLARE_VISIT(type) virtual void Visit##type(type* node) override; | |
46 AST_NODE_LIST(DECLARE_VISIT) | |
47 #undef DECLARE_VISIT | |
48 | |
49 bool is_breakable_; | |
50 | |
51 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); | |
52 DISALLOW_COPY_AND_ASSIGN(BreakableStatementChecker); | |
53 }; | |
54 | |
55 | |
56 // ----------------------------------------------------------------------------- | 27 // ----------------------------------------------------------------------------- |
57 // Full code generator. | 28 // Full code generator. |
58 | 29 |
59 class FullCodeGenerator: public AstVisitor { | 30 class FullCodeGenerator: public AstVisitor { |
60 public: | 31 public: |
61 enum State { | 32 enum State { |
62 NO_REGISTERS, | 33 NO_REGISTERS, |
63 TOS_REG | 34 TOS_REG |
64 }; | 35 }; |
65 | 36 |
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
681 void CallIC(Handle<Code> code, | 652 void CallIC(Handle<Code> code, |
682 TypeFeedbackId id = TypeFeedbackId::None()); | 653 TypeFeedbackId id = TypeFeedbackId::None()); |
683 | 654 |
684 void CallLoadIC(ContextualMode mode, LanguageMode language_mode = SLOPPY, | 655 void CallLoadIC(ContextualMode mode, LanguageMode language_mode = SLOPPY, |
685 TypeFeedbackId id = TypeFeedbackId::None()); | 656 TypeFeedbackId id = TypeFeedbackId::None()); |
686 void CallGlobalLoadIC(Handle<String> name); | 657 void CallGlobalLoadIC(Handle<String> name); |
687 void CallStoreIC(TypeFeedbackId id = TypeFeedbackId::None()); | 658 void CallStoreIC(TypeFeedbackId id = TypeFeedbackId::None()); |
688 | 659 |
689 void SetFunctionPosition(FunctionLiteral* fun); | 660 void SetFunctionPosition(FunctionLiteral* fun); |
690 void SetReturnPosition(FunctionLiteral* fun); | 661 void SetReturnPosition(FunctionLiteral* fun); |
691 void SetStatementPosition(Statement* stmt); | 662 |
692 void SetExpressionPosition(Expression* expr); | 663 enum InsertBreak { INSERT_BREAK, SKIP_BREAK }; |
693 void SetSourcePosition(int pos); | 664 |
665 void SetStatementPosition(Statement* stmt, | |
ulan
2015/07/06 09:24:19
Can we make the insert_break explicit in SetStatem
Yang
2015/07/06 10:05:08
The background here is that we generally break at
| |
666 InsertBreak insert_break = INSERT_BREAK); | |
667 | |
668 void SetExpressionPosition(Expression* expr, | |
669 InsertBreak insert_break = SKIP_BREAK); | |
670 | |
671 // Emit statement position for an expression. Used in loop headers where we | |
672 // want to be able to break at the header for each iteration. | |
673 void SetExpressionAsStatementPosition(Expression* expr); | |
694 | 674 |
695 // Non-local control flow support. | 675 // Non-local control flow support. |
696 void EnterTryBlock(int handler_index, Label* handler); | 676 void EnterTryBlock(int handler_index, Label* handler); |
697 void ExitTryBlock(int handler_index); | 677 void ExitTryBlock(int handler_index); |
698 void EnterFinallyBlock(); | 678 void EnterFinallyBlock(); |
699 void ExitFinallyBlock(); | 679 void ExitFinallyBlock(); |
700 void ClearPendingMessage(); | 680 void ClearPendingMessage(); |
701 | 681 |
702 // Loop nesting counter. | 682 // Loop nesting counter. |
703 int loop_depth() { return loop_depth_; } | 683 int loop_depth() { return loop_depth_; } |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1098 | 1078 |
1099 Address start_; | 1079 Address start_; |
1100 Address instruction_start_; | 1080 Address instruction_start_; |
1101 uint32_t length_; | 1081 uint32_t length_; |
1102 }; | 1082 }; |
1103 | 1083 |
1104 | 1084 |
1105 } } // namespace v8::internal | 1085 } } // namespace v8::internal |
1106 | 1086 |
1107 #endif // V8_FULL_CODEGEN_H_ | 1087 #endif // V8_FULL_CODEGEN_H_ |
OLD | NEW |