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

Unified Diff: src/code-stubs.cc

Issue 14862009: Encapsulating Type information in the CompareICStub (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 7 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
Index: src/code-stubs.cc
diff --git a/src/code-stubs.cc b/src/code-stubs.cc
index aa2c82172c16250172db0fa2494b067b532ca0d9..99a8043920a8cddd087b5ddbaaa1a0b107b013f9 100644
--- a/src/code-stubs.cc
+++ b/src/code-stubs.cc
@@ -407,44 +407,62 @@ void ICCompareStub::Generate(MacroAssembler* masm) {
}
}
-
-CompareNilICStub::Types CompareNilICStub::GetPatchedICFlags(
- Code::ExtraICState extra_ic_state,
- Handle<Object> object,
- bool* already_monomorphic) {
- Types types = TypesField::decode(extra_ic_state);
- NilValue nil = NilValueField::decode(extra_ic_state);
- EqualityKind kind = EqualityKindField::decode(extra_ic_state);
- ASSERT(types != CompareNilICStub::kFullCompare);
- *already_monomorphic =
- (types & CompareNilICStub::kCompareAgainstMonomorphicMap) != 0;
- if (kind == kStrictEquality) {
- if (nil == kNullValue) {
- return CompareNilICStub::kCompareAgainstNull;
+void CompareNilICStub::Record(Handle<Object> object) {
+ ASSERT(!types_.IsFullCompare());
+ if (IsStrictEquality()) {
+ if (IsNullValue()) {
+ types_.SetTo(NULL_TYPE);
} else {
- return CompareNilICStub::kCompareAgainstUndefined;
+ types_.SetTo(UNDEFINED);
}
} else {
if (object->IsNull()) {
- types = static_cast<CompareNilICStub::Types>(
- types | CompareNilICStub::kCompareAgainstNull);
+ types_.Add(NULL_TYPE);
} else if (object->IsUndefined()) {
- types = static_cast<CompareNilICStub::Types>(
- types | CompareNilICStub::kCompareAgainstUndefined);
+ types_.Add(UNDEFINED);
} else if (object->IsUndetectableObject() ||
object->IsOddball() ||
!object->IsHeapObject()) {
- types = CompareNilICStub::kFullCompare;
- } else if ((types & CompareNilICStub::kCompareAgainstMonomorphicMap) != 0) {
- types = CompareNilICStub::kFullCompare;
+ types_.BeFullCompare();
+ } else if (IsMonomorphic()) {
+ types_.BeFullCompare();
} else {
- types = static_cast<CompareNilICStub::Types>(
- types | CompareNilICStub::kCompareAgainstMonomorphicMap);
+ types_.Add(MONOMORPHIC_MAP);
}
}
- return types;
}
+void CompareNilICStub::Types::Add(Type type) {
+ set_.Add(type);
+}
+
+void CompareNilICStub::Types::SetTo(Type type) {
+ Clear();
+ Add(type);
+}
+
+void CompareNilICStub::PrintName(StringStream* stream) {
+ stream->Add("CompareNilICStub_");
+ types_.Print(stream);
+ if (IsNullValue()) {
+ stream->Add("(NullValue|");
+ } else {
+ stream->Add("(UndefinedValue|");
+ }
+ if (IsStrictEquality()) {
+ stream->Add("StrictEquality)");
+ } else {
+ stream->Add("NonStrictEquality)");
+ }
+}
+
+void CompareNilICStub::Types::Print(StringStream* stream) const {
Sven Panne 2013/05/13 14:24:50 This doesn't produce very readable output when Typ
oliv 2013/05/13 18:03:58 ok, done
+ if (IsEmpty()) stream->Add("None");
+ if (Contains(UNDEFINED)) stream->Add("Undefined");
+ if (Contains(NULL_TYPE)) stream->Add("Null");
+ if (Contains(MONOMORPHIC_MAP)) stream->Add("MonomorphicMap");
+ if (Contains(UNDETECTABLE)) stream->Add("Undetectable");
+}
void InstanceofStub::PrintName(StringStream* stream) {
const char* args = "";

Powered by Google App Engine
This is Rietveld 408576698