From 78f568d69c39da7755c7ecf922d797534990f784 Mon Sep 17 00:00:00 2001 From: "verwaest@chromium.org" Date: Tue, 11 Feb 2014 15:01:44 +0000 Subject: [PATCH] Remove extended_extra_ic_state and extend extra_ic_state instead. BUG= R=ishell@chromium.org Review URL: https://codereview.chromium.org/159013003 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19287 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/code-stubs-hydrogen.cc | 2 +- src/code-stubs.cc | 2 +- src/code-stubs.h | 6 +++--- src/compiler.cc | 2 +- src/ic.cc | 12 +++++------- src/objects-inl.h | 32 +++++++++----------------------- src/objects.cc | 3 +-- src/objects.h | 26 +++----------------------- src/type-info.cc | 6 +++--- 9 files changed, 27 insertions(+), 64 deletions(-) diff --git a/src/code-stubs-hydrogen.cc b/src/code-stubs-hydrogen.cc index 9fcb0b37b9..f9b4d55dfc 100644 --- a/src/code-stubs-hydrogen.cc +++ b/src/code-stubs-hydrogen.cc @@ -248,7 +248,7 @@ Handle HydrogenCodeStub::GenerateLightweightMissCode(Isolate* isolate) { GetICState(), GetExtraICState(), GetStubType(), - GetStubFlags()); + GetHandlerKind()); Handle new_object = factory->NewCode( desc, flags, masm.CodeObject(), NeedsImmovableCode()); return new_object; diff --git a/src/code-stubs.cc b/src/code-stubs.cc index d86bc70dcf..0f76dee1ef 100644 --- a/src/code-stubs.cc +++ b/src/code-stubs.cc @@ -120,7 +120,7 @@ Handle PlatformCodeStub::GenerateCode(Isolate* isolate) { GetICState(), GetExtraICState(), GetStubType(), - GetStubFlags()); + GetHandlerKind()); Handle new_object = factory->NewCode( desc, flags, masm.CodeObject(), NeedsImmovableCode()); return new_object; diff --git a/src/code-stubs.h b/src/code-stubs.h index a7283ba642..49a5dd0783 100644 --- a/src/code-stubs.h +++ b/src/code-stubs.h @@ -188,8 +188,8 @@ class CodeStub BASE_EMBEDDED { virtual Code::StubType GetStubType() { return Code::NORMAL; } - virtual int GetStubFlags() { - return -1; + virtual Code::Kind GetHandlerKind() { + return Code::STUB; } virtual void PrintName(StringStream* stream); @@ -883,7 +883,7 @@ class HICStub: public HydrogenCodeStub { class HandlerStub: public HICStub { public: virtual Code::Kind GetCodeKind() const { return Code::HANDLER; } - virtual int GetStubFlags() { return kind(); } + virtual Code::Kind GetHandlerKind() { return kind(); } protected: HandlerStub() : HICStub() { } diff --git a/src/compiler.cc b/src/compiler.cc index 9bae809734..b773880b8c 100644 --- a/src/compiler.cc +++ b/src/compiler.cc @@ -212,7 +212,7 @@ Code::Flags CompilationInfo::flags() const { code_stub()->GetICState(), code_stub()->GetExtraICState(), code_stub()->GetStubType(), - code_stub()->GetStubFlags()); + code_stub()->GetHandlerKind()); } else { return Code::ComputeFlags(Code::OPTIMIZED_FUNCTION); } diff --git a/src/ic.cc b/src/ic.cc index fb12739418..e1405396c1 100644 --- a/src/ic.cc +++ b/src/ic.cc @@ -148,9 +148,7 @@ IC::IC(FrameDepth depth, Isolate* isolate) pc_address_ = StackFrame::ResolveReturnAddressLocation(pc_address); target_ = handle(raw_target(), isolate); state_ = target_->ic_state(); - extra_ic_state_ = target_->needs_extended_extra_ic_state(target_->kind()) - ? target_->extended_extra_ic_state() - : target_->extra_ic_state(); + extra_ic_state_ = target_->extra_ic_state(); } @@ -2371,7 +2369,7 @@ Type* BinaryOpIC::State::KindToType(Kind kind, Zone* zone) { MaybeObject* BinaryOpIC::Transition(Handle allocation_site, Handle left, Handle right) { - State state(target()->extended_extra_ic_state()); + State state(target()->extra_ic_state()); // Compute the actual result using the builtin for the binary operation. Object* builtin = isolate()->js_builtins_object()->javascript_builtin( @@ -2687,7 +2685,7 @@ RUNTIME_FUNCTION(Code*, CompareIC_Miss) { void CompareNilIC::Clear(Address address, Code* target) { if (IsCleared(target)) return; - ExtraICState state = target->extended_extra_ic_state(); + ExtraICState state = target->extra_ic_state(); CompareNilICStub stub(state, HydrogenCodeStub::UNINITIALIZED); stub.ClearState(); @@ -2709,7 +2707,7 @@ MaybeObject* CompareNilIC::DoCompareNilSlow(NilValue nil, MaybeObject* CompareNilIC::CompareNil(Handle object) { - ExtraICState extra_ic_state = target()->extended_extra_ic_state(); + ExtraICState extra_ic_state = target()->extra_ic_state(); CompareNilICStub stub(extra_ic_state); @@ -2793,7 +2791,7 @@ Builtins::JavaScript BinaryOpIC::TokenToJSBuiltin(Token::Value op) { MaybeObject* ToBooleanIC::ToBoolean(Handle object) { - ToBooleanStub stub(target()->extended_extra_ic_state()); + ToBooleanStub stub(target()->extra_ic_state()); bool to_boolean_value = stub.UpdateStatus(object); Handle code = stub.GetCode(isolate()); set_target(*code); diff --git a/src/objects-inl.h b/src/objects-inl.h index 259a55f899..c916fc2be6 100644 --- a/src/objects-inl.h +++ b/src/objects-inl.h @@ -4194,16 +4194,8 @@ InlineCacheState Code::ic_state() { ExtraICState Code::extra_ic_state() { - ASSERT((is_inline_cache_stub() && !needs_extended_extra_ic_state(kind())) - || ic_state() == DEBUG_STUB); - return ExtractExtraICStateFromFlags(flags()); -} - - -ExtraICState Code::extended_extra_ic_state() { ASSERT(is_inline_cache_stub() || ic_state() == DEBUG_STUB); - ASSERT(needs_extended_extra_ic_state(kind())); - return ExtractExtendedExtraICStateFromFlags(flags()); + return ExtractExtraICStateFromFlags(flags()); } @@ -4421,7 +4413,7 @@ void Code::set_back_edges_patched_for_osr(bool value) { byte Code::to_boolean_state() { - return extended_extra_ic_state(); + return extra_ic_state(); } @@ -4492,17 +4484,16 @@ Code::Flags Code::ComputeFlags(Kind kind, InlineCacheState ic_state, ExtraICState extra_ic_state, StubType type, - int argc, + Kind handler_kind, InlineCacheHolderFlag holder) { - ASSERT(argc <= Code::kMaxArguments); // Compute the bit mask. unsigned int bits = KindField::encode(kind) | ICStateField::encode(ic_state) | TypeField::encode(type) - | ExtendedExtraICStateField::encode(extra_ic_state) + | ExtraICStateField::encode(extra_ic_state) | CacheHolderField::encode(holder); - if (!Code::needs_extended_extra_ic_state(kind)) { - bits |= (argc << kArgumentsCountShift); + if (handler_kind != STUB) { + bits |= (handler_kind << kArgumentsCountShift); } return static_cast(bits); } @@ -4512,8 +4503,9 @@ Code::Flags Code::ComputeMonomorphicFlags(Kind kind, ExtraICState extra_ic_state, InlineCacheHolderFlag holder, StubType type, - int argc) { - return ComputeFlags(kind, MONOMORPHIC, extra_ic_state, type, argc, holder); + Kind handler_kind) { + return ComputeFlags(kind, MONOMORPHIC, extra_ic_state, type, + handler_kind, holder); } @@ -4532,12 +4524,6 @@ ExtraICState Code::ExtractExtraICStateFromFlags(Flags flags) { } -ExtraICState Code::ExtractExtendedExtraICStateFromFlags( - Flags flags) { - return ExtendedExtraICStateField::decode(flags); -} - - Code::StubType Code::ExtractTypeFromFlags(Flags flags) { return TypeField::decode(flags); } diff --git a/src/objects.cc b/src/objects.cc index f9e8bd22c1..fc6e34a1aa 100644 --- a/src/objects.cc +++ b/src/objects.cc @@ -11091,8 +11091,7 @@ void Code::Disassemble(const char* name, FILE* out) { } if (is_inline_cache_stub()) { PrintF(out, "ic_state = %s\n", ICState2String(ic_state())); - PrintExtraICState(out, kind(), needs_extended_extra_ic_state(kind()) ? - extended_extra_ic_state() : extra_ic_state()); + PrintExtraICState(out, kind(), extra_ic_state()); if (ic_state() == MONOMORPHIC) { PrintF(out, "type = %s\n", StubType2String(type())); } diff --git a/src/objects.h b/src/objects.h index 51f0391fff..1caaffad67 100644 --- a/src/objects.h +++ b/src/objects.h @@ -5194,16 +5194,6 @@ class Code: public HeapObject { inline InlineCacheState ic_state(); // Only valid for IC stubs. inline ExtraICState extra_ic_state(); // Only valid for IC stubs. - inline ExtraICState extended_extra_ic_state(); // Only valid for - // non-call IC stubs. - static bool needs_extended_extra_ic_state(Kind kind) { - // TODO(danno): This is a bit of a hack right now since there are still - // clients of this API that pass "extra" values in for argc. These clients - // should be retrofitted to used ExtendedExtraICState. - return kind == COMPARE_NIL_IC || kind == TO_BOOLEAN_IC || - kind == BINARY_OP_IC; - } - inline StubType type(); // Only valid for monomorphic IC stubs. inline int arguments_count(); // Only valid for call IC stubs. @@ -5344,7 +5334,7 @@ class Code: public HeapObject { InlineCacheState ic_state = UNINITIALIZED, ExtraICState extra_ic_state = kNoExtraICState, StubType type = NORMAL, - int argc = -1, + Kind handler_kind = STUB, InlineCacheHolderFlag holder = OWN_MAP); static inline Flags ComputeMonomorphicFlags( @@ -5352,14 +5342,13 @@ class Code: public HeapObject { ExtraICState extra_ic_state = kNoExtraICState, InlineCacheHolderFlag holder = OWN_MAP, StubType type = NORMAL, - int argc = -1); + Kind handler_kind = STUB); static inline InlineCacheState ExtractICStateFromFlags(Flags flags); static inline StubType ExtractTypeFromFlags(Flags flags); static inline Kind ExtractKindFromFlags(Flags flags); static inline InlineCacheHolderFlag ExtractCacheHolderFromFlags(Flags flags); static inline ExtraICState ExtractExtraICStateFromFlags(Flags flags); - static inline ExtraICState ExtractExtendedExtraICStateFromFlags(Flags flags); static inline int ExtractArgumentsCountFromFlags(Flags flags); static inline Flags RemoveTypeFromFlags(Flags flags); @@ -5525,10 +5514,8 @@ class Code: public HeapObject { class CacheHolderField: public BitField {}; class KindField: public BitField {}; // TODO(bmeurer): Bit 10 is available for free use. :-) - class ExtraICStateField: public BitField {}; - class ExtendedExtraICStateField: public BitField {}; // NOLINT - STATIC_ASSERT(ExtraICStateField::kShift == ExtendedExtraICStateField::kShift); // KindSpecificFlags1 layout (STUB and OPTIMIZED_FUNCTION) static const int kStackSlotsFirstBit = 0; @@ -5589,13 +5576,6 @@ class Code: public HeapObject { PlatformSmiTagging::kSmiValueSize - Code::kArgumentsCountShift + 1; static const int kMaxArguments = (1 << kArgumentsBits) - 1; - // ICs can use either argument count or ExtendedExtraIC, since their storage - // overlaps. - STATIC_ASSERT(ExtraICStateField::kShift + - ExtraICStateField::kSize + kArgumentsBits == - ExtendedExtraICStateField::kShift + - ExtendedExtraICStateField::kSize); - // This constant should be encodable in an ARM instruction. static const int kFlagsNotUsedInLookup = TypeField::kMask | CacheHolderField::kMask; diff --git a/src/type-info.cc b/src/type-info.cc index 1c08e0cd12..695b9dd787 100644 --- a/src/type-info.cc +++ b/src/type-info.cc @@ -222,7 +222,7 @@ void TypeFeedbackOracle::CompareType(TypeFeedbackId id, CompareIC::StubInfoToType( stub_minor_key, left_type, right_type, combined_type, map, zone()); } else if (code->is_compare_nil_ic_stub()) { - CompareNilICStub stub(code->extended_extra_ic_state()); + CompareNilICStub stub(code->extra_ic_state()); *combined_type = stub.GetType(zone(), map); *left_type = *right_type = stub.GetInputType(zone(), map); } @@ -249,7 +249,7 @@ void TypeFeedbackOracle::BinaryType(TypeFeedbackId id, } Handle code = Handle::cast(object); ASSERT_EQ(Code::BINARY_OP_IC, code->kind()); - BinaryOpIC::State state(code->extended_extra_ic_state()); + BinaryOpIC::State state(code->extra_ic_state()); ASSERT_EQ(op, state.op()); *left = state.GetLeftType(zone()); @@ -271,7 +271,7 @@ Type* TypeFeedbackOracle::CountType(TypeFeedbackId id) { if (!object->IsCode()) return Type::None(zone()); Handle code = Handle::cast(object); ASSERT_EQ(Code::BINARY_OP_IC, code->kind()); - BinaryOpIC::State state(code->extended_extra_ic_state()); + BinaryOpIC::State state(code->extra_ic_state()); return state.GetLeftType(zone()); }