Revision: 21621
Author: ma...@chromium.org
Date: Tue Jun 3 07:40:43 2014 UTC
Log: Minor cleanups & trivial refactoring related to Ast.
1) Literal::IsNull, IsTrue and IsFalse were dead code, and not needed.
2) No need to use the node type constants outside the Ast; there is
IsSomeNodeType().
3) AsSomeNodeType() != NULL -> IsSomeNodeType().
R=rossb...@chromium.org
BUG=
Review URL: https://codereview.chromium.org/298143004
http://code.google.com/p/v8/source/detail?r=21621
Modified:
/branches/bleeding_edge/src/arm/full-codegen-arm.cc
/branches/bleeding_edge/src/arm64/full-codegen-arm64.cc
/branches/bleeding_edge/src/ast.cc
/branches/bleeding_edge/src/ast.h
/branches/bleeding_edge/src/hydrogen.cc
/branches/bleeding_edge/src/ia32/full-codegen-ia32.cc
/branches/bleeding_edge/src/mips/full-codegen-mips.cc
/branches/bleeding_edge/src/parser.cc
/branches/bleeding_edge/src/x64/full-codegen-x64.cc
/branches/bleeding_edge/src/x87/full-codegen-x87.cc
=======================================
--- /branches/bleeding_edge/src/arm/full-codegen-arm.cc Wed May 28 16:00:52
2014 UTC
+++ /branches/bleeding_edge/src/arm/full-codegen-arm.cc Tue Jun 3 07:40:43
2014 UTC
@@ -2537,7 +2537,7 @@
// Assignment to a property, using a named store IC.
Property* prop = expr->target()->AsProperty();
ASSERT(prop != NULL);
- ASSERT(prop->key()->AsLiteral() != NULL);
+ ASSERT(prop->key()->IsLiteral());
// Record source code position before IC call.
SetSourcePosition(expr->position());
=======================================
--- /branches/bleeding_edge/src/arm64/full-codegen-arm64.cc Wed May 28
16:00:52 2014 UTC
+++ /branches/bleeding_edge/src/arm64/full-codegen-arm64.cc Tue Jun 3
07:40:43 2014 UTC
@@ -2244,7 +2244,7 @@
// Assignment to a property, using a named store IC.
Property* prop = expr->target()->AsProperty();
ASSERT(prop != NULL);
- ASSERT(prop->key()->AsLiteral() != NULL);
+ ASSERT(prop->key()->IsLiteral());
// Record source code position before IC call.
SetSourcePosition(expr->position());
=======================================
--- /branches/bleeding_edge/src/ast.cc Wed Apr 30 14:33:35 2014 UTC
+++ /branches/bleeding_edge/src/ast.cc Tue Jun 3 07:40:43 2014 UTC
@@ -34,17 +34,17 @@
bool Expression::IsSmiLiteral() const {
- return AsLiteral() != NULL && AsLiteral()->value()->IsSmi();
+ return IsLiteral() && AsLiteral()->value()->IsSmi();
}
bool Expression::IsStringLiteral() const {
- return AsLiteral() != NULL && AsLiteral()->value()->IsString();
+ return IsLiteral() && AsLiteral()->value()->IsString();
}
bool Expression::IsNullLiteral() const {
- return AsLiteral() != NULL && AsLiteral()->value()->IsNull();
+ return IsLiteral() && AsLiteral()->value()->IsNull();
}
@@ -192,7 +192,7 @@
kind_ = PROTOTYPE;
} else if (value_->AsMaterializedLiteral() != NULL) {
kind_ = MATERIALIZED_LITERAL;
- } else if (value_->AsLiteral() != NULL) {
+ } else if (value_->IsLiteral()) {
kind_ = CONSTANT;
} else {
kind_ = COMPUTED;
@@ -390,7 +390,7 @@
Handle<Object> MaterializedLiteral::GetBoilerplateValue(Expression*
expression,
Isolate* isolate) {
- if (expression->AsLiteral() != NULL) {
+ if (expression->IsLiteral()) {
return expression->AsLiteral()->value();
}
if (CompileTimeValue::IsCompileTimeValue(expression)) {
@@ -499,7 +499,7 @@
UnaryOperation* maybe_unary = expr->AsUnaryOperation();
return maybe_unary != NULL &&
maybe_unary->op() == Token::VOID &&
- maybe_unary->expression()->AsLiteral() != NULL;
+ maybe_unary->expression()->IsLiteral();
}
=======================================
--- /branches/bleeding_edge/src/ast.h Mon May 26 13:59:24 2014 UTC
+++ /branches/bleeding_edge/src/ast.h Tue Jun 3 07:40:43 2014 UTC
@@ -1351,20 +1351,6 @@
virtual bool ToBooleanIsFalse() const V8_OVERRIDE {
return !value_->BooleanValue();
}
-
- // Identity testers.
- bool IsNull() const {
- ASSERT(!value_.is_null());
- return value_->IsNull();
- }
- bool IsTrue() const {
- ASSERT(!value_.is_null());
- return value_->IsTrue();
- }
- bool IsFalse() const {
- ASSERT(!value_.is_null());
- return value_->IsFalse();
- }
Handle<Object> value() const { return value_; }
=======================================
--- /branches/bleeding_edge/src/hydrogen.cc Tue Jun 3 04:01:34 2014 UTC
+++ /branches/bleeding_edge/src/hydrogen.cc Tue Jun 3 07:40:43 2014 UTC
@@ -9149,7 +9149,7 @@
CHECK_ALIVE(VisitForValue(arguments->at(kObjectArg)));
HValue* obj = Pop();
- if (arguments->at(kArrayIdArg)->node_type() != AstNode::kLiteral) {
+ if (arguments->at(kArrayIdArg)->IsLiteral()) {
// This should never happen in real use, but can happen when fuzzing.
// Just bail out.
Bailout(kNeedSmiLiteral);
@@ -9176,7 +9176,7 @@
HValue* byte_offset;
bool is_zero_byte_offset;
- if (arguments->at(kByteOffsetArg)->node_type() == AstNode::kLiteral
+ if (arguments->at(kByteOffsetArg)->IsLiteral()
&& Smi::FromInt(0) ==
*static_cast<Literal*>(arguments->at(kByteOffsetArg))->value()) {
byte_offset = Add<HConstant>(static_cast<int32_t>(0));
=======================================
--- /branches/bleeding_edge/src/ia32/full-codegen-ia32.cc Wed May 28
16:00:52 2014 UTC
+++ /branches/bleeding_edge/src/ia32/full-codegen-ia32.cc Tue Jun 3
07:40:43 2014 UTC
@@ -2476,7 +2476,7 @@
Property* prop = expr->target()->AsProperty();
ASSERT(prop != NULL);
- ASSERT(prop->key()->AsLiteral() != NULL);
+ ASSERT(prop->key()->IsLiteral());
// Record source code position before IC call.
SetSourcePosition(expr->position());
=======================================
--- /branches/bleeding_edge/src/mips/full-codegen-mips.cc Wed May 28
16:00:52 2014 UTC
+++ /branches/bleeding_edge/src/mips/full-codegen-mips.cc Tue Jun 3
07:40:43 2014 UTC
@@ -2548,7 +2548,7 @@
// Assignment to a property, using a named store IC.
Property* prop = expr->target()->AsProperty();
ASSERT(prop != NULL);
- ASSERT(prop->key()->AsLiteral() != NULL);
+ ASSERT(prop->key()->IsLiteral());
// Record source code position before IC call.
SetSourcePosition(expr->position());
=======================================
--- /branches/bleeding_edge/src/parser.cc Mon May 26 08:07:02 2014 UTC
+++ /branches/bleeding_edge/src/parser.cc Tue Jun 3 07:40:43 2014 UTC
@@ -525,7 +525,7 @@
Expression* expression, Token::Value op, int pos,
AstNodeFactory<AstConstructionVisitor>* factory) {
ASSERT(expression != NULL);
- if (expression->AsLiteral() != NULL) {
+ if (expression->IsLiteral()) {
Handle<Object> literal = expression->AsLiteral()->value();
if (op == Token::NOT) {
// Convert the literal to a boolean condition and negate it.
@@ -3224,7 +3224,7 @@
bool CompileTimeValue::IsCompileTimeValue(Expression* expression) {
- if (expression->AsLiteral() != NULL) return true;
+ if (expression->IsLiteral()) return true;
MaterializedLiteral* lit = expression->AsMaterializedLiteral();
return lit != NULL && lit->is_simple();
}
=======================================
--- /branches/bleeding_edge/src/x64/full-codegen-x64.cc Wed May 28 16:00:52
2014 UTC
+++ /branches/bleeding_edge/src/x64/full-codegen-x64.cc Tue Jun 3 07:40:43
2014 UTC
@@ -2477,7 +2477,7 @@
// Assignment to a property, using a named store IC.
Property* prop = expr->target()->AsProperty();
ASSERT(prop != NULL);
- ASSERT(prop->key()->AsLiteral() != NULL);
+ ASSERT(prop->key()->IsLiteral());
// Record source code position before IC call.
SetSourcePosition(expr->position());
=======================================
--- /branches/bleeding_edge/src/x87/full-codegen-x87.cc Wed May 28 16:00:52
2014 UTC
+++ /branches/bleeding_edge/src/x87/full-codegen-x87.cc Tue Jun 3 07:40:43
2014 UTC
@@ -2470,7 +2470,7 @@
Property* prop = expr->target()->AsProperty();
ASSERT(prop != NULL);
- ASSERT(prop->key()->AsLiteral() != NULL);
+ ASSERT(prop->key()->IsLiteral());
// Record source code position before IC call.
SetSourcePosition(expr->position());
--
--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.