| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 void MarkAsStrictMode() { | 76 void MarkAsStrictMode() { |
| 77 flags_ |= IsStrictMode::encode(true); | 77 flags_ |= IsStrictMode::encode(true); |
| 78 } | 78 } |
| 79 StrictModeFlag StrictMode() { | 79 StrictModeFlag StrictMode() { |
| 80 return is_strict_mode() ? kStrictMode : kNonStrictMode; | 80 return is_strict_mode() ? kStrictMode : kNonStrictMode; |
| 81 } | 81 } |
| 82 void MarkAsInLoop() { | 82 void MarkAsInLoop() { |
| 83 ASSERT(is_lazy()); | 83 ASSERT(is_lazy()); |
| 84 flags_ |= IsInLoop::encode(true); | 84 flags_ |= IsInLoop::encode(true); |
| 85 } | 85 } |
| 86 void MarkAsAllowingNativesSyntax() { | |
| 87 flags_ |= IsNativesSyntaxAllowed::encode(true); | |
| 88 } | |
| 89 bool allows_natives_syntax() const { | |
| 90 return IsNativesSyntaxAllowed::decode(flags_); | |
| 91 } | |
| 92 void MarkAsNative() { | 86 void MarkAsNative() { |
| 93 flags_ |= IsNative::encode(true); | 87 flags_ |= IsNative::encode(true); |
| 94 } | 88 } |
| 95 bool is_native() const { | 89 bool is_native() const { |
| 96 return IsNative::decode(flags_); | 90 return IsNative::decode(flags_); |
| 97 } | 91 } |
| 98 void SetFunction(FunctionLiteral* literal) { | 92 void SetFunction(FunctionLiteral* literal) { |
| 99 ASSERT(function_ == NULL); | 93 ASSERT(function_ == NULL); |
| 100 function_ = literal; | 94 function_ = literal; |
| 101 } | 95 } |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 // | 186 // |
| 193 // Compilation is either eager or lazy. | 187 // Compilation is either eager or lazy. |
| 194 class IsLazy: public BitField<bool, 0, 1> {}; | 188 class IsLazy: public BitField<bool, 0, 1> {}; |
| 195 // Flags that can be set for eager compilation. | 189 // Flags that can be set for eager compilation. |
| 196 class IsEval: public BitField<bool, 1, 1> {}; | 190 class IsEval: public BitField<bool, 1, 1> {}; |
| 197 class IsGlobal: public BitField<bool, 2, 1> {}; | 191 class IsGlobal: public BitField<bool, 2, 1> {}; |
| 198 // Flags that can be set for lazy compilation. | 192 // Flags that can be set for lazy compilation. |
| 199 class IsInLoop: public BitField<bool, 3, 1> {}; | 193 class IsInLoop: public BitField<bool, 3, 1> {}; |
| 200 // Strict mode - used in eager compilation. | 194 // Strict mode - used in eager compilation. |
| 201 class IsStrictMode: public BitField<bool, 4, 1> {}; | 195 class IsStrictMode: public BitField<bool, 4, 1> {}; |
| 202 // Native syntax (%-stuff) allowed? | |
| 203 class IsNativesSyntaxAllowed: public BitField<bool, 5, 1> {}; | |
| 204 // Is this a function from our natives. | 196 // Is this a function from our natives. |
| 205 class IsNative: public BitField<bool, 6, 1> {}; | 197 class IsNative: public BitField<bool, 6, 1> {}; |
| 206 | 198 |
| 207 | 199 |
| 208 unsigned flags_; | 200 unsigned flags_; |
| 209 | 201 |
| 210 // Fields filled in by the compilation pipeline. | 202 // Fields filled in by the compilation pipeline. |
| 211 // AST filled in by the parser. | 203 // AST filled in by the parser. |
| 212 FunctionLiteral* function_; | 204 FunctionLiteral* function_; |
| 213 // The scope of the function literal as a convenience. Set to indicate | 205 // The scope of the function literal as a convenience. Set to indicate |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 | 290 |
| 299 static void RecordFunctionCompilation(Logger::LogEventsAndTags tag, | 291 static void RecordFunctionCompilation(Logger::LogEventsAndTags tag, |
| 300 CompilationInfo* info, | 292 CompilationInfo* info, |
| 301 Handle<SharedFunctionInfo> shared); | 293 Handle<SharedFunctionInfo> shared); |
| 302 }; | 294 }; |
| 303 | 295 |
| 304 | 296 |
| 305 } } // namespace v8::internal | 297 } } // namespace v8::internal |
| 306 | 298 |
| 307 #endif // V8_COMPILER_H_ | 299 #endif // V8_COMPILER_H_ |
| OLD | NEW |