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

Unified Diff: src/ast-value-factory.h

Issue 657893003: AstValueFactory: make true, false, null, undefined and "the hole" unique values. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: oops Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/ast-value-factory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast-value-factory.h
diff --git a/src/ast-value-factory.h b/src/ast-value-factory.h
index de8a44228c9d59716d62a22e79db6a4560af6ebc..774e5343de5993d4332807f1a76ee3f14f8cd028 100644
--- a/src/ast-value-factory.h
+++ b/src/ast-value-factory.h
@@ -238,7 +238,7 @@ class AstValue : public ZoneObject {
};
-// For generating string constants.
+// For generating constants.
#define STRING_CONSTANTS(F) \
F(anonymous_function, "(anonymous function)") \
F(arguments, "arguments") \
@@ -268,6 +268,12 @@ class AstValue : public ZoneObject {
F(use_strict, "use strict") \
F(value, "value")
+#define OTHER_CONSTANTS(F) \
+ F(true_value) \
+ F(false_value) \
+ F(null_value) \
+ F(undefined_value) \
+ F(the_hole_value)
class AstValueFactory {
public:
@@ -276,10 +282,12 @@ class AstValueFactory {
zone_(zone),
isolate_(NULL),
hash_seed_(hash_seed) {
-#define F(name, str) \
- name##_string_ = NULL;
+#define F(name, str) name##_string_ = NULL;
STRING_CONSTANTS(F)
#undef F
+#define F(name) name##_ = NULL;
+ OTHER_CONSTANTS(F)
+#undef F
}
Zone* zone() const { return zone_; }
@@ -299,15 +307,15 @@ class AstValueFactory {
return isolate_ != NULL;
}
-#define F(name, str) \
- const AstRawString* name##_string() { \
- if (name##_string_ == NULL) { \
- const char* data = str; \
- name##_string_ = GetOneByteString( \
+#define F(name, str) \
+ const AstRawString* name##_string() { \
+ if (name##_string_ == NULL) { \
+ const char* data = str; \
+ name##_string_ = GetOneByteString( \
Vector<const uint8_t>(reinterpret_cast<const uint8_t*>(data), \
- static_cast<int>(strlen(data)))); \
- } \
- return name##_string_; \
+ static_cast<int>(strlen(data)))); \
+ } \
+ return name##_string_; \
}
STRING_CONSTANTS(F)
#undef F
@@ -338,10 +346,13 @@ class AstValueFactory {
uint32_t hash_seed_;
-#define F(name, str) \
- const AstRawString* name##_string_;
+#define F(name, str) const AstRawString* name##_string_;
STRING_CONSTANTS(F)
#undef F
+
+#define F(name) AstValue* name##_;
+ OTHER_CONSTANTS(F)
+#undef F
};
@@ -351,5 +362,6 @@ bool AstRawString::IsArguments(AstValueFactory* ast_value_factory) const {
} } // namespace v8::internal
#undef STRING_CONSTANTS
+#undef OTHER_CONSTANTS
#endif // V8_AST_VALUE_FACTORY_H_
« no previous file with comments | « no previous file | src/ast-value-factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698