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

Unified Diff: src/code-stubs.h

Issue 22715004: Version 3.20.15 (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Add TypedArray API and correctness patches r16033 and r16084 Created 7 years, 4 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/builtins.h ('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 c58acd6b16d4674a2b4da3f7a49d6ceca0c62cfe..84d9b023b3a237b36aee866c75b1ed5119e20d76 100644
--- a/src/code-stubs.h
+++ b/src/code-stubs.h
@@ -40,6 +40,7 @@ namespace internal {
#define CODE_STUB_LIST_ALL_PLATFORMS(V) \
V(CallFunction) \
V(CallConstruct) \
+ V(UnaryOp) \
V(BinaryOp) \
V(StringAdd) \
V(SubString) \
@@ -592,6 +593,73 @@ class StoreGlobalStub : public HydrogenCodeStub {
};
+class UnaryOpStub : public HydrogenCodeStub {
+ public:
+ // Stub without type info available -> construct uninitialized
+ explicit UnaryOpStub(Token::Value operation)
+ : HydrogenCodeStub(UNINITIALIZED), operation_(operation) { }
+ explicit UnaryOpStub(Code::ExtraICState ic_state) :
+ state_(StateBits::decode(ic_state)),
+ operation_(OperatorBits::decode(ic_state)) { }
+
+ virtual void InitializeInterfaceDescriptor(
+ Isolate* isolate,
+ CodeStubInterfaceDescriptor* descriptor);
+
+ virtual Code::Kind GetCodeKind() const { return Code::UNARY_OP_IC; }
+ virtual InlineCacheState GetICState() {
+ if (state_.Contains(GENERIC)) {
+ return MEGAMORPHIC;
+ } else if (state_.IsEmpty()) {
+ return PREMONOMORPHIC;
+ } else {
+ return MONOMORPHIC;
+ }
+ }
+ virtual Code::ExtraICState GetExtraICState() {
+ return OperatorBits::encode(operation_) |
+ StateBits::encode(state_.ToIntegral());
+ }
+
+ Token::Value operation() { return operation_; }
+ Handle<JSFunction> ToJSFunction(Isolate* isolate);
+ Builtins::JavaScript ToJSBuiltin();
+
+ void UpdateStatus(Handle<Object> object);
+ MaybeObject* Result(Handle<Object> object, Isolate* isolate);
+ Handle<Code> GenerateCode();
+ Handle<Type> GetType(Isolate* isolate);
+
+ protected:
+ void PrintState(StringStream* stream);
+ void PrintBaseName(StringStream* stream);
+
+ private:
+ enum UnaryOpType {
+ SMI,
+ HEAP_NUMBER,
+ GENERIC,
+ NUMBER_OF_TYPES
+ };
+
+ class State : public EnumSet<UnaryOpType, byte> {
+ public:
+ State() : EnumSet<UnaryOpType, byte>() { }
+ explicit State(byte bits) : EnumSet<UnaryOpType, byte>(bits) { }
+ void Print(StringStream* stream) const;
+ };
+
+ class StateBits : public BitField<int, 0, NUMBER_OF_TYPES> { };
+ class OperatorBits : public BitField<Token::Value, NUMBER_OF_TYPES, 8> { };
+
+ State state_;
+ Token::Value operation_;
+
+ virtual CodeStub::Major MajorKey() { return UnaryOp; }
+ virtual int NotMissMinorKey() { return GetExtraICState(); }
+};
+
+
class FastCloneShallowArrayStub : public HydrogenCodeStub {
public:
// Maximum length of copied elements array.
« no previous file with comments | « src/builtins.h ('k') | src/code-stubs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698