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

Unified Diff: src/code-stubs.cc

Issue 16361015: Migrate Compare ICs to new type rep (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Comments Created 7 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/code-stubs.h ('k') | src/code-stubs-hydrogen.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/code-stubs.cc
diff --git a/src/code-stubs.cc b/src/code-stubs.cc
index 6b6e25019dedf6ebbbfe1344b250a656a813260f..5bec7e05f913be19ef8526f76e86580b99041115 100644
--- a/src/code-stubs.cc
+++ b/src/code-stubs.cc
@@ -431,24 +431,24 @@ void ICCompareStub::Generate(MacroAssembler* masm) {
void CompareNilICStub::Record(Handle<Object> object) {
- ASSERT(types_ != Types::FullCompare());
+ ASSERT(state_ != State::Generic());
if (object->IsNull()) {
- types_.Add(NULL_TYPE);
+ state_.Add(NULL_TYPE);
} else if (object->IsUndefined()) {
- types_.Add(UNDEFINED);
+ state_.Add(UNDEFINED);
} else if (object->IsUndetectableObject() ||
object->IsOddball() ||
!object->IsHeapObject()) {
- types_ = Types::FullCompare();
+ state_ = State::Generic();
} else if (IsMonomorphic()) {
- types_ = Types::FullCompare();
+ state_ = State::Generic();
} else {
- types_.Add(MONOMORPHIC_MAP);
+ state_.Add(MONOMORPHIC_MAP);
}
}
-void CompareNilICStub::Types::TraceTransition(Types to) const {
+void CompareNilICStub::State::TraceTransition(State to) const {
#ifdef DEBUG
if (!FLAG_trace_ic) return;
char buffer[100];
@@ -467,13 +467,13 @@ void CompareNilICStub::Types::TraceTransition(Types to) const {
void CompareNilICStub::PrintName(StringStream* stream) {
stream->Add("CompareNilICStub_");
- types_.Print(stream);
+ state_.Print(stream);
stream->Add((nil_value_ == kNullValue) ? "(NullValue|":
"(UndefinedValue|");
}
-void CompareNilICStub::Types::Print(StringStream* stream) const {
+void CompareNilICStub::State::Print(StringStream* stream) const {
stream->Add("(");
SimpleListPrinter printer(stream);
if (IsEmpty()) printer.Add("None");
@@ -481,10 +481,40 @@ void CompareNilICStub::Types::Print(StringStream* stream) const {
if (Contains(NULL_TYPE)) printer.Add("Null");
if (Contains(MONOMORPHIC_MAP)) printer.Add("MonomorphicMap");
if (Contains(UNDETECTABLE)) printer.Add("Undetectable");
+ if (Contains(GENERIC)) printer.Add("Generic");
stream->Add(")");
}
+Handle<Type> CompareNilICStub::StateToType(
+ Isolate* isolate,
+ State state,
+ Handle<Map> map) {
+ if (state.Contains(CompareNilICStub::GENERIC)) {
+ return handle(Type::Any(), isolate);
+ }
+
+ Handle<Type> result(Type::None(), isolate);
+ if (state.Contains(CompareNilICStub::UNDEFINED)) {
+ result = handle(Type::Union(result, handle(Type::Undefined(), isolate)),
+ isolate);
+ }
+ if (state.Contains(CompareNilICStub::NULL_TYPE)) {
+ result = handle(Type::Union(result, handle(Type::Null(), isolate)),
+ isolate);
+ }
+ if (state.Contains(CompareNilICStub::UNDETECTABLE)) {
+ result = handle(Type::Union(result, handle(Type::Undetectable(), isolate)),
+ isolate);
+ } else if (state.Contains(CompareNilICStub::MONOMORPHIC_MAP)) {
+ Type* type = map.is_null() ? Type::Detectable() : Type::Class(map);
+ result = handle(Type::Union(result, handle(type, isolate)), isolate);
+ }
+
+ return result;
+}
+
+
void InstanceofStub::PrintName(StringStream* stream) {
const char* args = "";
if (HasArgsInRegisters()) {
« no previous file with comments | « src/code-stubs.h ('k') | src/code-stubs-hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698