| Index: src/code-stubs.h
|
| diff --git a/src/code-stubs.h b/src/code-stubs.h
|
| index c4f0c4d38a25658b34e9e73bb46472f6f46c3221..17a4bfde9c378f3609408dcec50a5e86bd559634 100644
|
| --- a/src/code-stubs.h
|
| +++ b/src/code-stubs.h
|
| @@ -123,8 +123,6 @@ namespace internal {
|
|
|
| // Mode to overwrite BinaryExpression values.
|
| enum OverwriteMode { NO_OVERWRITE, OVERWRITE_LEFT, OVERWRITE_RIGHT };
|
| -enum UnaryOverwriteMode { UNARY_OVERWRITE, UNARY_NO_OVERWRITE };
|
| -
|
|
|
| // Stub is base classes of all stubs.
|
| class CodeStub BASE_EMBEDDED {
|
| @@ -197,6 +195,8 @@ class CodeStub BASE_EMBEDDED {
|
| return -1;
|
| }
|
|
|
| + virtual void PrintName(StringStream* stream);
|
| +
|
| protected:
|
| static bool CanUseFPRegisters();
|
|
|
| @@ -208,6 +208,11 @@ class CodeStub BASE_EMBEDDED {
|
| // a fixed (non-moveable) code object.
|
| virtual bool NeedsImmovableCode() { return false; }
|
|
|
| + // Returns a name for logging/debugging purposes.
|
| + SmartArrayPointer<const char> GetName();
|
| + virtual void PrintBaseName(StringStream* stream);
|
| + virtual void PrintState(StringStream* stream) { }
|
| +
|
| private:
|
| // Perform bookkeeping required after code generation when stub code is
|
| // initially generated.
|
| @@ -236,10 +241,6 @@ class CodeStub BASE_EMBEDDED {
|
| // If a stub uses a special cache override this.
|
| virtual bool UseSpecialCache() { return false; }
|
|
|
| - // Returns a name for logging/debugging purposes.
|
| - SmartArrayPointer<const char> GetName();
|
| - virtual void PrintName(StringStream* stream);
|
| -
|
| // Computes the key based on major and minor.
|
| uint32_t GetKey() {
|
| ASSERT(static_cast<int>(MajorKey()) < NUMBER_OF_IDS);
|
| @@ -354,6 +355,9 @@ class HydrogenCodeStub : public CodeStub {
|
|
|
| Handle<Code> GenerateLightweightMissCode(Isolate* isolate);
|
|
|
| + template<class StateType>
|
| + void TraceTransition(StateType from, StateType to);
|
| +
|
| private:
|
| class MinorKeyBits: public BitField<int, 0, kStubMinorKeyBits - 1> {};
|
| class IsMissBits: public BitField<bool, kStubMinorKeyBits - 1, 1> {};
|
| @@ -520,6 +524,74 @@ class FastNewBlockContextStub : public PlatformCodeStub {
|
| };
|
|
|
|
|
| +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);
|
| +
|
| + 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:
|
| + Builtins::JavaScript ToJSBuiltin();
|
| +
|
| + 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.
|
| @@ -1148,7 +1220,6 @@ class CompareNilICStub : public HydrogenCodeStub {
|
| }
|
|
|
| void Print(StringStream* stream) const;
|
| - void TraceTransition(State to) const;
|
| };
|
|
|
| static Handle<Type> StateToType(
|
| @@ -1208,14 +1279,15 @@ class CompareNilICStub : public HydrogenCodeStub {
|
| return state & ((1 << NUMBER_OF_TYPES) - 1);
|
| }
|
|
|
| - void Record(Handle<Object> object);
|
| + void UpdateStatus(Handle<Object> object);
|
|
|
| bool IsMonomorphic() const { return state_.Contains(MONOMORPHIC_MAP); }
|
| NilValue GetNilValue() const { return nil_value_; }
|
| State GetState() const { return state_; }
|
| void ClearState() { state_.RemoveAll(); }
|
|
|
| - virtual void PrintName(StringStream* stream);
|
| + virtual void PrintState(StringStream* stream);
|
| + virtual void PrintBaseName(StringStream* stream);
|
|
|
| private:
|
| friend class CompareNilIC;
|
| @@ -1978,8 +2050,7 @@ class ToBooleanStub: public HydrogenCodeStub {
|
|
|
| byte ToByte() const { return ToIntegral(); }
|
| void Print(StringStream* stream) const;
|
| - void TraceTransition(Types to) const;
|
| - bool Record(Handle<Object> object);
|
| + bool UpdateStatus(Handle<Object> object);
|
| bool NeedsMap() const;
|
| bool CanBeUndetectable() const;
|
| bool IsGeneric() const { return ToIntegral() == Generic().ToIntegral(); }
|
| @@ -1992,7 +2063,7 @@ class ToBooleanStub: public HydrogenCodeStub {
|
| explicit ToBooleanStub(Code::ExtraICState state)
|
| : types_(static_cast<byte>(state)) { }
|
|
|
| - bool Record(Handle<Object> object);
|
| + bool UpdateStatus(Handle<Object> object);
|
| Types GetTypes() { return types_; }
|
|
|
| virtual Handle<Code> GenerateCode();
|
| @@ -2001,7 +2072,7 @@ class ToBooleanStub: public HydrogenCodeStub {
|
| CodeStubInterfaceDescriptor* descriptor);
|
|
|
| virtual Code::Kind GetCodeKind() const { return Code::TO_BOOLEAN_IC; }
|
| - virtual void PrintName(StringStream* stream);
|
| + virtual void PrintState(StringStream* stream);
|
|
|
| virtual bool SometimesSetsUpAFrame() { return false; }
|
|
|
|
|