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

Side by Side Diff: src/compiler.h

Issue 5699002: RFC: Switch to ast ids (instead of positions) for type feedback. (Closed)
Patch Set: Cleanup Created 10 years 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
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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 bool is_in_loop() const { return (flags_ & IsInLoop::mask()) != 0; } 52 bool is_in_loop() const { return (flags_ & IsInLoop::mask()) != 0; }
53 FunctionLiteral* function() const { return function_; } 53 FunctionLiteral* function() const { return function_; }
54 Scope* scope() const { return scope_; } 54 Scope* scope() const { return scope_; }
55 Handle<Code> code() const { return code_; } 55 Handle<Code> code() const { return code_; }
56 Handle<JSFunction> closure() const { return closure_; } 56 Handle<JSFunction> closure() const { return closure_; }
57 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; } 57 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; }
58 Handle<Script> script() const { return script_; } 58 Handle<Script> script() const { return script_; }
59 v8::Extension* extension() const { return extension_; } 59 v8::Extension* extension() const { return extension_; }
60 ScriptDataImpl* pre_parse_data() const { return pre_parse_data_; } 60 ScriptDataImpl* pre_parse_data() const { return pre_parse_data_; }
61 Handle<Context> calling_context() const { return calling_context_; } 61 Handle<Context> calling_context() const { return calling_context_; }
62 int osr_ast_id() const { return osr_ast_id_; } 62 AstId osr_ast_id() const { return osr_ast_id_; }
63 63
64 void MarkAsEval() { 64 void MarkAsEval() {
65 ASSERT(!is_lazy()); 65 ASSERT(!is_lazy());
66 flags_ |= IsEval::encode(true); 66 flags_ |= IsEval::encode(true);
67 } 67 }
68 void MarkAsGlobal() { 68 void MarkAsGlobal() {
69 ASSERT(!is_lazy()); 69 ASSERT(!is_lazy());
70 flags_ |= IsGlobal::encode(true); 70 flags_ |= IsGlobal::encode(true);
71 } 71 }
72 void MarkAsInLoop() { 72 void MarkAsInLoop() {
(...skipping 30 matching lines...) Expand all
103 return !closure().is_null() && (closure()->context()->global() != NULL); 103 return !closure().is_null() && (closure()->context()->global() != NULL);
104 } 104 }
105 105
106 GlobalObject* global_object() const { 106 GlobalObject* global_object() const {
107 return has_global_object() ? closure()->context()->global() : NULL; 107 return has_global_object() ? closure()->context()->global() : NULL;
108 } 108 }
109 109
110 // Accessors for the different compilation modes. 110 // Accessors for the different compilation modes.
111 bool IsOptimizing() const { return mode_ == OPTIMIZE; } 111 bool IsOptimizing() const { return mode_ == OPTIMIZE; }
112 bool IsOptimizable() const { return mode_ == BASE; } 112 bool IsOptimizable() const { return mode_ == BASE; }
113 void SetOptimizing(int osr_ast_id) { 113 void SetOptimizing(AstId osr_ast_id) {
114 SetMode(OPTIMIZE); 114 SetMode(OPTIMIZE);
115 osr_ast_id_ = osr_ast_id; 115 osr_ast_id_ = osr_ast_id;
116 } 116 }
117 void DisableOptimization() { SetMode(NONOPT); } 117 void DisableOptimization() { SetMode(NONOPT); }
118 118
119 // Deoptimization support. 119 // Deoptimization support.
120 bool HasDeoptimizationSupport() const { return supports_deoptimization_; } 120 bool HasDeoptimizationSupport() const { return supports_deoptimization_; }
121 void EnableDeoptimizationSupport() { 121 void EnableDeoptimizationSupport() {
122 ASSERT(IsOptimizable()); 122 ASSERT(IsOptimizable());
123 supports_deoptimization_ = true; 123 supports_deoptimization_ = true;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 v8::Extension* extension_; 185 v8::Extension* extension_;
186 ScriptDataImpl* pre_parse_data_; 186 ScriptDataImpl* pre_parse_data_;
187 187
188 // The context of the caller is needed for eval code, and will be a null 188 // The context of the caller is needed for eval code, and will be a null
189 // handle otherwise. 189 // handle otherwise.
190 Handle<Context> calling_context_; 190 Handle<Context> calling_context_;
191 191
192 // Compilation mode flag and whether deoptimization is allowed. 192 // Compilation mode flag and whether deoptimization is allowed.
193 Mode mode_; 193 Mode mode_;
194 bool supports_deoptimization_; 194 bool supports_deoptimization_;
195 int osr_ast_id_; 195 AstId osr_ast_id_;
196 196
197 DISALLOW_COPY_AND_ASSIGN(CompilationInfo); 197 DISALLOW_COPY_AND_ASSIGN(CompilationInfo);
198 }; 198 };
199 199
200 200
201 // The V8 compiler 201 // The V8 compiler
202 // 202 //
203 // General strategy: Source code is translated into an anonymous function w/o 203 // General strategy: Source code is translated into an anonymous function w/o
204 // parameters which then can be executed. If the source code contains other 204 // parameters which then can be executed. If the source code contains other
205 // functions, they will be compiled and allocated as part of the compilation 205 // functions, they will be compiled and allocated as part of the compilation
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 FrameElement::ClearConstantList(); 267 FrameElement::ClearConstantList();
268 Result::ClearConstantList(); 268 Result::ClearConstantList();
269 } 269 }
270 } 270 }
271 }; 271 };
272 272
273 273
274 } } // namespace v8::internal 274 } } // namespace v8::internal
275 275
276 #endif // V8_COMPILER_H_ 276 #endif // V8_COMPILER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698