Commit fe0fe20e authored by verwaest@chromium.org's avatar verwaest@chromium.org

Pass in the handler kind to IC computation rather than extracting it from the handler.

R=ishell@chromium.org

Review URL: https://codereview.chromium.org/163463002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19383 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 984af9c7
......@@ -643,7 +643,7 @@ bool IC::UpdatePolymorphicIC(Handle<HeapType> type,
}
Handle<Code> ic = isolate()->stub_cache()->ComputePolymorphicIC(
&types, &handlers, number_of_valid_types, name, extra_ic_state());
kind(), &types, &handlers, number_of_valid_types, name, extra_ic_state());
set_target(*ic);
return true;
}
......@@ -695,7 +695,7 @@ void IC::UpdateMonomorphicIC(Handle<HeapType> type,
Handle<String> name) {
if (!handler->is_handler()) return set_target(*handler);
Handle<Code> ic = isolate()->stub_cache()->ComputeMonomorphicIC(
name, type, handler, extra_ic_state());
kind(), name, type, handler, extra_ic_state());
set_target(*ic);
}
......
......@@ -4204,12 +4204,6 @@ Code::StubType Code::type() {
}
int Code::arguments_count() {
ASSERT(kind() == STUB || is_handler());
return ExtractArgumentsCountFromFlags(flags());
}
// For initialization.
void Code::set_raw_kind_specific_flags1(int value) {
WRITE_INT_FIELD(this, kKindSpecificFlags1Offset, value);
......@@ -4492,8 +4486,9 @@ Code::Flags Code::ComputeFlags(Kind kind,
| TypeField::encode(type)
| ExtraICStateField::encode(extra_ic_state)
| CacheHolderField::encode(holder);
// TODO(verwaest): Move to the valid uses of |handler_kind|.
if (handler_kind != STUB) {
bits |= (handler_kind << kArgumentsCountShift);
bits |= HandlerKindField::encode(handler_kind);
}
return static_cast<Flags>(bits);
}
......@@ -4529,11 +4524,6 @@ Code::StubType Code::ExtractTypeFromFlags(Flags flags) {
}
int Code::ExtractArgumentsCountFromFlags(Flags flags) {
return (flags & kArgumentsCountMask) >> kArgumentsCountShift;
}
InlineCacheHolderFlag Code::ExtractCacheHolderFromFlags(Flags flags) {
return CacheHolderField::decode(flags);
}
......
......@@ -5233,14 +5233,10 @@ class Code: public HeapObject {
// [flags]: Access to specific code flags.
inline Kind kind();
inline Kind handler_kind() {
return static_cast<Kind>(arguments_count());
}
inline InlineCacheState ic_state(); // Only valid for IC stubs.
inline ExtraICState extra_ic_state(); // Only valid for IC stubs.
inline StubType type(); // Only valid for monomorphic IC stubs.
inline int arguments_count(); // Only valid for call IC stubs.
// Testers for IC stub kinds.
inline bool is_inline_cache_stub();
......@@ -5394,7 +5390,6 @@ class Code: public HeapObject {
static inline Kind ExtractKindFromFlags(Flags flags);
static inline InlineCacheHolderFlag ExtractCacheHolderFromFlags(Flags flags);
static inline ExtraICState ExtractExtraICStateFromFlags(Flags flags);
static inline int ExtractArgumentsCountFromFlags(Flags flags);
static inline Flags RemoveTypeFromFlags(Flags flags);
......@@ -5614,11 +5609,9 @@ class Code: public HeapObject {
class BackEdgesPatchedForOSRField: public BitField<bool,
kIsCrankshaftedBit + 1 + 29, 1> {}; // NOLINT
// Signed field cannot be encoded using the BitField class.
static const int kArgumentsCountShift = 17;
static const int kArgumentsCountMask = ~((1 << kArgumentsCountShift) - 1);
static const int kArgumentsBits =
PlatformSmiTagging::kSmiValueSize - Code::kArgumentsCountShift + 1;
class HandlerKindField: public BitField<Kind, 17, 4> {};
static const int kArgumentsBits = 16;
static const int kMaxArguments = (1 << kArgumentsBits) - 1;
// This constant should be encodable in an ARM instruction.
......
......@@ -127,11 +127,11 @@ Handle<Code> StubCache::FindHandler(Handle<Name> name,
Handle<Code> StubCache::ComputeMonomorphicIC(
Code::Kind kind,
Handle<Name> name,
Handle<HeapType> type,
Handle<Code> handler,
ExtraICState extra_ic_state) {
Code::Kind kind = handler->handler_kind();
InlineCacheHolderFlag flag = IC::GetCodeCacheFlag(*type);
Handle<Map> stub_holder;
......@@ -369,14 +369,13 @@ Handle<Code> StubCache::ComputeLoadElementPolymorphic(
Handle<Code> StubCache::ComputePolymorphicIC(
Code::Kind kind,
TypeHandleList* types,
CodeHandleList* handlers,
int number_of_valid_types,
Handle<Name> name,
ExtraICState extra_ic_state) {
Handle<Code> handler = handlers->at(0);
Code::Kind kind = handler->handler_kind();
Code::StubType type = number_of_valid_types == 1 ? handler->type()
: Code::NORMAL;
if (kind == Code::LOAD_IC) {
......
......@@ -91,7 +91,8 @@ class StubCache {
Code::Kind kind,
InlineCacheHolderFlag cache_holder = OWN_MAP);
Handle<Code> ComputeMonomorphicIC(Handle<Name> name,
Handle<Code> ComputeMonomorphicIC(Code::Kind kind,
Handle<Name> name,
Handle<HeapType> type,
Handle<Code> handler,
ExtraICState extra_ic_state);
......@@ -122,7 +123,8 @@ class StubCache {
KeyedAccessStoreMode store_mode,
StrictModeFlag strict_mode);
Handle<Code> ComputePolymorphicIC(TypeHandleList* types,
Handle<Code> ComputePolymorphicIC(Code::Kind kind,
TypeHandleList* types,
CodeHandleList* handlers,
int number_of_valid_maps,
Handle<Name> name,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment