Revision: 15042
Author: [email protected]
Date: Mon Jun 10 08:30:02 2013
Log: remove equality kind from compare nil ic
http://code.google.com/p/v8/source/detail?r=15042
Modified:
/branches/bleeding_edge/src/arm/full-codegen-arm.cc
/branches/bleeding_edge/src/code-stubs-hydrogen.cc
/branches/bleeding_edge/src/code-stubs.cc
/branches/bleeding_edge/src/code-stubs.h
/branches/bleeding_edge/src/hydrogen.cc
/branches/bleeding_edge/src/hydrogen.h
/branches/bleeding_edge/src/ia32/full-codegen-ia32.cc
/branches/bleeding_edge/src/ic.cc
/branches/bleeding_edge/src/ic.h
/branches/bleeding_edge/src/mips/full-codegen-mips.cc
/branches/bleeding_edge/src/stub-cache.cc
/branches/bleeding_edge/src/x64/full-codegen-x64.cc
/branches/bleeding_edge/test/cctest/test-compare-nil-ic-stub.cc
=======================================
--- /branches/bleeding_edge/src/arm/full-codegen-arm.cc Mon Jun 10 02:26:18
2013
+++ /branches/bleeding_edge/src/arm/full-codegen-arm.cc Mon Jun 10 08:30:02
2013
@@ -4776,7 +4776,6 @@
Split(eq, if_true, if_false, fall_through);
} else {
Handle<Code> ic = CompareNilICStub::GetUninitialized(isolate(),
-
kNonStrictEquality,
nil);
CallIC(ic, RelocInfo::CODE_TARGET, expr->CompareOperationFeedbackId());
__ cmp(r0, Operand(0));
=======================================
--- /branches/bleeding_edge/src/code-stubs-hydrogen.cc Wed Jun 5 03:43:18
2013
+++ /branches/bleeding_edge/src/code-stubs-hydrogen.cc Mon Jun 10 08:30:02
2013
@@ -736,7 +736,7 @@
CompareNilICStub* stub = casted_stub();
HIfContinuation continuation;
Handle<Map> sentinel_map(graph()->isolate()->heap()->meta_map());
- BuildCompareNil(GetParameter(0), stub->GetKind(),
+ BuildCompareNil(GetParameter(0),
stub->GetTypes(), sentinel_map,
RelocInfo::kNoPosition, &continuation);
IfBuilder if_nil(this, &continuation);
=======================================
--- /branches/bleeding_edge/src/code-stubs.cc Fri Jun 7 06:11:17 2013
+++ /branches/bleeding_edge/src/code-stubs.cc Mon Jun 10 08:30:02 2013
@@ -432,25 +432,18 @@
void CompareNilICStub::Record(Handle<Object> object) {
ASSERT(types_ != Types::FullCompare());
- if (equality_kind_ == kStrictEquality) {
- // When testing for strict equality only one value will evaluate to
true
- types_.RemoveAll();
- types_.Add((nil_value_ == kNullValue) ? NULL_TYPE:
- UNDEFINED);
+ if (object->IsNull()) {
+ types_.Add(NULL_TYPE);
+ } else if (object->IsUndefined()) {
+ types_.Add(UNDEFINED);
+ } else if (object->IsUndetectableObject() ||
+ object->IsOddball() ||
+ !object->IsHeapObject()) {
+ types_ = Types::FullCompare();
+ } else if (IsMonomorphic()) {
+ types_ = Types::FullCompare();
} else {
- if (object->IsNull()) {
- types_.Add(NULL_TYPE);
- } else if (object->IsUndefined()) {
- types_.Add(UNDEFINED);
- } else if (object->IsUndetectableObject() ||
- object->IsOddball() ||
- !object->IsHeapObject()) {
- types_ = Types::FullCompare();
- } else if (IsMonomorphic()) {
- types_ = Types::FullCompare();
- } else {
- types_.Add(MONOMORPHIC_MAP);
- }
+ types_.Add(MONOMORPHIC_MAP);
}
}
@@ -477,8 +470,6 @@
types_.Print(stream);
stream->Add((nil_value_ == kNullValue) ? "(NullValue|":
"(UndefinedValue|");
- stream->Add((equality_kind_ == kStrictEquality) ? "StrictEquality)":
- "NonStrictEquality)");
}
=======================================
--- /branches/bleeding_edge/src/code-stubs.h Fri Jun 7 08:43:56 2013
+++ /branches/bleeding_edge/src/code-stubs.h Mon Jun 10 08:30:02 2013
@@ -1154,24 +1154,21 @@
// boolean flags we need to store. :-P
STATIC_ASSERT(NUMBER_OF_TYPES <= 6);
- CompareNilICStub(EqualityKind kind, NilValue nil, Types types = Types())
+ CompareNilICStub(NilValue nil, Types types = Types())
: types_(types) {
- equality_kind_ = kind;
nil_value_ = nil;
}
CompareNilICStub(Code::ExtraICState ic_state,
InitializationState init_state = INITIALIZED)
: HydrogenCodeStub(init_state) {
- equality_kind_ = EqualityKindField::decode(ic_state);
nil_value_ = NilValueField::decode(ic_state);
types_ = Types(ExtractTypesFromExtraICState(ic_state));
}
static Handle<Code> GetUninitialized(Isolate* isolate,
- EqualityKind kind,
NilValue nil) {
- return CompareNilICStub(kind, nil, UNINITIALIZED).GetCode(isolate);
+ return CompareNilICStub(nil, UNINITIALIZED).GetCode(isolate);
}
virtual void InitializeInterfaceDescriptor(
@@ -1179,7 +1176,7 @@
CodeStubInterfaceDescriptor* descriptor);
static void InitializeForIsolate(Isolate* isolate) {
- CompareNilICStub compare_stub(kStrictEquality, kNullValue,
UNINITIALIZED);
+ CompareNilICStub compare_stub(kNullValue, UNINITIALIZED);
compare_stub.InitializeInterfaceDescriptor(
isolate,
isolate->code_stub_interface_descriptor(CodeStub::CompareNilIC));
@@ -1199,10 +1196,9 @@
Handle<Code> GenerateCode();
- // extra ic state = nil_value | equality_kind | type_n-1 | ... | type_0
+ // extra ic state = nil_value | type_n-1 | ... | type_0
virtual Code::ExtraICState GetExtraICState() {
return NilValueField::encode(nil_value_) |
- EqualityKindField::encode(equality_kind_) |
types_.ToIntegral();
}
static byte ExtractTypesFromExtraICState(
@@ -1213,32 +1209,26 @@
void Record(Handle<Object> object);
bool IsMonomorphic() const { return types_.Contains(MONOMORPHIC_MAP); }
- EqualityKind GetKind() const { return equality_kind_; }
NilValue GetNilValue() const { return nil_value_; }
Types GetTypes() const { return types_; }
void ClearTypes() { types_.RemoveAll(); }
- void SetKind(EqualityKind kind) { equality_kind_ = kind; }
virtual void PrintName(StringStream* stream);
private:
friend class CompareNilIC;
- CompareNilICStub(EqualityKind kind, NilValue nil,
+ CompareNilICStub(NilValue nil,
InitializationState init_state)
: HydrogenCodeStub(init_state) {
- equality_kind_ = kind;
nil_value_ = nil;
}
- class EqualityKindField : public BitField<EqualityKind, NUMBER_OF_TYPES,
1> {
- };
- class NilValueField : public BitField<NilValue, NUMBER_OF_TYPES+1, 1> {};
+ class NilValueField : public BitField<NilValue, NUMBER_OF_TYPES, 1> {};
virtual CodeStub::Major MajorKey() { return CompareNilIC; }
virtual int NotMissMinorKey() { return GetExtraICState(); }
- EqualityKind equality_kind_;
NilValue nil_value_;
Types types_;
=======================================
--- /branches/bleeding_edge/src/hydrogen.cc Mon Jun 10 04:33:23 2013
+++ /branches/bleeding_edge/src/hydrogen.cc Mon Jun 10 08:30:02 2013
@@ -1698,7 +1698,6 @@
void HGraphBuilder::BuildCompareNil(
HValue* value,
- EqualityKind kind,
CompareNilICStub::Types types,
Handle<Map> map,
int position,
@@ -1733,9 +1732,7 @@
// emitted below is the actual monomorphic map.
BuildCheckMap(value, map);
} else {
- if (kind == kNonStrictEquality) {
- if_nil.Deopt();
- }
+ if_nil.Deopt();
}
}
@@ -9926,14 +9923,20 @@
HIfContinuation continuation;
CompareNilICStub::Types types;
if (kind == kStrictEquality) {
- types.Add((nil == kNullValue) ? CompareNilICStub::NULL_TYPE :
- CompareNilICStub::UNDEFINED);
+ IfBuilder if_nil(this);
+ if_nil.If<HCompareObjectEqAndBranch>(
+ value, (nil== kNullValue) ? graph()->GetConstantNull()
+ : graph()->GetConstantUndefined());
+ if_nil.Then();
+ if_nil.Else();
+ if_nil.CaptureContinuation(&continuation);
+ return ast_context()->ReturnContinuation(&continuation, expr->id());
} else {
types = CompareNilICStub::Types(expr->compare_nil_types());
if (types.IsEmpty()) types = CompareNilICStub::Types::FullCompare();
}
Handle<Map> map_handle = expr->map();
- BuildCompareNil(value, kind, types, map_handle,
+ BuildCompareNil(value, types, map_handle,
expr->position(), &continuation);
return ast_context()->ReturnContinuation(&continuation, expr->id());
}
=======================================
--- /branches/bleeding_edge/src/hydrogen.h Mon Jun 10 04:17:48 2013
+++ /branches/bleeding_edge/src/hydrogen.h Mon Jun 10 08:30:02 2013
@@ -1353,7 +1353,6 @@
void BuildCompareNil(
HValue* value,
- EqualityKind kind,
CompareNilICStub::Types types,
Handle<Map> map,
int position,
=======================================
--- /branches/bleeding_edge/src/ia32/full-codegen-ia32.cc Mon Jun 10
02:26:18 2013
+++ /branches/bleeding_edge/src/ia32/full-codegen-ia32.cc Mon Jun 10
08:30:02 2013
@@ -4778,7 +4778,6 @@
Split(equal, if_true, if_false, fall_through);
} else {
Handle<Code> ic = CompareNilICStub::GetUninitialized(isolate(),
-
kNonStrictEquality,
nil);
CallIC(ic, RelocInfo::CODE_TARGET, expr->CompareOperationFeedbackId());
__ test(eax, eax);
=======================================
--- /branches/bleeding_edge/src/ic.cc Mon Jun 10 04:27:09 2013
+++ /branches/bleeding_edge/src/ic.cc Mon Jun 10 08:30:02 2013
@@ -2943,16 +2943,8 @@
}
-MaybeObject* CompareNilIC::DoCompareNilSlow(EqualityKind kind,
- NilValue nil,
+MaybeObject* CompareNilIC::DoCompareNilSlow(NilValue nil,
Handle<Object> object) {
- if (kind == kStrictEquality) {
- if (nil == kNullValue) {
- return Smi::FromInt(object->IsNull());
- } else {
- return Smi::FromInt(object->IsUndefined());
- }
- }
if (object->IsNull() || object->IsUndefined()) {
return Smi::FromInt(true);
}
@@ -2973,7 +2965,6 @@
stub.Record(object);
old_types.TraceTransition(stub.GetTypes());
- EqualityKind kind = stub.GetKind();
NilValue nil = stub.GetNilValue();
// Find or create the specialized stub to support the new set of types.
@@ -2987,7 +2978,7 @@
code = stub.GetCode(isolate());
}
set_target(*code);
- return DoCompareNilSlow(kind, nil, object);
+ return DoCompareNilSlow(nil, object);
}
=======================================
--- /branches/bleeding_edge/src/ic.h Wed Jun 5 04:12:49 2013
+++ /branches/bleeding_edge/src/ic.h Mon Jun 10 08:30:02 2013
@@ -789,8 +789,7 @@
static void Clear(Address address, Code* target);
- static MUST_USE_RESULT MaybeObject* DoCompareNilSlow(EqualityKind kind,
- NilValue nil,
+ static MUST_USE_RESULT MaybeObject* DoCompareNilSlow(NilValue nil,
Handle<Object>
object);
};
=======================================
--- /branches/bleeding_edge/src/mips/full-codegen-mips.cc Fri Jun 7
09:59:34 2013
+++ /branches/bleeding_edge/src/mips/full-codegen-mips.cc Mon Jun 10
08:30:02 2013
@@ -4816,7 +4816,6 @@
Split(eq, a0, Operand(a1), if_true, if_false, fall_through);
} else {
Handle<Code> ic = CompareNilICStub::GetUninitialized(isolate(),
-
kNonStrictEquality,
nil);
CallIC(ic, RelocInfo::CODE_TARGET, expr->CompareOperationFeedbackId());
Split(ne, v0, Operand(zero_reg), if_true, if_false, fall_through);
=======================================
--- /branches/bleeding_edge/src/stub-cache.cc Mon Jun 10 02:35:47 2013
+++ /branches/bleeding_edge/src/stub-cache.cc Mon Jun 10 08:30:02 2013
@@ -909,8 +909,6 @@
Handle<Code> StubCache::ComputeCompareNil(Handle<Map> receiver_map,
CompareNilICStub& stub) {
- stub.SetKind(kNonStrictEquality);
-
Handle<String> name(isolate_->heap()->empty_string());
if (!receiver_map->is_shared()) {
Handle<Code> cached_ic = FindIC(name, receiver_map,
Code::COMPARE_NIL_IC,
=======================================
--- /branches/bleeding_edge/src/x64/full-codegen-x64.cc Mon Jun 10 02:26:18
2013
+++ /branches/bleeding_edge/src/x64/full-codegen-x64.cc Mon Jun 10 08:30:02
2013
@@ -4764,7 +4764,6 @@
Split(equal, if_true, if_false, fall_through);
} else {
Handle<Code> ic = CompareNilICStub::GetUninitialized(isolate(),
-
kNonStrictEquality,
nil);
CallIC(ic, RelocInfo::CODE_TARGET, expr->CompareOperationFeedbackId());
__ testq(rax, rax);
=======================================
--- /branches/bleeding_edge/test/cctest/test-compare-nil-ic-stub.cc Thu May
16 03:59:17 2013
+++ /branches/bleeding_edge/test/cctest/test-compare-nil-ic-stub.cc Mon Jun
10 08:30:02 2013
@@ -46,9 +46,8 @@
TEST(ExternalICStateParsing) {
Types types;
types.Add(CompareNilICStub::UNDEFINED);
- CompareNilICStub stub(kNonStrictEquality, kUndefinedValue, types);
+ CompareNilICStub stub(kUndefinedValue, types);
CompareNilICStub stub2(stub.GetExtraICState());
- CHECK_EQ(stub.GetKind(), stub2.GetKind());
CHECK_EQ(stub.GetNilValue(), stub2.GetNilValue());
CHECK_EQ(stub.GetTypes().ToIntegral(), stub2.GetTypes().ToIntegral());
}
--
--
v8-dev mailing list
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.