| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_AST_H_ | 5 #ifndef V8_AST_H_ |
| 6 #define V8_AST_H_ | 6 #define V8_AST_H_ |
| 7 | 7 |
| 8 #include "v8.h" | 8 #include "v8.h" |
| 9 | 9 |
| 10 #include "assembler.h" | 10 #include "assembler.h" |
| (...skipping 1334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1345 return Handle<String>::cast(value_); | 1345 return Handle<String>::cast(value_); |
| 1346 } | 1346 } |
| 1347 | 1347 |
| 1348 virtual bool ToBooleanIsTrue() const V8_OVERRIDE { | 1348 virtual bool ToBooleanIsTrue() const V8_OVERRIDE { |
| 1349 return value_->BooleanValue(); | 1349 return value_->BooleanValue(); |
| 1350 } | 1350 } |
| 1351 virtual bool ToBooleanIsFalse() const V8_OVERRIDE { | 1351 virtual bool ToBooleanIsFalse() const V8_OVERRIDE { |
| 1352 return !value_->BooleanValue(); | 1352 return !value_->BooleanValue(); |
| 1353 } | 1353 } |
| 1354 | 1354 |
| 1355 // Identity testers. | |
| 1356 bool IsNull() const { | |
| 1357 ASSERT(!value_.is_null()); | |
| 1358 return value_->IsNull(); | |
| 1359 } | |
| 1360 bool IsTrue() const { | |
| 1361 ASSERT(!value_.is_null()); | |
| 1362 return value_->IsTrue(); | |
| 1363 } | |
| 1364 bool IsFalse() const { | |
| 1365 ASSERT(!value_.is_null()); | |
| 1366 return value_->IsFalse(); | |
| 1367 } | |
| 1368 | |
| 1369 Handle<Object> value() const { return value_; } | 1355 Handle<Object> value() const { return value_; } |
| 1370 | 1356 |
| 1371 // Support for using Literal as a HashMap key. NOTE: Currently, this works | 1357 // Support for using Literal as a HashMap key. NOTE: Currently, this works |
| 1372 // only for string and number literals! | 1358 // only for string and number literals! |
| 1373 uint32_t Hash() { return ToString()->Hash(); } | 1359 uint32_t Hash() { return ToString()->Hash(); } |
| 1374 | 1360 |
| 1375 static bool Match(void* literal1, void* literal2) { | 1361 static bool Match(void* literal1, void* literal2) { |
| 1376 Handle<String> s1 = static_cast<Literal*>(literal1)->ToString(); | 1362 Handle<String> s1 = static_cast<Literal*>(literal1)->ToString(); |
| 1377 Handle<String> s2 = static_cast<Literal*>(literal2)->ToString(); | 1363 Handle<String> s2 = static_cast<Literal*>(literal2)->ToString(); |
| 1378 return String::Equals(s1, s2); | 1364 return String::Equals(s1, s2); |
| (...skipping 1969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3348 | 3334 |
| 3349 private: | 3335 private: |
| 3350 Zone* zone_; | 3336 Zone* zone_; |
| 3351 Visitor visitor_; | 3337 Visitor visitor_; |
| 3352 }; | 3338 }; |
| 3353 | 3339 |
| 3354 | 3340 |
| 3355 } } // namespace v8::internal | 3341 } } // namespace v8::internal |
| 3356 | 3342 |
| 3357 #endif // V8_AST_H_ | 3343 #endif // V8_AST_H_ |
| OLD | NEW |