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

Unified Diff: src/ast/ast.cc

Issue 2043183003: Replace all remaining Oddball checks with new function (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: simplifying checks Created 4 years, 6 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 | « src/api-natives.cc ('k') | src/ast/prettyprinter.cc » ('j') | src/objects.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast/ast.cc
diff --git a/src/ast/ast.cc b/src/ast/ast.cc
index 69d634b96496b4ef940f78871fdd5339e5d3c30d..c751958f0fad1f3d087f32ef7fee68aece8f22a8 100644
--- a/src/ast/ast.cc
+++ b/src/ast/ast.cc
@@ -59,11 +59,17 @@ bool Expression::IsStringLiteral() const {
bool Expression::IsNullLiteral() const {
- return IsLiteral() && AsLiteral()->value()->IsNull();
+ if (!IsLiteral()) return false;
+ Handle<Object> value = AsLiteral()->value();
+ return !value->IsSmi() &&
+ value->IsNull(HeapObject::cast(*value)->GetIsolate());
}
bool Expression::IsUndefinedLiteral() const {
- if (IsLiteral() && AsLiteral()->value()->IsUndefined()) {
+ if (!IsLiteral()) return false;
+ Handle<Object> value = AsLiteral()->value();
+ if (!value->IsSmi() &&
+ value->IsUndefined(HeapObject::cast(*value)->GetIsolate())) {
return true;
}
@@ -387,7 +393,7 @@ void ObjectLiteral::CalculateEmitStore(Zone* zone) {
if (property->is_computed_name()) continue;
if (property->kind() == ObjectLiteral::Property::PROTOTYPE) continue;
Literal* literal = property->key()->AsLiteral();
- DCHECK(!literal->value()->IsNull());
+ DCHECK(!literal->IsNullLiteral());
// If there is an existing entry do not emit a store unless the previous
// entry was also an accessor.
@@ -457,11 +463,11 @@ void ObjectLiteral::BuildConstantProperties(Isolate* isolate) {
// (value->IsNumber()).
// TODO(verwaest): Remove once we can store them inline.
if (FLAG_track_double_fields &&
- (value->IsNumber() || value->IsUninitialized())) {
+ (value->IsNumber() || value->IsUninitialized(isolate))) {
may_store_doubles_ = true;
}
- is_simple = is_simple && !value->IsUninitialized();
+ is_simple = is_simple && !value->IsUninitialized(isolate);
// Keep track of the number of elements in the object literal and
// the largest element index. If the largest element index is
@@ -529,7 +535,7 @@ void ArrayLiteral::BuildConstantElements(Isolate* isolate) {
continue;
}
- if (boilerplate_value->IsUninitialized()) {
+ if (boilerplate_value->IsUninitialized(isolate)) {
boilerplate_value = handle(Smi::FromInt(0), isolate);
is_simple = false;
}
« no previous file with comments | « src/api-natives.cc ('k') | src/ast/prettyprinter.cc » ('j') | src/objects.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698