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

Unified Diff: src/code-stubs.h

Issue 7473028: Implement a type recording ToBoolean IC. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 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 | « no previous file | src/code-stubs.cc » ('j') | src/code-stubs.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/code-stubs.h
===================================================================
--- src/code-stubs.h (revision 8701)
+++ src/code-stubs.h (working copy)
@@ -900,14 +900,56 @@
class ToBooleanStub: public CodeStub {
public:
- explicit ToBooleanStub(Register tos) : tos_(tos) { }
+ enum Type {
+ UNDEFINED,
+ BOOLEAN,
+ NULL_TYPE,
+ SMI,
+ UNDETECTABLE,
+ SPEC_OBJECT,
+ STRING,
+ HEAP_NUMBER,
+ INTERNAL_OBJECT,
+ NUMBER_OF_TYPES
+ };
+ class Types {
+ public:
+ Types() {}
+ explicit Types(int bits) : set_(bits) {}
+
+ bool IsEmpty() const { return set_.IsEmpty(); }
+ bool Contains(Type type) const { return set_.Contains(type); }
+ void Add(Type type) { set_.Add(type); }
+ int ToInt() const { return set_.ToIntegral(); }
+ void Print(StringStream* stream);
+ void TraceTransition(Types to);
+ bool Record(Handle<Object> object);
+
+ private:
+ EnumSet<Type> set_;
+ };
+
+ explicit ToBooleanStub(Register tos, Types types = Types())
+ : tos_(tos), types_(types) { }
+
void Generate(MacroAssembler* masm);
+ virtual int GetCodeKind() { return Code::TO_BOOLEAN_IC; }
+ virtual void PrintName(StringStream* stream);
private:
+ Major MajorKey() { return ToBoolean; }
+ int MinorKey() { return (tos_.code() << NUMBER_OF_TYPES) | types_.ToInt(); }
+
+ void CheckOddball(MacroAssembler* masm,
+ Type type,
+ Handle<Object> value,
+ bool result,
+ Label* patch);
+ void GenerateTypeTransition(MacroAssembler* masm);
+
Register tos_;
- Major MajorKey() { return ToBoolean; }
- int MinorKey() { return tos_.code(); }
+ Types types_;
};
} } // namespace v8::internal
« no previous file with comments | « no previous file | src/code-stubs.cc » ('j') | src/code-stubs.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698