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

Side by Side Diff: src/compiler.h

Issue 6804024: Strict mode renamings. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 8 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 | « src/arm/lithium-codegen-arm.cc ('k') | src/compiler.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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 explicit CompilationInfo(Handle<SharedFunctionInfo> shared_info); 46 explicit CompilationInfo(Handle<SharedFunctionInfo> shared_info);
47 explicit CompilationInfo(Handle<JSFunction> closure); 47 explicit CompilationInfo(Handle<JSFunction> closure);
48 48
49 Isolate* isolate() { 49 Isolate* isolate() {
50 ASSERT(Isolate::Current() == isolate_); 50 ASSERT(Isolate::Current() == isolate_);
51 return isolate_; 51 return isolate_;
52 } 52 }
53 bool is_lazy() const { return (flags_ & IsLazy::mask()) != 0; } 53 bool is_lazy() const { return (flags_ & IsLazy::mask()) != 0; }
54 bool is_eval() const { return (flags_ & IsEval::mask()) != 0; } 54 bool is_eval() const { return (flags_ & IsEval::mask()) != 0; }
55 bool is_global() const { return (flags_ & IsGlobal::mask()) != 0; } 55 bool is_global() const { return (flags_ & IsGlobal::mask()) != 0; }
56 bool is_strict() const { return (flags_ & IsStrict::mask()) != 0; } 56 bool is_strict_mode() const { return (flags_ & IsStrictMode::mask()) != 0; }
57 bool is_in_loop() const { return (flags_ & IsInLoop::mask()) != 0; } 57 bool is_in_loop() const { return (flags_ & IsInLoop::mask()) != 0; }
58 FunctionLiteral* function() const { return function_; } 58 FunctionLiteral* function() const { return function_; }
59 Scope* scope() const { return scope_; } 59 Scope* scope() const { return scope_; }
60 Handle<Code> code() const { return code_; } 60 Handle<Code> code() const { return code_; }
61 Handle<JSFunction> closure() const { return closure_; } 61 Handle<JSFunction> closure() const { return closure_; }
62 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; } 62 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; }
63 Handle<Script> script() const { return script_; } 63 Handle<Script> script() const { return script_; }
64 v8::Extension* extension() const { return extension_; } 64 v8::Extension* extension() const { return extension_; }
65 ScriptDataImpl* pre_parse_data() const { return pre_parse_data_; } 65 ScriptDataImpl* pre_parse_data() const { return pre_parse_data_; }
66 Handle<Context> calling_context() const { return calling_context_; } 66 Handle<Context> calling_context() const { return calling_context_; }
67 int osr_ast_id() const { return osr_ast_id_; } 67 int osr_ast_id() const { return osr_ast_id_; }
68 68
69 void MarkAsEval() { 69 void MarkAsEval() {
70 ASSERT(!is_lazy()); 70 ASSERT(!is_lazy());
71 flags_ |= IsEval::encode(true); 71 flags_ |= IsEval::encode(true);
72 } 72 }
73 void MarkAsGlobal() { 73 void MarkAsGlobal() {
74 ASSERT(!is_lazy()); 74 ASSERT(!is_lazy());
75 flags_ |= IsGlobal::encode(true); 75 flags_ |= IsGlobal::encode(true);
76 } 76 }
77 void MarkAsStrict() { 77 void MarkAsStrictMode() {
78 flags_ |= IsStrict::encode(true); 78 flags_ |= IsStrictMode::encode(true);
79 } 79 }
80 StrictModeFlag StrictMode() { 80 StrictModeFlag StrictMode() {
81 return is_strict() ? kStrictMode : kNonStrictMode; 81 return is_strict_mode() ? kStrictMode : kNonStrictMode;
82 } 82 }
83 void MarkAsInLoop() { 83 void MarkAsInLoop() {
84 ASSERT(is_lazy()); 84 ASSERT(is_lazy());
85 flags_ |= IsInLoop::encode(true); 85 flags_ |= IsInLoop::encode(true);
86 } 86 }
87 void MarkAsAllowingNativesSyntax() { 87 void MarkAsAllowingNativesSyntax() {
88 flags_ |= IsNativesSyntaxAllowed::encode(true); 88 flags_ |= IsNativesSyntaxAllowed::encode(true);
89 } 89 }
90 bool allows_natives_syntax() const { 90 bool allows_natives_syntax() const {
91 return IsNativesSyntaxAllowed::decode(flags_); 91 return IsNativesSyntaxAllowed::decode(flags_);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 BASE, 158 BASE,
159 OPTIMIZE, 159 OPTIMIZE,
160 NONOPT 160 NONOPT
161 }; 161 };
162 162
163 CompilationInfo() : function_(NULL) {} 163 CompilationInfo() : function_(NULL) {}
164 164
165 void Initialize(Mode mode) { 165 void Initialize(Mode mode) {
166 mode_ = V8::UseCrankshaft() ? mode : NONOPT; 166 mode_ = V8::UseCrankshaft() ? mode : NONOPT;
167 if (!shared_info_.is_null() && shared_info_->strict_mode()) { 167 if (!shared_info_.is_null() && shared_info_->strict_mode()) {
168 MarkAsStrict(); 168 MarkAsStrictMode();
169 } 169 }
170 } 170 }
171 171
172 void SetMode(Mode mode) { 172 void SetMode(Mode mode) {
173 ASSERT(V8::UseCrankshaft()); 173 ASSERT(V8::UseCrankshaft());
174 mode_ = mode; 174 mode_ = mode;
175 } 175 }
176 176
177 // Flags using template class BitField<type, start, length>. All are 177 // Flags using template class BitField<type, start, length>. All are
178 // false by default. 178 // false by default.
179 // 179 //
180 // Compilation is either eager or lazy. 180 // Compilation is either eager or lazy.
181 class IsLazy: public BitField<bool, 0, 1> {}; 181 class IsLazy: public BitField<bool, 0, 1> {};
182 // Flags that can be set for eager compilation. 182 // Flags that can be set for eager compilation.
183 class IsEval: public BitField<bool, 1, 1> {}; 183 class IsEval: public BitField<bool, 1, 1> {};
184 class IsGlobal: public BitField<bool, 2, 1> {}; 184 class IsGlobal: public BitField<bool, 2, 1> {};
185 // Flags that can be set for lazy compilation. 185 // Flags that can be set for lazy compilation.
186 class IsInLoop: public BitField<bool, 3, 1> {}; 186 class IsInLoop: public BitField<bool, 3, 1> {};
187 // Strict mode - used in eager compilation. 187 // Strict mode - used in eager compilation.
188 class IsStrict: public BitField<bool, 4, 1> {}; 188 class IsStrictMode: public BitField<bool, 4, 1> {};
189 // Native syntax (%-stuff) allowed? 189 // Native syntax (%-stuff) allowed?
190 class IsNativesSyntaxAllowed: public BitField<bool, 5, 1> {}; 190 class IsNativesSyntaxAllowed: public BitField<bool, 5, 1> {};
191 191
192 unsigned flags_; 192 unsigned flags_;
193 193
194 // Fields filled in by the compilation pipeline. 194 // Fields filled in by the compilation pipeline.
195 // AST filled in by the parser. 195 // AST filled in by the parser.
196 FunctionLiteral* function_; 196 FunctionLiteral* function_;
197 // The scope of the function literal as a convenience. Set to indicate 197 // The scope of the function literal as a convenience. Set to indicate
198 // that scopes have been analyzed. 198 // that scopes have been analyzed.
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 isolate->frame_element_constant_list()->Clear(); 298 isolate->frame_element_constant_list()->Clear();
299 isolate->result_constant_list()->Clear(); 299 isolate->result_constant_list()->Clear();
300 } 300 }
301 } 301 }
302 }; 302 };
303 303
304 304
305 } } // namespace v8::internal 305 } } // namespace v8::internal
306 306
307 #endif // V8_COMPILER_H_ 307 #endif // V8_COMPILER_H_
OLDNEW
« no previous file with comments | « src/arm/lithium-codegen-arm.cc ('k') | src/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698