Chromium Code Reviews| Index: src/code-stubs.h |
| diff --git a/src/code-stubs.h b/src/code-stubs.h |
| index c68862e93c887442a22528015f0b1d33d5731a55..f9b7cc3a7d448b5fae104e382eb98c6f22c7e013 100644 |
| --- a/src/code-stubs.h |
| +++ b/src/code-stubs.h |
| @@ -171,23 +171,22 @@ class CodeStub BASE_EMBEDDED { |
| bool FindCodeInCache(Code** code_out); |
| // Returns information for computing the number key. |
| - virtual Major MajorKey() = 0; |
| - virtual int MinorKey() = 0; |
| + virtual Major MajorKey() const = 0; |
| + virtual int MinorKey() const = 0; |
| virtual InlineCacheState GetICState() { |
| return UNINITIALIZED; |
| } |
| - virtual ExtraICState GetExtraICState() { |
| + virtual ExtraICState GetExtraICState() const { |
| return kNoExtraICState; |
| } |
| virtual Code::StubType GetStubType() { |
| return Code::NORMAL; |
| } |
| - virtual void PrintName(StringStream* stream); |
| - |
| - // Returns a name for logging/debugging purposes. |
| - SmartArrayPointer<const char> GetName(); |
| + friend OStream& operator<<(OStream& os, const CodeStub& s) { |
| + return s.PrintName(os); |
| + } |
| Isolate* isolate() const { return isolate_; } |
| @@ -199,8 +198,9 @@ class CodeStub BASE_EMBEDDED { |
| // a fixed (non-moveable) code object. |
| virtual bool NeedsImmovableCode() { return false; } |
| - virtual void PrintBaseName(StringStream* stream); |
| - virtual void PrintState(StringStream* stream) { } |
| + virtual OStream& PrintName(OStream& os) const; // NOLINT |
|
Michael Starzinger
2014/07/02 15:14:58
suggestion: We could switch the PrintFoo methods t
Sven Panne
2014/07/03 07:18:52
Done.
|
| + virtual OStream& PrintBaseName(OStream& os) const; // NOLINT |
| + virtual OStream& PrintState(OStream& os) const { return os; } // NOLINT |
| private: |
| // Perform bookkeeping required after code generation when stub code is |
| @@ -447,7 +447,7 @@ class HydrogenCodeStub : public CodeStub { |
| // Retrieve the code for the stub. Generate the code if needed. |
| virtual Handle<Code> GenerateCode() = 0; |
| - virtual int NotMissMinorKey() = 0; |
| + virtual int NotMissMinorKey() const = 0; |
| Handle<Code> GenerateLightweightMissCode(); |
| @@ -459,7 +459,7 @@ class HydrogenCodeStub : public CodeStub { |
| class IsMissBits: public BitField<bool, kStubMinorKeyBits - 1, 1> {}; |
| void GenerateLightweightMiss(MacroAssembler* masm); |
| - virtual int MinorKey() { |
| + virtual int MinorKey() const { |
| return IsMissBits::encode(is_uninitialized_) | |
| MinorKeyBits::encode(NotMissMinorKey()); |
| } |
| @@ -546,8 +546,8 @@ class ToNumberStub: public HydrogenCodeStub { |
| } |
| private: |
| - Major MajorKey() { return ToNumber; } |
| - int NotMissMinorKey() { return 0; } |
| + Major MajorKey() const { return ToNumber; } |
| + int NotMissMinorKey() const { return 0; } |
| }; |
| @@ -566,8 +566,8 @@ class NumberToStringStub V8_FINAL : public HydrogenCodeStub { |
| static const int kNumber = 0; |
| private: |
| - virtual Major MajorKey() V8_OVERRIDE { return NumberToString; } |
| - virtual int NotMissMinorKey() V8_OVERRIDE { return 0; } |
| + virtual Major MajorKey() const V8_OVERRIDE { return NumberToString; } |
| + virtual int NotMissMinorKey() const V8_OVERRIDE { return 0; } |
| }; |
| @@ -594,8 +594,8 @@ class FastNewClosureStub : public HydrogenCodeStub { |
| class StrictModeBits: public BitField<bool, 0, 1> {}; |
| class IsGeneratorBits: public BitField<bool, 1, 1> {}; |
| - Major MajorKey() { return FastNewClosure; } |
| - int NotMissMinorKey() { |
| + Major MajorKey() const { return FastNewClosure; } |
| + int NotMissMinorKey() const { |
| return StrictModeBits::encode(strict_mode_ == STRICT) | |
| IsGeneratorBits::encode(is_generator_); |
| } |
| @@ -623,8 +623,8 @@ class FastNewContextStub V8_FINAL : public HydrogenCodeStub { |
| int slots() const { return slots_; } |
| - virtual Major MajorKey() V8_OVERRIDE { return FastNewContext; } |
| - virtual int NotMissMinorKey() V8_OVERRIDE { return slots_; } |
| + virtual Major MajorKey() const V8_OVERRIDE { return FastNewContext; } |
| + virtual int NotMissMinorKey() const V8_OVERRIDE { return slots_; } |
| // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
| static const int kFunction = 0; |
| @@ -657,8 +657,8 @@ class FastCloneShallowArrayStub : public HydrogenCodeStub { |
| class AllocationSiteModeBits: public BitField<AllocationSiteMode, 0, 1> {}; |
| // Ensure data fits within available bits. |
| - Major MajorKey() { return FastCloneShallowArray; } |
| - int NotMissMinorKey() { |
| + Major MajorKey() const { return FastCloneShallowArray; } |
| + int NotMissMinorKey() const { |
| return AllocationSiteModeBits::encode(allocation_site_mode_); |
| } |
| }; |
| @@ -685,8 +685,8 @@ class FastCloneShallowObjectStub : public HydrogenCodeStub { |
| private: |
| int length_; |
| - Major MajorKey() { return FastCloneShallowObject; } |
| - int NotMissMinorKey() { return length_; } |
| + Major MajorKey() const { return FastCloneShallowObject; } |
| + int NotMissMinorKey() const { return length_; } |
| DISALLOW_COPY_AND_ASSIGN(FastCloneShallowObjectStub); |
| }; |
| @@ -705,8 +705,8 @@ class CreateAllocationSiteStub : public HydrogenCodeStub { |
| CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
| private: |
| - Major MajorKey() { return CreateAllocationSite; } |
| - int NotMissMinorKey() { return 0; } |
| + Major MajorKey() const { return CreateAllocationSite; } |
| + int NotMissMinorKey() const { return 0; } |
| DISALLOW_COPY_AND_ASSIGN(CreateAllocationSiteStub); |
| }; |
| @@ -730,8 +730,8 @@ class InstanceofStub: public PlatformCodeStub { |
| void Generate(MacroAssembler* masm); |
| private: |
| - Major MajorKey() { return Instanceof; } |
| - int MinorKey() { return static_cast<int>(flags_); } |
| + Major MajorKey() const { return Instanceof; } |
| + int MinorKey() const { return static_cast<int>(flags_); } |
| bool HasArgsInRegisters() const { |
| return (flags_ & kArgsInRegisters) != 0; |
| @@ -745,7 +745,7 @@ class InstanceofStub: public PlatformCodeStub { |
| return (flags_ & kReturnTrueFalseObject) != 0; |
| } |
| - virtual void PrintName(StringStream* stream); |
| + virtual OStream& PrintName(OStream& os) const V8_OVERRIDE; // NOLINT |
| Flags flags_; |
| }; |
| @@ -769,10 +769,10 @@ class ArrayConstructorStub: public PlatformCodeStub { |
| private: |
| void GenerateDispatchToArrayStub(MacroAssembler* masm, |
| AllocationSiteOverrideMode mode); |
| - virtual void PrintName(StringStream* stream); |
| + virtual OStream& PrintName(OStream& os) const V8_OVERRIDE; // NOLINT |
| - virtual CodeStub::Major MajorKey() { return ArrayConstructor; } |
| - virtual int MinorKey() { return argument_count_; } |
| + virtual CodeStub::Major MajorKey() const { return ArrayConstructor; } |
| + virtual int MinorKey() const { return argument_count_; } |
| ArgumentCountKey argument_count_; |
| }; |
| @@ -785,8 +785,8 @@ class InternalArrayConstructorStub: public PlatformCodeStub { |
| void Generate(MacroAssembler* masm); |
| private: |
| - virtual CodeStub::Major MajorKey() { return InternalArrayConstructor; } |
| - virtual int MinorKey() { return 0; } |
| + virtual CodeStub::Major MajorKey() const { return InternalArrayConstructor; } |
| + virtual int MinorKey() const { return 0; } |
| void GenerateCase(MacroAssembler* masm, ElementsKind kind); |
| }; |
| @@ -801,8 +801,8 @@ class MathPowStub: public PlatformCodeStub { |
| virtual void Generate(MacroAssembler* masm); |
| private: |
| - virtual CodeStub::Major MajorKey() { return MathPow; } |
| - virtual int MinorKey() { return exponent_type_; } |
| + virtual CodeStub::Major MajorKey() const { return MathPow; } |
| + virtual int MinorKey() const { return exponent_type_; } |
| ExponentType exponent_type_; |
| }; |
| @@ -824,9 +824,9 @@ class ICStub: public PlatformCodeStub { |
| virtual void FinishCode(Handle<Code> code) { |
| code->set_stub_info(MinorKey()); |
| } |
| - Code::Kind kind() { return kind_; } |
| + Code::Kind kind() const { return kind_; } |
| - virtual int MinorKey() { |
| + virtual int MinorKey() const { |
| return KindBits::encode(kind_); |
| } |
| @@ -859,15 +859,15 @@ class CallICStub: public PlatformCodeStub { |
| return state_.GetICState(); |
| } |
| - virtual ExtraICState GetExtraICState() V8_FINAL V8_OVERRIDE { |
| + virtual ExtraICState GetExtraICState() const V8_FINAL V8_OVERRIDE { |
| return state_.GetExtraICState(); |
| } |
| protected: |
| - virtual int MinorKey() { return GetExtraICState(); } |
| - virtual void PrintState(StringStream* stream) V8_OVERRIDE; |
| + virtual int MinorKey() const { return GetExtraICState(); } |
| + virtual OStream& PrintState(OStream& os) const V8_OVERRIDE; // NOLINT |
| - virtual CodeStub::Major MajorKey() { return CallIC; } |
| + virtual CodeStub::Major MajorKey() const { return CallIC; } |
| // Code generation helpers. |
| void GenerateMiss(MacroAssembler* masm, IC::UtilityId id); |
| @@ -884,9 +884,9 @@ class CallIC_ArrayStub: public CallICStub { |
| virtual void Generate(MacroAssembler* masm); |
| protected: |
| - virtual void PrintState(StringStream* stream) V8_OVERRIDE; |
| + virtual OStream& PrintState(OStream& os) const V8_OVERRIDE; // NOLINT |
| - virtual CodeStub::Major MajorKey() { return CallIC_Array; } |
| + virtual CodeStub::Major MajorKey() const { return CallIC_Array; } |
| }; |
| @@ -897,7 +897,7 @@ class FunctionPrototypeStub: public ICStub { |
| virtual void Generate(MacroAssembler* masm); |
| private: |
| - virtual CodeStub::Major MajorKey() { return FunctionPrototype; } |
| + virtual CodeStub::Major MajorKey() const { return FunctionPrototype; } |
| }; |
| @@ -907,14 +907,14 @@ class StoreICStub: public ICStub { |
| : ICStub(isolate, kind), strict_mode_(strict_mode) { } |
| protected: |
| - virtual ExtraICState GetExtraICState() { |
| + virtual ExtraICState GetExtraICState() const { |
| return StoreIC::ComputeExtraICState(strict_mode_); |
| } |
| private: |
| STATIC_ASSERT(KindBits::kSize == 4); |
| class StrictModeBits: public BitField<bool, 4, 1> {}; |
| - virtual int MinorKey() { |
| + virtual int MinorKey() const { |
| return KindBits::encode(kind()) | StrictModeBits::encode(strict_mode_); |
| } |
| @@ -937,11 +937,11 @@ class HICStub: public HydrogenCodeStub { |
| class HandlerStub: public HICStub { |
| public: |
| virtual Code::Kind GetCodeKind() const { return Code::HANDLER; } |
| - virtual ExtraICState GetExtraICState() { return kind(); } |
| + virtual ExtraICState GetExtraICState() const { return kind(); } |
| protected: |
| explicit HandlerStub(Isolate* isolate) : HICStub(isolate) { } |
| - virtual int NotMissMinorKey() { return bit_field_; } |
| + virtual int NotMissMinorKey() const { return bit_field_; } |
| int bit_field_; |
| }; |
| @@ -989,7 +989,7 @@ class LoadFieldStub: public HandlerStub { |
| private: |
| STATIC_ASSERT(KindBits::kSize == 4); |
| class EncodedLoadFieldByIndexBits: public BitField<int, 4, 13> {}; |
| - virtual CodeStub::Major MajorKey() { return LoadField; } |
| + virtual CodeStub::Major MajorKey() const { return LoadField; } |
| FieldIndex index_; |
| }; |
| @@ -1013,7 +1013,7 @@ class StringLengthStub: public HandlerStub { |
| } |
| private: |
| - virtual CodeStub::Major MajorKey() { return StringLength; } |
| + virtual CodeStub::Major MajorKey() const { return StringLength; } |
| }; |
| @@ -1026,7 +1026,7 @@ class KeyedStringLengthStub: public StringLengthStub { |
| CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
| private: |
| - virtual CodeStub::Major MajorKey() { return KeyedStringLength; } |
| + virtual CodeStub::Major MajorKey() const { return KeyedStringLength; } |
| }; |
| @@ -1082,7 +1082,7 @@ class StoreGlobalStub : public HandlerStub { |
| } |
| private: |
| - Major MajorKey() { return StoreGlobal; } |
| + Major MajorKey() const { return StoreGlobal; } |
| class IsConstantBits: public BitField<bool, 0, 1> {}; |
| class RepresentationBits: public BitField<Representation::Kind, 1, 8> {}; |
| @@ -1107,8 +1107,8 @@ class CallApiFunctionStub : public PlatformCodeStub { |
| private: |
| virtual void Generate(MacroAssembler* masm) V8_OVERRIDE; |
| - virtual Major MajorKey() V8_OVERRIDE { return CallApiFunction; } |
| - virtual int MinorKey() V8_OVERRIDE { return bit_field_; } |
| + virtual Major MajorKey() const V8_OVERRIDE { return CallApiFunction; } |
| + virtual int MinorKey() const V8_OVERRIDE { return bit_field_; } |
| class IsStoreBits: public BitField<bool, 0, 1> {}; |
| class CallDataUndefinedBits: public BitField<bool, 1, 1> {}; |
| @@ -1126,8 +1126,8 @@ class CallApiGetterStub : public PlatformCodeStub { |
| private: |
| virtual void Generate(MacroAssembler* masm) V8_OVERRIDE; |
| - virtual Major MajorKey() V8_OVERRIDE { return CallApiGetter; } |
| - virtual int MinorKey() V8_OVERRIDE { return 0; } |
| + virtual Major MajorKey() const V8_OVERRIDE { return CallApiGetter; } |
| + virtual int MinorKey() const V8_OVERRIDE { return 0; } |
| DISALLOW_COPY_AND_ASSIGN(CallApiGetterStub); |
| }; |
| @@ -1144,7 +1144,7 @@ class KeyedLoadFieldStub: public LoadFieldStub { |
| CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
| private: |
| - virtual CodeStub::Major MajorKey() { return KeyedLoadField; } |
| + virtual CodeStub::Major MajorKey() const { return KeyedLoadField; } |
| }; |
| @@ -1171,7 +1171,7 @@ class BinaryOpICStub : public HydrogenCodeStub { |
| return state_.GetICState(); |
| } |
| - virtual ExtraICState GetExtraICState() V8_FINAL V8_OVERRIDE { |
| + virtual ExtraICState GetExtraICState() const V8_FINAL V8_OVERRIDE { |
| return state_.GetExtraICState(); |
| } |
| @@ -1179,10 +1179,10 @@ class BinaryOpICStub : public HydrogenCodeStub { |
| const BinaryOpIC::State& state() const { return state_; } |
| - virtual void PrintState(StringStream* stream) V8_FINAL V8_OVERRIDE; |
| + virtual OStream& PrintState(OStream& os) const V8_FINAL V8_OVERRIDE; // NOLINT |
| - virtual Major MajorKey() V8_OVERRIDE { return BinaryOpIC; } |
| - virtual int NotMissMinorKey() V8_FINAL V8_OVERRIDE { |
| + virtual Major MajorKey() const V8_OVERRIDE { return BinaryOpIC; } |
| + virtual int NotMissMinorKey() const V8_FINAL V8_OVERRIDE { |
| return GetExtraICState(); |
| } |
| @@ -1224,16 +1224,18 @@ class BinaryOpICWithAllocationSiteStub V8_FINAL : public PlatformCodeStub { |
| return state_.GetICState(); |
| } |
| - virtual ExtraICState GetExtraICState() V8_OVERRIDE { |
| + virtual ExtraICState GetExtraICState() const V8_OVERRIDE { |
| return state_.GetExtraICState(); |
| } |
| virtual void Generate(MacroAssembler* masm) V8_OVERRIDE; |
| - virtual void PrintState(StringStream* stream) V8_OVERRIDE; |
| + virtual OStream& PrintState(OStream& os) const V8_OVERRIDE; // NOLINT |
| - virtual Major MajorKey() V8_OVERRIDE { return BinaryOpICWithAllocationSite; } |
| - virtual int MinorKey() V8_OVERRIDE { return GetExtraICState(); } |
| + virtual Major MajorKey() const V8_OVERRIDE { |
| + return BinaryOpICWithAllocationSite; |
| + } |
| + virtual int MinorKey() const V8_OVERRIDE { return GetExtraICState(); } |
| private: |
| static void GenerateAheadOfTime(Isolate* isolate, |
| @@ -1267,7 +1269,7 @@ class BinaryOpWithAllocationSiteStub V8_FINAL : public BinaryOpICStub { |
| virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
| - virtual Major MajorKey() V8_OVERRIDE { |
| + virtual Major MajorKey() const V8_OVERRIDE { |
| return BinaryOpWithAllocationSite; |
| } |
| @@ -1323,10 +1325,10 @@ class StringAddStub V8_FINAL : public HydrogenCodeStub { |
| class PretenureFlagBits: public BitField<PretenureFlag, 2, 1> {}; |
| uint32_t bit_field_; |
| - virtual Major MajorKey() V8_OVERRIDE { return StringAdd; } |
| - virtual int NotMissMinorKey() V8_OVERRIDE { return bit_field_; } |
| + virtual Major MajorKey() const V8_OVERRIDE { return StringAdd; } |
| + virtual int NotMissMinorKey() const V8_OVERRIDE { return bit_field_; } |
| - virtual void PrintBaseName(StringStream* stream) V8_OVERRIDE; |
| + virtual OStream& PrintBaseName(OStream& os) const V8_OVERRIDE; // NOLINT |
| DISALLOW_COPY_AND_ASSIGN(StringAddStub); |
| }; |
| @@ -1369,8 +1371,8 @@ class ICCompareStub: public PlatformCodeStub { |
| code->set_stub_info(MinorKey()); |
| } |
| - virtual CodeStub::Major MajorKey() { return CompareIC; } |
| - virtual int MinorKey(); |
| + virtual CodeStub::Major MajorKey() const { return CompareIC; } |
| + virtual int MinorKey() const; |
| virtual Code::Kind GetCodeKind() const { return Code::COMPARE_IC; } |
| @@ -1443,7 +1445,7 @@ class CompareNilICStub : public HydrogenCodeStub { |
| virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
| - virtual ExtraICState GetExtraICState() { |
| + virtual ExtraICState GetExtraICState() const { |
| return NilValueField::encode(nil_value_) | |
| TypesField::encode(state_.ToIntegral()); |
| } |
| @@ -1454,8 +1456,8 @@ class CompareNilICStub : public HydrogenCodeStub { |
| NilValue GetNilValue() const { return nil_value_; } |
| void ClearState() { state_.RemoveAll(); } |
| - virtual void PrintState(StringStream* stream); |
| - virtual void PrintBaseName(StringStream* stream); |
| + virtual OStream& PrintState(OStream& os) const V8_OVERRIDE; // NOLINT |
| + virtual OStream& PrintBaseName(OStream& os) const V8_OVERRIDE; // NOLINT |
| private: |
| friend class CompareNilIC; |
| @@ -1477,9 +1479,8 @@ class CompareNilICStub : public HydrogenCodeStub { |
| public: |
| State() : EnumSet<CompareNilType, byte>(0) { } |
| explicit State(byte bits) : EnumSet<CompareNilType, byte>(bits) { } |
| - |
| - void Print(StringStream* stream) const; |
| }; |
| + friend OStream& operator<<(OStream& os, const State& s); |
| CompareNilICStub(Isolate* isolate, |
| NilValue nil, |
| @@ -1489,8 +1490,8 @@ class CompareNilICStub : public HydrogenCodeStub { |
| class NilValueField : public BitField<NilValue, 0, 1> {}; |
| class TypesField : public BitField<byte, 1, NUMBER_OF_TYPES> {}; |
| - virtual CodeStub::Major MajorKey() { return CompareNilIC; } |
| - virtual int NotMissMinorKey() { return GetExtraICState(); } |
| + virtual CodeStub::Major MajorKey() const { return CompareNilIC; } |
| + virtual int NotMissMinorKey() const { return GetExtraICState(); } |
| NilValue nil_value_; |
| State state_; |
| @@ -1499,6 +1500,9 @@ class CompareNilICStub : public HydrogenCodeStub { |
| }; |
| +OStream& operator<<(OStream& os, const CompareNilICStub::State& s); |
| + |
| + |
| class CEntryStub : public PlatformCodeStub { |
| public: |
| CEntryStub(Isolate* isolate, |
| @@ -1521,8 +1525,8 @@ class CEntryStub : public PlatformCodeStub { |
| const int result_size_; |
| SaveFPRegsMode save_doubles_; |
| - Major MajorKey() { return CEntry; } |
| - int MinorKey(); |
| + Major MajorKey() const { return CEntry; } |
| + int MinorKey() const; |
| bool NeedsImmovableCode(); |
| }; |
| @@ -1538,8 +1542,8 @@ class JSEntryStub : public PlatformCodeStub { |
| void GenerateBody(MacroAssembler* masm, bool is_construct); |
| private: |
| - Major MajorKey() { return JSEntry; } |
| - int MinorKey() { return 0; } |
| + Major MajorKey() const { return JSEntry; } |
| + int MinorKey() const { return 0; } |
| virtual void FinishCode(Handle<Code> code); |
| @@ -1554,10 +1558,10 @@ class JSConstructEntryStub : public JSEntryStub { |
| void Generate(MacroAssembler* masm) { GenerateBody(masm, true); } |
| private: |
| - int MinorKey() { return 1; } |
| + int MinorKey() const { return 1; } |
| - virtual void PrintName(StringStream* stream) { |
| - stream->Add("JSConstructEntryStub"); |
| + virtual OStream& PrintName(OStream& os) const V8_OVERRIDE { // NOLINT |
| + return os << "JSConstructEntryStub"; |
| } |
| }; |
| @@ -1577,8 +1581,8 @@ class ArgumentsAccessStub: public PlatformCodeStub { |
| private: |
| Type type_; |
| - Major MajorKey() { return ArgumentsAccess; } |
| - int MinorKey() { return type_; } |
| + Major MajorKey() const { return ArgumentsAccess; } |
| + int MinorKey() const { return type_; } |
| void Generate(MacroAssembler* masm); |
| void GenerateReadElement(MacroAssembler* masm); |
| @@ -1586,7 +1590,7 @@ class ArgumentsAccessStub: public PlatformCodeStub { |
| void GenerateNewSloppyFast(MacroAssembler* masm); |
| void GenerateNewSloppySlow(MacroAssembler* masm); |
| - virtual void PrintName(StringStream* stream); |
| + virtual OStream& PrintName(OStream& os) const V8_OVERRIDE; // NOLINT |
| }; |
| @@ -1595,8 +1599,8 @@ class RegExpExecStub: public PlatformCodeStub { |
| explicit RegExpExecStub(Isolate* isolate) : PlatformCodeStub(isolate) { } |
| private: |
| - Major MajorKey() { return RegExpExec; } |
| - int MinorKey() { return 0; } |
| + Major MajorKey() const { return RegExpExec; } |
| + int MinorKey() const { return 0; } |
| void Generate(MacroAssembler* masm); |
| }; |
| @@ -1612,8 +1616,8 @@ class RegExpConstructResultStub V8_FINAL : public HydrogenCodeStub { |
| virtual void InitializeInterfaceDescriptor( |
| CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
| - virtual Major MajorKey() V8_OVERRIDE { return RegExpConstructResult; } |
| - virtual int NotMissMinorKey() V8_OVERRIDE { return 0; } |
| + virtual Major MajorKey() const V8_OVERRIDE { return RegExpConstructResult; } |
| + virtual int NotMissMinorKey() const V8_OVERRIDE { return 0; } |
| static void InstallDescriptors(Isolate* isolate); |
| @@ -1642,14 +1646,14 @@ class CallFunctionStub: public PlatformCodeStub { |
| int argc_; |
| CallFunctionFlags flags_; |
| - virtual void PrintName(StringStream* stream); |
| + virtual OStream& PrintName(OStream& os) const V8_OVERRIDE; // NOLINT |
| // Minor key encoding in 32 bits with Bitfield <Type, shift, size>. |
| class FlagBits: public BitField<CallFunctionFlags, 0, 2> {}; |
| class ArgcBits: public BitField<unsigned, 2, 32 - 2> {}; |
| - Major MajorKey() { return CallFunction; } |
| - int MinorKey() { |
| + Major MajorKey() const { return CallFunction; } |
| + int MinorKey() const { |
| // Encode the parameters in a unique 32 bit value. |
| return FlagBits::encode(flags_) | ArgcBits::encode(argc_); |
| } |
| @@ -1678,12 +1682,12 @@ class CallConstructStub: public PlatformCodeStub { |
| private: |
| CallConstructorFlags flags_; |
| - virtual void PrintName(StringStream* stream); |
| + virtual OStream& PrintName(OStream& os) const V8_OVERRIDE; // NOLINT |
| - Major MajorKey() { return CallConstruct; } |
| - int MinorKey() { return flags_; } |
| + Major MajorKey() const { return CallConstruct; } |
| + int MinorKey() const { return flags_; } |
| - bool RecordCallTarget() { |
| + bool RecordCallTarget() const { |
| return (flags_ & RECORD_CONSTRUCTOR_TARGET) != 0; |
| } |
| }; |
| @@ -1874,8 +1878,8 @@ class KeyedLoadDictionaryElementStub : public HydrogenCodeStub { |
| CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
| private: |
| - Major MajorKey() { return KeyedLoadElement; } |
| - int NotMissMinorKey() { return DICTIONARY_ELEMENTS; } |
| + Major MajorKey() const { return KeyedLoadElement; } |
| + int NotMissMinorKey() const { return DICTIONARY_ELEMENTS; } |
| DISALLOW_COPY_AND_ASSIGN(KeyedLoadDictionaryElementStub); |
| }; |
| @@ -1889,8 +1893,8 @@ class KeyedLoadDictionaryElementPlatformStub : public PlatformCodeStub { |
| void Generate(MacroAssembler* masm); |
| private: |
| - Major MajorKey() { return KeyedLoadElement; } |
| - int MinorKey() { return DICTIONARY_ELEMENTS; } |
| + Major MajorKey() const { return KeyedLoadElement; } |
| + int MinorKey() const { return DICTIONARY_ELEMENTS; } |
| DISALLOW_COPY_AND_ASSIGN(KeyedLoadDictionaryElementPlatformStub); |
| }; |
| @@ -1912,8 +1916,8 @@ class KeyedLoadGenericElementStub : public HydrogenCodeStub { |
| virtual InlineCacheState GetICState() { return GENERIC; } |
| private: |
| - Major MajorKey() { return KeyedLoadGeneric; } |
| - int NotMissMinorKey() { return 0; } |
| + Major MajorKey() const { return KeyedLoadGeneric; } |
| + int NotMissMinorKey() const { return 0; } |
| DISALLOW_COPY_AND_ASSIGN(KeyedLoadGenericElementStub); |
| }; |
| @@ -1977,8 +1981,8 @@ class DoubleToIStub : public PlatformCodeStub { |
| class SSE3Bits: |
| public BitField<int, 2 * kBitsPerRegisterNumber + 5, 1> {}; // NOLINT |
| - Major MajorKey() { return DoubleToI; } |
| - int MinorKey() { return bit_field_; } |
| + Major MajorKey() const { return DoubleToI; } |
| + int MinorKey() const { return bit_field_; } |
| int bit_field_; |
| @@ -2014,8 +2018,8 @@ class KeyedLoadFastElementStub : public HydrogenCodeStub { |
| class IsJSArrayBits: public BitField<bool, 8, 1> {}; |
| uint32_t bit_field_; |
| - Major MajorKey() { return KeyedLoadElement; } |
| - int NotMissMinorKey() { return bit_field_; } |
| + Major MajorKey() const { return KeyedLoadElement; } |
| + int NotMissMinorKey() const { return bit_field_; } |
| DISALLOW_COPY_AND_ASSIGN(KeyedLoadFastElementStub); |
| }; |
| @@ -2056,8 +2060,8 @@ class KeyedStoreFastElementStub : public HydrogenCodeStub { |
| class IsJSArrayBits: public BitField<bool, 12, 1> {}; |
| uint32_t bit_field_; |
| - Major MajorKey() { return KeyedStoreElement; } |
| - int NotMissMinorKey() { return bit_field_; } |
| + Major MajorKey() const { return KeyedStoreElement; } |
| + int NotMissMinorKey() const { return bit_field_; } |
| DISALLOW_COPY_AND_ASSIGN(KeyedStoreFastElementStub); |
| }; |
| @@ -2097,8 +2101,8 @@ class TransitionElementsKindStub : public HydrogenCodeStub { |
| class IsJSArrayBits: public BitField<bool, 16, 1> {}; |
| uint32_t bit_field_; |
| - Major MajorKey() { return TransitionElementsKind; } |
| - int NotMissMinorKey() { return bit_field_; } |
| + Major MajorKey() const { return TransitionElementsKind; } |
| + int NotMissMinorKey() const { return bit_field_; } |
| DISALLOW_COPY_AND_ASSIGN(TransitionElementsKindStub); |
| }; |
| @@ -2135,10 +2139,10 @@ class ArrayConstructorStubBase : public HydrogenCodeStub { |
| static const int kAllocationSite = 1; |
| protected: |
| - void BasePrintName(const char* name, StringStream* stream); |
| + OStream& BasePrintName(OStream& os, const char* name) const; // NOLINT |
| private: |
| - int NotMissMinorKey() { return bit_field_; } |
| + int NotMissMinorKey() const { return bit_field_; } |
| // Ensure data fits within available bits. |
| STATIC_ASSERT(LAST_ALLOCATION_SITE_OVERRIDE_MODE == 1); |
| @@ -2167,10 +2171,10 @@ class ArrayNoArgumentConstructorStub : public ArrayConstructorStubBase { |
| CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
| private: |
| - Major MajorKey() { return ArrayNoArgumentConstructor; } |
| + Major MajorKey() const { return ArrayNoArgumentConstructor; } |
| - virtual void PrintName(StringStream* stream) { |
| - BasePrintName("ArrayNoArgumentConstructorStub", stream); |
| + virtual OStream& PrintName(OStream& os) const V8_OVERRIDE { // NOLINT |
| + return BasePrintName(os, "ArrayNoArgumentConstructorStub"); |
| } |
| DISALLOW_COPY_AND_ASSIGN(ArrayNoArgumentConstructorStub); |
| @@ -2192,10 +2196,10 @@ class ArraySingleArgumentConstructorStub : public ArrayConstructorStubBase { |
| CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
| private: |
| - Major MajorKey() { return ArraySingleArgumentConstructor; } |
| + Major MajorKey() const { return ArraySingleArgumentConstructor; } |
| - virtual void PrintName(StringStream* stream) { |
| - BasePrintName("ArraySingleArgumentConstructorStub", stream); |
| + virtual OStream& PrintName(OStream& os) const { // NOLINT |
| + return BasePrintName(os, "ArraySingleArgumentConstructorStub"); |
| } |
| DISALLOW_COPY_AND_ASSIGN(ArraySingleArgumentConstructorStub); |
| @@ -2217,10 +2221,10 @@ class ArrayNArgumentsConstructorStub : public ArrayConstructorStubBase { |
| CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
| private: |
| - Major MajorKey() { return ArrayNArgumentsConstructor; } |
| + Major MajorKey() const { return ArrayNArgumentsConstructor; } |
| - virtual void PrintName(StringStream* stream) { |
| - BasePrintName("ArrayNArgumentsConstructorStub", stream); |
| + virtual OStream& PrintName(OStream& os) const { // NOLINT |
| + return BasePrintName(os, "ArrayNArgumentsConstructorStub"); |
| } |
| DISALLOW_COPY_AND_ASSIGN(ArrayNArgumentsConstructorStub); |
| @@ -2243,7 +2247,7 @@ class InternalArrayConstructorStubBase : public HydrogenCodeStub { |
| ElementsKind elements_kind() const { return kind_; } |
| private: |
| - int NotMissMinorKey() { return kind_; } |
| + int NotMissMinorKey() const { return kind_; } |
| ElementsKind kind_; |
| @@ -2264,7 +2268,7 @@ class InternalArrayNoArgumentConstructorStub : public |
| CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
| private: |
| - Major MajorKey() { return InternalArrayNoArgumentConstructor; } |
| + Major MajorKey() const { return InternalArrayNoArgumentConstructor; } |
| DISALLOW_COPY_AND_ASSIGN(InternalArrayNoArgumentConstructorStub); |
| }; |
| @@ -2283,7 +2287,7 @@ class InternalArraySingleArgumentConstructorStub : public |
| CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
| private: |
| - Major MajorKey() { return InternalArraySingleArgumentConstructor; } |
| + Major MajorKey() const { return InternalArraySingleArgumentConstructor; } |
| DISALLOW_COPY_AND_ASSIGN(InternalArraySingleArgumentConstructorStub); |
| }; |
| @@ -2301,7 +2305,7 @@ class InternalArrayNArgumentsConstructorStub : public |
| CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
| private: |
| - Major MajorKey() { return InternalArrayNArgumentsConstructor; } |
| + Major MajorKey() const { return InternalArrayNArgumentsConstructor; } |
| DISALLOW_COPY_AND_ASSIGN(InternalArrayNArgumentsConstructorStub); |
| }; |
| @@ -2318,8 +2322,8 @@ class KeyedStoreElementStub : public PlatformCodeStub { |
| elements_kind_(elements_kind), |
| store_mode_(store_mode) { } |
| - Major MajorKey() { return KeyedStoreElement; } |
| - int MinorKey() { |
| + Major MajorKey() const { return KeyedStoreElement; } |
| + int MinorKey() const { |
| return ElementsKindBits::encode(elements_kind_) | |
| IsJSArrayBits::encode(is_js_array_) | |
| StoreModeBits::encode(store_mode_); |
| @@ -2364,7 +2368,6 @@ class ToBooleanStub: public HydrogenCodeStub { |
| explicit Types(byte bits) : EnumSet<Type, byte>(bits) {} |
| byte ToByte() const { return ToIntegral(); } |
| - void Print(StringStream* stream) const; |
| bool UpdateStatus(Handle<Object> object); |
| bool NeedsMap() const; |
| bool CanBeUndetectable() const; |
| @@ -2386,7 +2389,7 @@ class ToBooleanStub: public HydrogenCodeStub { |
| CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
| virtual Code::Kind GetCodeKind() const { return Code::TO_BOOLEAN_IC; } |
| - virtual void PrintState(StringStream* stream); |
| + virtual OStream& PrintState(OStream& os) const V8_OVERRIDE; // NOLINT |
| virtual bool SometimesSetsUpAFrame() { return false; } |
| @@ -2400,7 +2403,7 @@ class ToBooleanStub: public HydrogenCodeStub { |
| return ToBooleanStub(isolate, UNINITIALIZED).GetCode(); |
| } |
| - virtual ExtraICState GetExtraICState() { |
| + virtual ExtraICState GetExtraICState() const { |
| return types_.ToIntegral(); |
| } |
| @@ -2413,8 +2416,8 @@ class ToBooleanStub: public HydrogenCodeStub { |
| } |
| private: |
| - Major MajorKey() { return ToBoolean; } |
| - int NotMissMinorKey() { return GetExtraICState(); } |
| + Major MajorKey() const { return ToBoolean; } |
| + int NotMissMinorKey() const { return GetExtraICState(); } |
| ToBooleanStub(Isolate* isolate, InitializationState init_state) : |
| HydrogenCodeStub(isolate, init_state) {} |
| @@ -2423,6 +2426,9 @@ class ToBooleanStub: public HydrogenCodeStub { |
| }; |
| +OStream& operator<<(OStream& os, const ToBooleanStub::Types& t); |
| + |
| + |
| class ElementsTransitionAndStoreStub : public HydrogenCodeStub { |
| public: |
| ElementsTransitionAndStoreStub(Isolate* isolate, |
| @@ -2452,8 +2458,8 @@ class ElementsTransitionAndStoreStub : public HydrogenCodeStub { |
| class IsJSArrayBits: public BitField<bool, 16, 1> {}; |
| class StoreModeBits: public BitField<KeyedAccessStoreMode, 17, 4> {}; |
| - Major MajorKey() { return ElementsTransitionAndStore; } |
| - int NotMissMinorKey() { |
| + Major MajorKey() const { return ElementsTransitionAndStore; } |
| + int NotMissMinorKey() const { |
| return FromBits::encode(from_kind_) | |
| ToBits::encode(to_kind_) | |
| IsJSArrayBits::encode(is_jsarray_) | |
| @@ -2475,8 +2481,8 @@ class StoreArrayLiteralElementStub : public PlatformCodeStub { |
| : PlatformCodeStub(isolate) { } |
| private: |
| - Major MajorKey() { return StoreArrayLiteralElement; } |
| - int MinorKey() { return 0; } |
| + Major MajorKey() const { return StoreArrayLiteralElement; } |
| + int MinorKey() const { return 0; } |
| void Generate(MacroAssembler* masm); |
| @@ -2495,8 +2501,8 @@ class StubFailureTrampolineStub : public PlatformCodeStub { |
| private: |
| class FunctionModeField: public BitField<StubFunctionMode, 0, 1> {}; |
| - Major MajorKey() { return StubFailureTrampoline; } |
| - int MinorKey() { |
| + Major MajorKey() const { return StubFailureTrampoline; } |
| + int MinorKey() const { |
| return FunctionModeField::encode(function_mode_); |
| } |
| @@ -2523,8 +2529,8 @@ class ProfileEntryHookStub : public PlatformCodeStub { |
| intptr_t stack_pointer, |
| Isolate* isolate); |
| - Major MajorKey() { return ProfileEntryHook; } |
| - int MinorKey() { return 0; } |
| + Major MajorKey() const { return ProfileEntryHook; } |
| + int MinorKey() const { return 0; } |
| void Generate(MacroAssembler* masm); |