| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 void MarkAsStrict() { | 73 void MarkAsStrict() { |
| 74 flags_ |= IsStrict::encode(true); | 74 flags_ |= IsStrict::encode(true); |
| 75 } | 75 } |
| 76 StrictModeFlag StrictMode() { | 76 StrictModeFlag StrictMode() { |
| 77 return is_strict() ? kStrictMode : kNonStrictMode; | 77 return is_strict() ? kStrictMode : kNonStrictMode; |
| 78 } | 78 } |
| 79 void MarkAsInLoop() { | 79 void MarkAsInLoop() { |
| 80 ASSERT(is_lazy()); | 80 ASSERT(is_lazy()); |
| 81 flags_ |= IsInLoop::encode(true); | 81 flags_ |= IsInLoop::encode(true); |
| 82 } | 82 } |
| 83 void MarkAsAllowingNativesSyntax() { |
| 84 flags_ |= IsNativesSyntaxAllowed::encode(true); |
| 85 } |
| 86 bool allows_natives_syntax() const { |
| 87 return IsNativesSyntaxAllowed::decode(flags_); |
| 88 } |
| 83 void SetFunction(FunctionLiteral* literal) { | 89 void SetFunction(FunctionLiteral* literal) { |
| 84 ASSERT(function_ == NULL); | 90 ASSERT(function_ == NULL); |
| 85 function_ = literal; | 91 function_ = literal; |
| 86 } | 92 } |
| 87 void SetScope(Scope* scope) { | 93 void SetScope(Scope* scope) { |
| 88 ASSERT(scope_ == NULL); | 94 ASSERT(scope_ == NULL); |
| 89 scope_ = scope; | 95 scope_ = scope; |
| 90 } | 96 } |
| 91 void SetCode(Handle<Code> code) { code_ = code; } | 97 void SetCode(Handle<Code> code) { code_ = code; } |
| 92 void SetExtension(v8::Extension* extension) { | 98 void SetExtension(v8::Extension* extension) { |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 // | 173 // |
| 168 // Compilation is either eager or lazy. | 174 // Compilation is either eager or lazy. |
| 169 class IsLazy: public BitField<bool, 0, 1> {}; | 175 class IsLazy: public BitField<bool, 0, 1> {}; |
| 170 // Flags that can be set for eager compilation. | 176 // Flags that can be set for eager compilation. |
| 171 class IsEval: public BitField<bool, 1, 1> {}; | 177 class IsEval: public BitField<bool, 1, 1> {}; |
| 172 class IsGlobal: public BitField<bool, 2, 1> {}; | 178 class IsGlobal: public BitField<bool, 2, 1> {}; |
| 173 // Flags that can be set for lazy compilation. | 179 // Flags that can be set for lazy compilation. |
| 174 class IsInLoop: public BitField<bool, 3, 1> {}; | 180 class IsInLoop: public BitField<bool, 3, 1> {}; |
| 175 // Strict mode - used in eager compilation. | 181 // Strict mode - used in eager compilation. |
| 176 class IsStrict: public BitField<bool, 4, 1> {}; | 182 class IsStrict: public BitField<bool, 4, 1> {}; |
| 183 // Native syntax (%-stuff) allowed? |
| 184 class IsNativesSyntaxAllowed: public BitField<bool, 5, 1> {}; |
| 177 | 185 |
| 178 unsigned flags_; | 186 unsigned flags_; |
| 179 | 187 |
| 180 // Fields filled in by the compilation pipeline. | 188 // Fields filled in by the compilation pipeline. |
| 181 // AST filled in by the parser. | 189 // AST filled in by the parser. |
| 182 FunctionLiteral* function_; | 190 FunctionLiteral* function_; |
| 183 // The scope of the function literal as a convenience. Set to indicate | 191 // The scope of the function literal as a convenience. Set to indicate |
| 184 // that scopes have been analyzed. | 192 // that scopes have been analyzed. |
| 185 Scope* scope_; | 193 Scope* scope_; |
| 186 // The compiled code. | 194 // The compiled code. |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 FrameElement::ClearConstantList(); | 289 FrameElement::ClearConstantList(); |
| 282 Result::ClearConstantList(); | 290 Result::ClearConstantList(); |
| 283 } | 291 } |
| 284 } | 292 } |
| 285 }; | 293 }; |
| 286 | 294 |
| 287 | 295 |
| 288 } } // namespace v8::internal | 296 } } // namespace v8::internal |
| 289 | 297 |
| 290 #endif // V8_COMPILER_H_ | 298 #endif // V8_COMPILER_H_ |
| OLD | NEW |