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

Side by Side Diff: src/globals.h

Issue 23767009: Move Maybe template into v8.h so it can be used by SetResourceConstraints (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 7 years, 3 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 | « include/v8.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 // neither in strict nor extended mode. However, the more distinguishing term 386 // neither in strict nor extended mode. However, the more distinguishing term
387 // 'classic mode' is used in V8 instead to avoid mix-ups. 387 // 'classic mode' is used in V8 instead to avoid mix-ups.
388 388
389 enum LanguageMode { 389 enum LanguageMode {
390 CLASSIC_MODE, 390 CLASSIC_MODE,
391 STRICT_MODE, 391 STRICT_MODE,
392 EXTENDED_MODE 392 EXTENDED_MODE
393 }; 393 };
394 394
395 395
396 // A simple Maybe type, that can be passed by value.
397 template<class T>
398 struct Maybe {
399 Maybe() : has_value(false) {}
400 explicit Maybe(T t) : has_value(true), value(t) {}
401 Maybe(bool has, T t) : has_value(has), value(t) {}
402
403 bool has_value;
404 T value;
405 };
406
407
408 // The Strict Mode (ECMA-262 5th edition, 4.2.2). 396 // The Strict Mode (ECMA-262 5th edition, 4.2.2).
409 // 397 //
410 // This flag is used in the backend to represent the language mode. So far 398 // This flag is used in the backend to represent the language mode. So far
411 // there is no semantic difference between the strict and the extended mode in 399 // there is no semantic difference between the strict and the extended mode in
412 // the backend, so both modes are represented by the kStrictMode value. 400 // the backend, so both modes are represented by the kStrictMode value.
413 enum StrictModeFlag { 401 enum StrictModeFlag {
414 kNonStrictMode, 402 kNonStrictMode,
415 kStrictMode 403 kStrictMode
416 }; 404 };
417 405
418 406
419 } } // namespace v8::internal 407 } } // namespace v8::internal
420 408
421 #endif // V8_GLOBALS_H_ 409 #endif // V8_GLOBALS_H_
OLDNEW
« no previous file with comments | « include/v8.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698