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

Side by Side Diff: src/fast-codegen.h

Issue 566008: Incorporate the arguments to the code generator constructors and their (Closed)
Patch Set: Incorporate the arguments to the code generator constructors and their... Created 10 years, 10 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
« no previous file with comments | « src/data-flow.cc ('k') | src/fast-codegen.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 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 24 matching lines...) Expand all
35 35
36 namespace v8 { 36 namespace v8 {
37 namespace internal { 37 namespace internal {
38 38
39 class FastCodeGenSyntaxChecker: public AstVisitor { 39 class FastCodeGenSyntaxChecker: public AstVisitor {
40 public: 40 public:
41 explicit FastCodeGenSyntaxChecker() 41 explicit FastCodeGenSyntaxChecker()
42 : info_(NULL), has_supported_syntax_(true) { 42 : info_(NULL), has_supported_syntax_(true) {
43 } 43 }
44 44
45 void Check(FunctionLiteral* fun, CompilationInfo* info); 45 void Check(CompilationInfo* info);
46 46
47 CompilationInfo* info() { return info_; } 47 CompilationInfo* info() { return info_; }
48 bool has_supported_syntax() { return has_supported_syntax_; } 48 bool has_supported_syntax() { return has_supported_syntax_; }
49 49
50 private: 50 private:
51 void VisitDeclarations(ZoneList<Declaration*>* decls); 51 void VisitDeclarations(ZoneList<Declaration*>* decls);
52 void VisitStatements(ZoneList<Statement*>* stmts); 52 void VisitStatements(ZoneList<Statement*>* stmts);
53 53
54 // AST node visit functions. 54 // AST node visit functions.
55 #define DECLARE_VISIT(type) virtual void Visit##type(type* node); 55 #define DECLARE_VISIT(type) virtual void Visit##type(type* node);
56 AST_NODE_LIST(DECLARE_VISIT) 56 AST_NODE_LIST(DECLARE_VISIT)
57 #undef DECLARE_VISIT 57 #undef DECLARE_VISIT
58 58
59 CompilationInfo* info_; 59 CompilationInfo* info_;
60 bool has_supported_syntax_; 60 bool has_supported_syntax_;
61 61
62 DISALLOW_COPY_AND_ASSIGN(FastCodeGenSyntaxChecker); 62 DISALLOW_COPY_AND_ASSIGN(FastCodeGenSyntaxChecker);
63 }; 63 };
64 64
65 65
66 class FastCodeGenerator: public AstVisitor { 66 class FastCodeGenerator: public AstVisitor {
67 public: 67 public:
68 FastCodeGenerator(MacroAssembler* masm, Handle<Script> script, bool is_eval) 68 FastCodeGenerator(MacroAssembler* masm) : masm_(masm), info_(NULL) {}
69 : masm_(masm),
70 script_(script),
71 is_eval_(is_eval),
72 function_(NULL),
73 info_(NULL) {
74 }
75 69
76 static Handle<Code> MakeCode(FunctionLiteral* fun, 70 static Handle<Code> MakeCode(CompilationInfo* info);
77 Handle<Script> script,
78 bool is_eval,
79 CompilationInfo* info);
80 71
81 void Generate(FunctionLiteral* fun, CompilationInfo* info); 72 void Generate(CompilationInfo* info);
82 73
83 private: 74 private:
84 MacroAssembler* masm() { return masm_; } 75 MacroAssembler* masm() { return masm_; }
85 FunctionLiteral* function() { return function_; }
86 Label* bailout() { return &bailout_; } 76 Label* bailout() { return &bailout_; }
87 77
88 bool has_receiver() { return !info_->receiver().is_null(); } 78 bool has_receiver() { return !info_->receiver().is_null(); }
89 Handle<Object> receiver() { return info_->receiver(); } 79 Handle<Object> receiver() { return info_->receiver(); }
90 bool has_this_properties() { return info_->has_this_properties(); } 80 bool has_this_properties() { return info_->has_this_properties(); }
81 FunctionLiteral* function() { return info_->function(); }
82 Scope* scope() { return info_->scope(); }
91 83
92 // AST node visit functions. 84 // AST node visit functions.
93 #define DECLARE_VISIT(type) virtual void Visit##type(type* node); 85 #define DECLARE_VISIT(type) virtual void Visit##type(type* node);
94 AST_NODE_LIST(DECLARE_VISIT) 86 AST_NODE_LIST(DECLARE_VISIT)
95 #undef DECLARE_VISIT 87 #undef DECLARE_VISIT
96 88
97 // Emit code to load the receiver from the stack into a given register. 89 // Emit code to load the receiver from the stack into a given register.
98 void EmitLoadReceiver(Register reg); 90 void EmitLoadReceiver(Register reg);
99 91
100 // Emit code to check that the receiver has the same map as the 92 // Emit code to check that the receiver has the same map as the
101 // compile-time receiver. Receiver is expected in {ia32-edx, x64-rdx, 93 // compile-time receiver. Receiver is expected in {ia32-edx, x64-rdx,
102 // arm-r1}. Emit a branch to the (single) bailout label if check fails. 94 // arm-r1}. Emit a branch to the (single) bailout label if check fails.
103 void EmitReceiverMapCheck(); 95 void EmitReceiverMapCheck();
104 96
105 // Emit code to load a global variable value into {is32-eax, x64-rax, 97 // Emit code to load a global variable value into {is32-eax, x64-rax,
106 // arm-r0}. Register {ia32-edx, x64-rdx, arm-r1} is preserved if it is 98 // arm-r0}. Register {ia32-edx, x64-rdx, arm-r1} is preserved if it is
107 // holding the receiver and {is32-ecx, x64-rcx, arm-r2} is always 99 // holding the receiver and {is32-ecx, x64-rcx, arm-r2} is always
108 // clobbered. 100 // clobbered.
109 void EmitGlobalVariableLoad(Handle<String> name); 101 void EmitGlobalVariableLoad(Handle<String> name);
110 102
111 // Emit a store to an own property of this. The stored value is expected 103 // Emit a store to an own property of this. The stored value is expected
112 // in {ia32-eax, x64-rax, arm-r0} and the receiver in {is32-edx, x64-rdx, 104 // in {ia32-eax, x64-rax, arm-r0} and the receiver in {is32-edx, x64-rdx,
113 // arm-r1}. Both are preserve. 105 // arm-r1}. Both are preserve.
114 void EmitThisPropertyStore(Handle<String> name); 106 void EmitThisPropertyStore(Handle<String> name);
115 107
116 MacroAssembler* masm_; 108 MacroAssembler* masm_;
117 Handle<Script> script_;
118 bool is_eval_;
119 109
120 FunctionLiteral* function_;
121 CompilationInfo* info_; 110 CompilationInfo* info_;
122 111
123 Label bailout_; 112 Label bailout_;
124 113
125 DISALLOW_COPY_AND_ASSIGN(FastCodeGenerator); 114 DISALLOW_COPY_AND_ASSIGN(FastCodeGenerator);
126 }; 115 };
127 116
128 117
129 } } // namespace v8::internal 118 } } // namespace v8::internal
130 119
131 #endif // V8_FAST_CODEGEN_H_ 120 #endif // V8_FAST_CODEGEN_H_
OLDNEW
« no previous file with comments | « src/data-flow.cc ('k') | src/fast-codegen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698