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

Unified Diff: src/code-stubs.h

Issue 13728002: Add an IC for CompareNil operations (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix SunSpider regression Created 7 years, 8 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/ast.cc ('k') | src/code-stubs.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/code-stubs.h
diff --git a/src/code-stubs.h b/src/code-stubs.h
index 55d7e5d809d12227531bded89766b17576d1e3e4..fd892b71c8110ac91417d73a07cdb6e1aa54e26b 100644
--- a/src/code-stubs.h
+++ b/src/code-stubs.h
@@ -47,6 +47,7 @@ namespace internal {
V(StringCompare) \
V(Compare) \
V(CompareIC) \
+ V(CompareNilIC) \
V(MathPow) \
V(StringLength) \
V(FunctionPrototype) \
@@ -293,7 +294,8 @@ class HydrogenCodeStub : public CodeStub {
virtual Code::Kind GetCodeKind() const { return Code::STUB; }
- CodeStubInterfaceDescriptor* GetInterfaceDescriptor(Isolate* isolate) {
+ CodeStubInterfaceDescriptor* GetInterfaceDescriptor(
+ Isolate* isolate) {
return isolate->code_stub_interface_descriptor(MajorKey());
}
@@ -321,6 +323,7 @@ class HydrogenCodeStub : public CodeStub {
class IsMissBits: public BitField<bool, kStubMinorKeyBits - 1, 1> {};
void GenerateLightweightMiss(MacroAssembler* masm);
+
virtual int MinorKey() {
return IsMissBits::encode(is_miss_) |
MinorKeyBits::encode(NotMissMinorKey());
@@ -946,6 +949,73 @@ class ICCompareStub: public PlatformCodeStub {
};
+class CompareNilICStub : public HydrogenCodeStub {
+ public:
+ CompareNilICStub() : HydrogenCodeStub(CODE_STUB_IS_MISS), bit_field_(0) {}
+
+ enum Types {
+ kCompareAgainstNull = 1 << 0,
+ kCompareAgainstUndefined = 1 << 1,
+ kCompareAgainstMonomorphicMap = 1 << 2,
+ kCompareAgainstUndetectable = 1 << 3,
+ kFullCompare = kCompareAgainstNull | kCompareAgainstUndefined |
+ kCompareAgainstUndetectable
+ };
+
+ CompareNilICStub(EqualityKind kind, Types types)
+ : HydrogenCodeStub(CODE_STUB_IS_NOT_MISS), bit_field_(0) {
+ bit_field_ = EqualityKindBits::encode(kind) | TypesBits::encode(types);
+ }
+
+ virtual InlineCacheState GetICState() {
+ Types types = GetTypes();
+ if (types == kFullCompare) {
+ return MEGAMORPHIC;
+ } else if ((types & kCompareAgainstMonomorphicMap) != 0) {
+ return MONOMORPHIC;
+ } else {
+ return PREMONOMORPHIC;
+ }
+ }
+
+ virtual Code::Kind GetCodeKind() const { return Code::COMPARE_NIL_IC; }
+
+ Handle<Code> GenerateCode();
+
+ virtual void InitializeInterfaceDescriptor(
+ Isolate* isolate,
+ CodeStubInterfaceDescriptor* descriptor);
+
+ virtual Code::ExtraICState GetExtraICState() {
+ return TypesBits::decode(bit_field_);
+ }
+
+ static Types TypesFromExtraICState(Code::ExtraICState state) {
+ return static_cast<Types>(state);
+ }
+
+ EqualityKind Kind() { return EqualityKindBits::decode(bit_field_); }
+ Types GetTypes() { return TypesBits::decode(bit_field_); }
+
+ static Types GetPatchedICFlags(Code* code,
+ EqualityKind kind,
+ NilValue nil,
+ Handle<Object> object,
+ bool* already_monomorphic);
+
+ private:
+ class EqualityKindBits : public BitField<EqualityKind, 0, 1> {};
+ class TypesBits : public BitField<Types, 2, 4> {};
+
+ virtual CodeStub::Major MajorKey() { return CompareNilIC; }
+ virtual int NotMissMinorKey() { return bit_field_; }
+
+ int bit_field_;
+
+ DISALLOW_COPY_AND_ASSIGN(CompareNilICStub);
+};
+
+
class CEntryStub : public PlatformCodeStub {
public:
explicit CEntryStub(int result_size,
« no previous file with comments | « src/ast.cc ('k') | src/code-stubs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698