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

Unified Diff: src/code-stubs.h

Issue 14367018: Add monomorphic CompareNilICs and Crankshaft support (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback 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..fa609240e0850ad1b427e992c101330e90c00585 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) \
@@ -946,6 +947,102 @@ class ICCompareStub: public PlatformCodeStub {
};
+class CompareNilICStub : public HydrogenCodeStub {
+ public:
+ enum Types {
+ kCompareAgainstNull = 1 << 0,
+ kCompareAgainstUndefined = 1 << 1,
+ kCompareAgainstMonomorphicMap = 1 << 2,
+ kCompareAgainstUndetectable = 1 << 3,
+ kFullCompare = kCompareAgainstNull | kCompareAgainstUndefined |
+ kCompareAgainstUndetectable
+ };
+
+ CompareNilICStub(EqualityKind kind, NilValue nil, Types types)
+ : HydrogenCodeStub(CODE_STUB_IS_NOT_MISS), bit_field_(0) {
+ bit_field_ = EqualityKindField::encode(kind) |
+ NilValueField::encode(nil) |
+ TypesField::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();
+
+ static Handle<Code> GetUninitialized(Isolate* isolate,
+ EqualityKind kind,
+ NilValue nil) {
+ return CompareNilICStub(kind, nil).GetCode(isolate);
+ }
+
+ virtual void InitializeInterfaceDescriptor(
+ Isolate* isolate,
+ CodeStubInterfaceDescriptor* descriptor);
+
+ static void InitializeForIsolate(Isolate* isolate) {
+ CompareNilICStub compare_stub(kStrictEquality, kNullValue);
+ compare_stub.InitializeInterfaceDescriptor(
+ isolate,
+ isolate->code_stub_interface_descriptor(CodeStub::CompareNilIC));
+ }
+
+ virtual Code::ExtraICState GetExtraICState() {
+ return bit_field_;
+ }
+
+ EqualityKind GetKind() { return EqualityKindField::decode(bit_field_); }
+ NilValue GetNilValue() { return NilValueField::decode(bit_field_); }
+ Types GetTypes() { return TypesField::decode(bit_field_); }
+
+ static Types TypesFromExtraICState(
+ Code::ExtraICState state) {
+ return TypesField::decode(state);
+ }
+ static EqualityKind EqualityKindFromExtraICState(
+ Code::ExtraICState state) {
+ return EqualityKindField::decode(state);
+ }
+ static NilValue NilValueFromExtraICState(Code::ExtraICState state) {
+ return NilValueField::decode(state);
+ }
+
+ static Types GetPatchedICFlags(Code::ExtraICState extra_ic_state,
+ Handle<Object> object,
+ bool* already_monomorphic);
+
+ private:
+ friend class CompareNilIC;
+
+ class EqualityKindField : public BitField<EqualityKind, 0, 1> {};
+ class NilValueField : public BitField<NilValue, 1, 1> {};
+ class TypesField : public BitField<Types, 3, 4> {};
+
+ CompareNilICStub(EqualityKind kind, NilValue nil)
+ : HydrogenCodeStub(CODE_STUB_IS_MISS), bit_field_(0) {
+ bit_field_ = EqualityKindField::encode(kind) |
+ NilValueField::encode(nil);
+ }
+
+ 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