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

Unified Diff: src/objects.h

Issue 1472323002: [es6] Correct parsing of regular expression literal flags. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix oversight in interpreter Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/interpreter/interpreter.cc ('k') | src/objects.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index 22d079f083672f3f7562d06a3b9d40295044e565..73379541621e070315e351a7e1ab4c8714f2de44 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -11,6 +11,7 @@
#include "src/assert-scope.h"
#include "src/bailout-reason.h"
#include "src/base/bits.h"
+#include "src/base/flags.h"
#include "src/base/smart-pointers.h"
#include "src/builtins.h"
#include "src/checks.h"
@@ -7680,7 +7681,7 @@ class JSMessageObject: public JSObject {
// used for tracking the last usage (used for code flushing)..
// - max number of registers used by irregexp implementations.
// - number of capture registers (output values) of the regexp.
-class JSRegExp: public JSObject {
+class JSRegExp final : public JSObject {
public:
// Meaning of Type:
// NOT_COMPILED: Initial value. No data has been stored in the JSRegExp yet.
@@ -7689,35 +7690,26 @@ class JSRegExp: public JSObject {
// IRREGEXP_NATIVE: Compiled to native code with Irregexp.
enum Type { NOT_COMPILED, ATOM, IRREGEXP };
enum Flag {
- NONE = 0,
- GLOBAL = 1,
- IGNORE_CASE = 2,
- MULTILINE = 4,
- STICKY = 8,
- UNICODE_ESCAPES = 16
- };
-
- class Flags {
- public:
- explicit Flags(uint32_t value) : value_(value) { }
- bool is_global() { return (value_ & GLOBAL) != 0; }
- bool is_ignore_case() { return (value_ & IGNORE_CASE) != 0; }
- bool is_multiline() { return (value_ & MULTILINE) != 0; }
- bool is_sticky() { return (value_ & STICKY) != 0; }
- bool is_unicode() { return (value_ & UNICODE_ESCAPES) != 0; }
- uint32_t value() { return value_; }
- private:
- uint32_t value_;
+ kNone = 0,
+ kGlobal = 1 << 0,
+ kIgnoreCase = 1 << 1,
+ kMultiline = 1 << 2,
+ kSticky = 1 << 3,
+ kUnicode = 1 << 4,
};
+ typedef base::Flags<Flag> Flags;
DECL_ACCESSORS(data, Object)
DECL_ACCESSORS(flags, Object)
DECL_ACCESSORS(source, Object)
+ static MaybeHandle<JSRegExp> New(Handle<String> source, Flags flags);
static MaybeHandle<JSRegExp> New(Handle<String> source, Handle<String> flags);
static Handle<JSRegExp> Copy(Handle<JSRegExp> regexp);
static MaybeHandle<JSRegExp> Initialize(Handle<JSRegExp> regexp,
+ Handle<String> source, Flags flags);
+ static MaybeHandle<JSRegExp> Initialize(Handle<JSRegExp> regexp,
Handle<String> source,
Handle<String> flags_string);
@@ -7819,6 +7811,8 @@ class JSRegExp: public JSObject {
static const int kCodeAgeMask = 0xff;
};
+DEFINE_OPERATORS_FOR_FLAGS(JSRegExp::Flags)
+
class CompilationCacheShape : public BaseShape<HashTableKey*> {
public:
« no previous file with comments | « src/interpreter/interpreter.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698