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

Unified Diff: src/code-stubs.cc

Issue 18602003: Encapsulate compare nil ic_state. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 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 bfc71fcb92ad99155c0eb0d651d438269e582952..7e7125d5cc5a71237e2e05de3e7a04bd63f7e1a2 100644
--- a/src/code-stubs.cc
+++ b/src/code-stubs.cc
@@ -534,7 +534,7 @@ void ICCompareStub::Generate(MacroAssembler* masm) {
void CompareNilICStub::UpdateStatus(Handle<Object> object) {
- ASSERT(state_ != State::Generic());
+ ASSERT(!state_.Contains(GENERIC));
State old_state(state_);
if (object->IsNull()) {
state_.Add(NULL_TYPE);
@@ -543,9 +543,11 @@ void CompareNilICStub::UpdateStatus(Handle<Object> object) {
} else if (object->IsUndetectableObject() ||
object->IsOddball() ||
!object->IsHeapObject()) {
- state_ = State::Generic();
+ state_.RemoveAll();
+ state_.Add(GENERIC);
} else if (IsMonomorphic()) {
- state_ = State::Generic();
+ state_.RemoveAll();
+ state_.Add(GENERIC);
} else {
state_.Add(MONOMORPHIC_MAP);
}
@@ -592,33 +594,28 @@ void CompareNilICStub::State::Print(StringStream* stream) const {
if (Contains(UNDEFINED)) printer.Add("Undefined");
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(
+Handle<Type> CompareNilICStub::GetType(
Isolate* isolate,
- State state,
Handle<Map> map) {
- if (state.Contains(CompareNilICStub::GENERIC)) {
+ if (state_.Contains(CompareNilICStub::GENERIC)) {
return handle(Type::Any(), isolate);
}
Handle<Type> result(Type::None(), isolate);
- if (state.Contains(CompareNilICStub::UNDEFINED)) {
+ if (state_.Contains(CompareNilICStub::UNDEFINED)) {
result = handle(Type::Union(result, handle(Type::Undefined(), isolate)),
isolate);
}
- if (state.Contains(CompareNilICStub::NULL_TYPE)) {
+ 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)) {
+ 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);
}
@@ -627,6 +624,16 @@ Handle<Type> CompareNilICStub::StateToType(
}
+Handle<Type> CompareNilICStub::GetInputType(
+ Isolate* isolate,
+ Handle<Map> map) {
+ Handle<Type> output_type = GetType(isolate, map);
+ Handle<Type> nil_type = handle(nil_value_ == kNullValue
+ ? Type::Null() : Type::Undefined(), isolate);
+ return handle(Type::Union(output_type, nil_type), isolate);
+}
+
+
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