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

Side by Side Diff: src/ast-value-factory.h

Issue 430503007: Rename ASSERT* to DCHECK*. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE and fixes Created 6 years, 4 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 | « src/ast.cc ('k') | src/ast-value-factory.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 virtual ~AstString() {} 45 virtual ~AstString() {}
46 46
47 virtual int length() const = 0; 47 virtual int length() const = 0;
48 bool IsEmpty() const { return length() == 0; } 48 bool IsEmpty() const { return length() == 0; }
49 49
50 // Puts the string into the V8 heap. 50 // Puts the string into the V8 heap.
51 virtual void Internalize(Isolate* isolate) = 0; 51 virtual void Internalize(Isolate* isolate) = 0;
52 52
53 // This function can be called after internalizing. 53 // This function can be called after internalizing.
54 V8_INLINE Handle<String> string() const { 54 V8_INLINE Handle<String> string() const {
55 ASSERT(!string_.is_null()); 55 DCHECK(!string_.is_null());
56 return string_; 56 return string_;
57 } 57 }
58 58
59 protected: 59 protected:
60 // This is null until the string is internalized. 60 // This is null until the string is internalized.
61 Handle<String> string_; 61 Handle<String> string_;
62 }; 62 };
63 63
64 64
65 class AstRawString : public AstString { 65 class AstRawString : public AstString {
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 170
171 bool BooleanValue() const; 171 bool BooleanValue() const;
172 172
173 void Internalize(Isolate* isolate); 173 void Internalize(Isolate* isolate);
174 174
175 // Can be called after Internalize has been called. 175 // Can be called after Internalize has been called.
176 V8_INLINE Handle<Object> value() const { 176 V8_INLINE Handle<Object> value() const {
177 if (type_ == STRING) { 177 if (type_ == STRING) {
178 return string_->string(); 178 return string_->string();
179 } 179 }
180 ASSERT(!value_.is_null()); 180 DCHECK(!value_.is_null());
181 return value_; 181 return value_;
182 } 182 }
183 183
184 private: 184 private:
185 friend class AstValueFactory; 185 friend class AstValueFactory;
186 186
187 enum Type { 187 enum Type {
188 STRING, 188 STRING,
189 SYMBOL, 189 SYMBOL,
190 NUMBER, 190 NUMBER,
191 SMI, 191 SMI,
192 BOOLEAN, 192 BOOLEAN,
193 STRING_ARRAY, 193 STRING_ARRAY,
194 NULL_TYPE, 194 NULL_TYPE,
195 UNDEFINED, 195 UNDEFINED,
196 THE_HOLE 196 THE_HOLE
197 }; 197 };
198 198
199 explicit AstValue(const AstRawString* s) : type_(STRING) { string_ = s; } 199 explicit AstValue(const AstRawString* s) : type_(STRING) { string_ = s; }
200 200
201 explicit AstValue(const char* name) : type_(SYMBOL) { symbol_name_ = name; } 201 explicit AstValue(const char* name) : type_(SYMBOL) { symbol_name_ = name; }
202 202
203 explicit AstValue(double n) : type_(NUMBER) { number_ = n; } 203 explicit AstValue(double n) : type_(NUMBER) { number_ = n; }
204 204
205 AstValue(Type t, int i) : type_(t) { 205 AstValue(Type t, int i) : type_(t) {
206 ASSERT(type_ == SMI); 206 DCHECK(type_ == SMI);
207 smi_ = i; 207 smi_ = i;
208 } 208 }
209 209
210 explicit AstValue(bool b) : type_(BOOLEAN) { bool_ = b; } 210 explicit AstValue(bool b) : type_(BOOLEAN) { bool_ = b; }
211 211
212 explicit AstValue(ZoneList<const AstRawString*>* s) : type_(STRING_ARRAY) { 212 explicit AstValue(ZoneList<const AstRawString*>* s) : type_(STRING_ARRAY) {
213 strings_ = s; 213 strings_ = s;
214 } 214 }
215 215
216 explicit AstValue(Type t) : type_(t) { 216 explicit AstValue(Type t) : type_(t) {
217 ASSERT(t == NULL_TYPE || t == UNDEFINED || t == THE_HOLE); 217 DCHECK(t == NULL_TYPE || t == UNDEFINED || t == THE_HOLE);
218 } 218 }
219 219
220 Type type_; 220 Type type_;
221 221
222 // Uninternalized value. 222 // Uninternalized value.
223 union { 223 union {
224 const AstRawString* string_; 224 const AstRawString* string_;
225 double number_; 225 double number_;
226 int smi_; 226 int smi_;
227 bool bool_; 227 bool bool_;
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 const AstRawString* name##_string_; 335 const AstRawString* name##_string_;
336 STRING_CONSTANTS(F) 336 STRING_CONSTANTS(F)
337 #undef F 337 #undef F
338 }; 338 };
339 339
340 } } // namespace v8::internal 340 } } // namespace v8::internal
341 341
342 #undef STRING_CONSTANTS 342 #undef STRING_CONSTANTS
343 343
344 #endif // V8_AST_VALUE_FACTORY_H_ 344 #endif // V8_AST_VALUE_FACTORY_H_
OLDNEW
« no previous file with comments | « src/ast.cc ('k') | src/ast-value-factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698