OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 // neither in strict nor extended mode. However, the more distinguishing term | 392 // neither in strict nor extended mode. However, the more distinguishing term |
393 // 'classic mode' is used in V8 instead to avoid mix-ups. | 393 // 'classic mode' is used in V8 instead to avoid mix-ups. |
394 | 394 |
395 enum LanguageMode { | 395 enum LanguageMode { |
396 CLASSIC_MODE, | 396 CLASSIC_MODE, |
397 STRICT_MODE, | 397 STRICT_MODE, |
398 EXTENDED_MODE | 398 EXTENDED_MODE |
399 }; | 399 }; |
400 | 400 |
401 | 401 |
| 402 // A simple Maybe type, that can be passed by value. |
| 403 template<class T> |
| 404 struct Maybe { |
| 405 Maybe() : has_value(false) {} |
| 406 explicit Maybe(T t) : has_value(true), value(t) {} |
| 407 Maybe(bool has, T t) : has_value(has), value(t) {} |
| 408 |
| 409 bool has_value; |
| 410 T value; |
| 411 }; |
| 412 |
| 413 |
402 // The Strict Mode (ECMA-262 5th edition, 4.2.2). | 414 // The Strict Mode (ECMA-262 5th edition, 4.2.2). |
403 // | 415 // |
404 // This flag is used in the backend to represent the language mode. So far | 416 // This flag is used in the backend to represent the language mode. So far |
405 // there is no semantic difference between the strict and the extended mode in | 417 // there is no semantic difference between the strict and the extended mode in |
406 // the backend, so both modes are represented by the kStrictMode value. | 418 // the backend, so both modes are represented by the kStrictMode value. |
407 enum StrictModeFlag { | 419 enum StrictModeFlag { |
408 kNonStrictMode, | 420 kNonStrictMode, |
409 kStrictMode | 421 kStrictMode |
410 }; | 422 }; |
411 | 423 |
412 | 424 |
413 } } // namespace v8::internal | 425 } } // namespace v8::internal |
414 | 426 |
415 #endif // V8_GLOBALS_H_ | 427 #endif // V8_GLOBALS_H_ |
OLD | NEW |