Commit c2a53d25 authored by Toon Verwaest's avatar Toon Verwaest Committed by Commit Bot

[ic] Cleanup accessor handling, fix cached property on global, remove cache-on-prototype support

BUG=v8:5561

Change-Id: I425ad7e670b8e9c701ff284ab1be3638a975a6d3
Reviewed-on: https://chromium-review.googlesource.com/455832
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#43836}
parent 69da6fcd
......@@ -671,13 +671,6 @@ enum InlineCacheState {
GENERIC,
};
enum CacheHolderFlag {
kCacheOnPrototype,
kCacheOnPrototypeReceiverIsDictionary,
kCacheOnPrototypeReceiverIsPrimitive,
kCacheOnReceiver
};
enum WhereToStart { kStartAtReceiver, kStartAtPrototype };
// The Store Buffer (GC).
......
......@@ -34,11 +34,9 @@ class PropertyAccessCompiler BASE_EMBEDDED {
static void TailCallBuiltin(MacroAssembler* masm, Builtins::Name name);
protected:
PropertyAccessCompiler(Isolate* isolate, Code::Kind kind,
CacheHolderFlag cache_holder)
PropertyAccessCompiler(Isolate* isolate, Code::Kind kind)
: registers_(GetCallingConvention(isolate, kind)),
kind_(kind),
cache_holder_(cache_holder),
isolate_(isolate),
masm_(isolate, NULL, 256, CodeObjectRequired::kYes) {
// TODO(yangguo): remove this once we can serialize IC stubs.
......@@ -46,7 +44,6 @@ class PropertyAccessCompiler BASE_EMBEDDED {
}
Code::Kind kind() const { return kind_; }
CacheHolderFlag cache_holder() const { return cache_holder_; }
MacroAssembler* masm() { return &masm_; }
Isolate* isolate() const { return isolate_; }
Factory* factory() const { return isolate()->factory(); }
......@@ -67,8 +64,6 @@ class PropertyAccessCompiler BASE_EMBEDDED {
static void InitializePlatformSpecific(AccessCompilerData* data);
Code::Kind kind_;
CacheHolderFlag cache_holder_;
Isolate* isolate_;
MacroAssembler masm_;
// Ensure that MacroAssembler has a reasonable size.
......
......@@ -17,9 +17,8 @@ namespace internal {
Handle<Code> PropertyHandlerCompiler::Find(Handle<Name> name,
Handle<Map> stub_holder,
Code::Kind kind,
CacheHolderFlag cache_holder) {
Code::Flags flags = Code::ComputeHandlerFlags(kind, cache_holder);
Code::Kind kind) {
Code::Flags flags = Code::ComputeHandlerFlags(kind);
Code* code = stub_holder->LookupInCodeCache(*name, flags);
if (code == nullptr) return Handle<Code>();
return handle(code);
......@@ -27,7 +26,7 @@ Handle<Code> PropertyHandlerCompiler::Find(Handle<Name> name,
Handle<Code> PropertyHandlerCompiler::GetCode(Code::Kind kind,
Handle<Name> name) {
Code::Flags flags = Code::ComputeHandlerFlags(kind, cache_holder());
Code::Flags flags = Code::ComputeHandlerFlags(kind);
// Create code object in the heap.
CodeDesc desc;
......
......@@ -15,15 +15,12 @@ class CallOptimization;
class PropertyHandlerCompiler : public PropertyAccessCompiler {
public:
static Handle<Code> Find(Handle<Name> name, Handle<Map> map, Code::Kind kind,
CacheHolderFlag cache_holder);
static Handle<Code> Find(Handle<Name> name, Handle<Map> map, Code::Kind kind);
protected:
PropertyHandlerCompiler(Isolate* isolate, Code::Kind kind, Handle<Map> map,
Handle<JSObject> holder, CacheHolderFlag cache_holder)
: PropertyAccessCompiler(isolate, kind, cache_holder),
map_(map),
holder_(holder) {}
Handle<JSObject> holder)
: PropertyAccessCompiler(isolate, kind), map_(map), holder_(holder) {}
virtual ~PropertyHandlerCompiler() {}
......@@ -117,10 +114,8 @@ class PropertyHandlerCompiler : public PropertyAccessCompiler {
class NamedLoadHandlerCompiler : public PropertyHandlerCompiler {
public:
NamedLoadHandlerCompiler(Isolate* isolate, Handle<Map> map,
Handle<JSObject> holder,
CacheHolderFlag cache_holder)
: PropertyHandlerCompiler(isolate, Code::LOAD_IC, map, holder,
cache_holder) {}
Handle<JSObject> holder)
: PropertyHandlerCompiler(isolate, Code::LOAD_IC, map, holder) {}
virtual ~NamedLoadHandlerCompiler() {}
......@@ -159,8 +154,7 @@ class NamedStoreHandlerCompiler : public PropertyHandlerCompiler {
explicit NamedStoreHandlerCompiler(Isolate* isolate, Handle<Map> map,
Handle<JSObject> holder)
: PropertyHandlerCompiler(isolate, Code::STORE_IC, map, holder,
kCacheOnReceiver) {
: PropertyHandlerCompiler(isolate, Code::STORE_IC, map, holder) {
#ifdef DEBUG
if (Descriptor::kPassLastArgsOnStack) {
ZapStackArgumentsRegisterAliases();
......@@ -208,8 +202,8 @@ class ElementHandlerCompiler : public PropertyHandlerCompiler {
public:
explicit ElementHandlerCompiler(Isolate* isolate)
: PropertyHandlerCompiler(isolate, Code::KEYED_LOAD_IC,
Handle<Map>::null(), Handle<JSObject>::null(),
kCacheOnReceiver) {}
Handle<Map>::null(), Handle<JSObject>::null()) {
}
virtual ~ElementHandlerCompiler() {}
......
......@@ -90,40 +90,6 @@ bool IC::IsHandler(Object* object) {
(object->IsCode() && Code::cast(object)->is_handler());
}
Handle<Map> IC::GetHandlerCacheHolder(Handle<Map> receiver_map,
bool receiver_is_holder, Isolate* isolate,
CacheHolderFlag* flag) {
if (receiver_is_holder) {
*flag = kCacheOnReceiver;
return receiver_map;
}
Handle<JSFunction> builtin_ctor;
if (Map::GetConstructorFunction(receiver_map, isolate->native_context())
.ToHandle(&builtin_ctor)) {
*flag = kCacheOnPrototypeReceiverIsPrimitive;
return handle(HeapObject::cast(builtin_ctor->instance_prototype())->map());
}
*flag = receiver_map->is_dictionary_map()
? kCacheOnPrototypeReceiverIsDictionary
: kCacheOnPrototype;
// Callers must ensure that the prototype is non-null.
return handle(JSObject::cast(receiver_map->prototype())->map());
}
Handle<Map> IC::GetICCacheHolder(Handle<Map> map, Isolate* isolate,
CacheHolderFlag* flag) {
Handle<JSFunction> builtin_ctor;
if (Map::GetConstructorFunction(map, isolate->native_context())
.ToHandle(&builtin_ctor)) {
*flag = kCacheOnPrototype;
return handle(builtin_ctor->initial_map());
}
*flag = kCacheOnReceiver;
return map;
}
bool IC::AddressIsDeoptimizedCode() const {
return AddressIsDeoptimizedCode(isolate(), address());
}
......
......@@ -1048,45 +1048,6 @@ Handle<Object> LoadIC::LoadFullChain(Handle<Map> receiver_map,
return handler_array;
}
bool IsCompatibleReceiver(LookupIterator* lookup, Handle<Map> receiver_map) {
DCHECK(lookup->state() == LookupIterator::ACCESSOR);
Isolate* isolate = lookup->isolate();
Handle<Object> accessors = lookup->GetAccessors();
if (accessors->IsAccessorInfo()) {
Handle<AccessorInfo> info = Handle<AccessorInfo>::cast(accessors);
if (info->getter() != NULL &&
!AccessorInfo::IsCompatibleReceiverMap(isolate, info, receiver_map)) {
return false;
}
} else if (accessors->IsAccessorPair()) {
Handle<Object> getter(Handle<AccessorPair>::cast(accessors)->getter(),
isolate);
if (!getter->IsJSFunction() && !getter->IsFunctionTemplateInfo()) {
return false;
}
Handle<JSObject> holder = lookup->GetHolder<JSObject>();
Handle<Object> receiver = lookup->GetReceiver();
if (holder->HasFastProperties()) {
if (getter->IsJSFunction()) {
Handle<JSFunction> function = Handle<JSFunction>::cast(getter);
if (!receiver->IsJSObject() && function->shared()->IsUserJavaScript() &&
is_sloppy(function->shared()->language_mode())) {
// Calling sloppy non-builtins with a value as the receiver
// requires boxing.
return false;
}
}
CallOptimization call_optimization(getter);
if (call_optimization.is_simple_api_call() &&
!call_optimization.IsCompatibleReceiverMap(receiver_map, holder)) {
return false;
}
}
}
return true;
}
void LoadIC::UpdateCaches(LookupIterator* lookup) {
if (state() == UNINITIALIZED && !IsLoadGlobalIC()) {
// This is the first time we execute this inline cache. Set the target to
......@@ -1107,32 +1068,21 @@ void LoadIC::UpdateCaches(LookupIterator* lookup) {
code = LoadFullChain(receiver_map(), isolate()->factory()->null_value(),
lookup->name(), smi_handler);
} else {
if (IsLoadGlobalIC() && lookup->state() == LookupIterator::DATA &&
lookup->GetReceiver().is_identical_to(lookup->GetHolder<Object>())) {
DCHECK(lookup->GetReceiver()->IsJSGlobalObject());
// Now update the cell in the feedback vector.
LoadGlobalICNexus* nexus = casted_nexus<LoadGlobalICNexus>();
nexus->ConfigurePropertyCellMode(lookup->GetPropertyCell());
TRACE_IC("LoadGlobalIC", lookup->name());
return;
} else if (lookup->state() == LookupIterator::ACCESSOR) {
if (!IsCompatibleReceiver(lookup, receiver_map())) {
TRACE_GENERIC_IC("incompatible receiver type");
code = slow_stub();
if (IsLoadGlobalIC()) {
if (lookup->TryLookupCachedProperty()) {
DCHECK_EQ(LookupIterator::DATA, lookup->state());
}
} else if (lookup->state() == LookupIterator::INTERCEPTOR) {
// Perform a lookup behind the interceptor. Copy the LookupIterator
// since the original iterator will be used to fetch the value.
LookupIterator it = *lookup;
it.Next();
LookupForRead(&it);
if (it.state() == LookupIterator::ACCESSOR &&
!IsCompatibleReceiver(&it, receiver_map())) {
TRACE_GENERIC_IC("incompatible receiver type");
code = slow_stub();
if (lookup->state() == LookupIterator::DATA &&
lookup->GetReceiver().is_identical_to(lookup->GetHolder<Object>())) {
DCHECK(lookup->GetReceiver()->IsJSGlobalObject());
// Now update the cell in the feedback vector.
LoadGlobalICNexus* nexus = casted_nexus<LoadGlobalICNexus>();
nexus->ConfigurePropertyCellMode(lookup->GetPropertyCell());
TRACE_IC("LoadGlobalIC", lookup->name());
return;
}
}
if (code.is_null()) code = ComputeHandler(lookup);
code = ComputeHandler(lookup);
}
PatchCache(lookup->name(), code);
......@@ -1223,24 +1173,8 @@ Handle<Object> IC::ComputeHandler(LookupIterator* lookup,
return shared_handler;
}
// Otherwise check the map's handler cache for a map-specific handler, and
// compile one if the cache comes up empty.
bool receiver_is_holder =
lookup->GetReceiver().is_identical_to(lookup->GetHolder<JSObject>());
CacheHolderFlag flag;
Handle<Map> stub_holder_map;
if (IsAnyLoad()) {
stub_holder_map = IC::GetHandlerCacheHolder(
receiver_map(), receiver_is_holder, isolate(), &flag);
} else {
DCHECK(IsAnyStore());
// Store handlers cannot be cached on prototypes.
flag = kCacheOnReceiver;
stub_holder_map = receiver_map();
}
Handle<Object> handler = PropertyHandlerCompiler::Find(
lookup->name(), stub_holder_map, handler_kind(), flag);
lookup->name(), receiver_map(), handler_kind());
// Use the cached value if it exists, and if it is different from the
// handler that just missed.
if (!handler.is_null()) {
......@@ -1269,12 +1203,11 @@ Handle<Object> IC::ComputeHandler(LookupIterator* lookup,
}
}
handler = CompileHandler(lookup, value, flag);
handler = CompileHandler(lookup, value);
DCHECK(IC::IsHandler(*handler));
if (handler->IsCode()) {
Handle<Code> code = Handle<Code>::cast(handler);
DCHECK_EQ(Code::ExtractCacheHolderFromFlags(code->flags()), flag);
Map::UpdateCodeCache(stub_holder_map, lookup->name(), code);
Map::UpdateCodeCache(receiver_map(), lookup->name(), code);
}
return handler;
}
......@@ -1342,45 +1275,61 @@ Handle<Object> LoadIC::GetMapIndependentHandler(LookupIterator* lookup) {
return SimpleFieldLoad(isolate(), index);
}
if (IsCompatibleReceiver(lookup, map)) {
Handle<Object> accessors = lookup->GetAccessors();
if (accessors->IsAccessorPair()) {
if (!holder->HasFastProperties()) {
TRACE_HANDLER_STATS(isolate(), LoadIC_SlowStub);
return slow_stub();
}
// When debugging we need to go the slow path to flood the accessor.
if (GetHostFunction()->shared()->HasDebugInfo()) {
TRACE_HANDLER_STATS(isolate(), LoadIC_SlowStub);
return slow_stub();
}
break; // Custom-compiled handler.
} else if (accessors->IsAccessorInfo()) {
Handle<AccessorInfo> info = Handle<AccessorInfo>::cast(accessors);
if (v8::ToCData<Address>(info->getter()) == nullptr) {
TRACE_HANDLER_STATS(isolate(), LoadIC_SlowStub);
return slow_stub();
}
// Ruled out by IsCompatibleReceiver() above.
DCHECK(AccessorInfo::IsCompatibleReceiverMap(isolate(), info, map));
if (!holder->HasFastProperties() ||
(info->is_sloppy() && !receiver->IsJSReceiver())) {
DCHECK(!holder->HasFastProperties() || !receiver_is_holder);
TRACE_HANDLER_STATS(isolate(), LoadIC_SlowStub);
Handle<Object> accessors = lookup->GetAccessors();
if (accessors->IsAccessorPair()) {
if (lookup->TryLookupCachedProperty()) {
DCHECK_EQ(LookupIterator::DATA, lookup->state());
return ComputeHandler(lookup);
}
if (!holder->HasFastProperties() ||
// When debugging we need to go the slow path to flood the accessor.
GetHostFunction()->shared()->HasDebugInfo()) {
TRACE_HANDLER_STATS(isolate(), LoadIC_SlowStub);
return slow_stub();
}
Handle<Object> getter(AccessorPair::cast(*accessors)->getter(),
isolate());
if (getter->IsJSFunction()) {
Handle<JSFunction> function = Handle<JSFunction>::cast(getter);
if (!receiver->IsJSObject() &&
function->shared()->IsUserJavaScript() &&
is_sloppy(function->shared()->language_mode())) {
// Calling sloppy non-builtins with a value as the receiver
// requires boxing.
return slow_stub();
}
Handle<Smi> smi_handler =
LoadHandler::LoadApiGetter(isolate(), lookup->GetAccessorIndex());
if (receiver_is_holder) {
TRACE_HANDLER_STATS(isolate(), LoadIC_LoadApiGetterDH);
return smi_handler;
}
TRACE_HANDLER_STATS(isolate(), LoadIC_LoadApiGetterFromPrototypeDH);
return LoadFromPrototype(map, holder, lookup->name(), smi_handler);
} else if (!getter->IsFunctionTemplateInfo()) {
TRACE_HANDLER_STATS(isolate(), LoadIC_SlowStub);
return slow_stub();
}
CallOptimization call_optimization(getter);
if (call_optimization.is_simple_api_call() &&
!call_optimization.IsCompatibleReceiverMap(map, holder)) {
return slow_stub();
}
break;
}
TRACE_HANDLER_STATS(isolate(), LoadIC_SlowStub);
return slow_stub();
Handle<AccessorInfo> info = Handle<AccessorInfo>::cast(accessors);
if (v8::ToCData<Address>(info->getter()) == nullptr ||
!AccessorInfo::IsCompatibleReceiverMap(isolate(), info, map) ||
!holder->HasFastProperties() ||
(info->is_sloppy() && !receiver->IsJSReceiver())) {
TRACE_HANDLER_STATS(isolate(), LoadIC_SlowStub);
return slow_stub();
}
Handle<Smi> smi_handler =
LoadHandler::LoadApiGetter(isolate(), lookup->GetAccessorIndex());
TRACE_HANDLER_STATS(isolate(), LoadIC_LoadApiGetterDH);
if (receiver_is_holder) return smi_handler;
TRACE_HANDLER_STATS(isolate(), LoadIC_LoadApiGetterFromPrototypeDH);
return LoadFromPrototype(map, holder, lookup->name(), smi_handler);
}
case LookupIterator::DATA: {
......@@ -1430,8 +1379,7 @@ Handle<Object> LoadIC::GetMapIndependentHandler(LookupIterator* lookup) {
}
Handle<Object> LoadIC::CompileHandler(LookupIterator* lookup,
Handle<Object> unused,
CacheHolderFlag cache_holder) {
Handle<Object> unused) {
Handle<JSObject> holder = lookup->GetHolder<JSObject>();
#ifdef DEBUG
// Only used by DCHECKs below.
......@@ -1460,19 +1408,14 @@ Handle<Object> LoadIC::CompileHandler(LookupIterator* lookup,
&object_offset));
#endif
DCHECK(IsCompatibleReceiver(lookup, map));
Handle<Object> accessors = lookup->GetAccessors();
DCHECK(accessors->IsAccessorPair());
if (lookup->TryLookupCachedProperty()) {
DCHECK_EQ(LookupIterator::DATA, lookup->state());
return ComputeHandler(lookup);
}
DCHECK(holder->HasFastProperties());
DCHECK(!GetHostFunction()->shared()->HasDebugInfo());
Handle<Object> getter(Handle<AccessorPair>::cast(accessors)->getter(),
isolate());
CallOptimization call_optimization(getter);
NamedLoadHandlerCompiler compiler(isolate(), map, holder, cache_holder);
NamedLoadHandlerCompiler compiler(isolate(), map, holder);
if (call_optimization.is_simple_api_call()) {
TRACE_HANDLER_STATS(isolate(), LoadIC_LoadCallback);
int index = lookup->GetAccessorIndex();
......@@ -2016,8 +1959,7 @@ Handle<Object> StoreIC::GetMapIndependentHandler(LookupIterator* lookup) {
}
Handle<Object> StoreIC::CompileHandler(LookupIterator* lookup,
Handle<Object> value,
CacheHolderFlag cache_holder) {
Handle<Object> value) {
DCHECK_NE(LookupIterator::JSPROXY, lookup->state());
// This is currently guaranteed by checks in StoreIC::Store.
......
......@@ -58,14 +58,6 @@ class IC {
return IsStoreIC() || IsStoreOwnIC() || IsKeyedStoreIC();
}
static inline Handle<Map> GetHandlerCacheHolder(Handle<Map> receiver_map,
bool receiver_is_holder,
Isolate* isolate,
CacheHolderFlag* flag);
static inline Handle<Map> GetICCacheHolder(Handle<Map> receiver_map,
Isolate* isolate,
CacheHolderFlag* flag);
// The ICs that don't pass slot and vector through the stack have to
// save/restore them in the dispatcher.
static bool ShouldPushPopSlotAndVector(Code::Kind kind);
......@@ -137,8 +129,7 @@ class IC {
return Handle<Code>::null();
}
virtual Handle<Object> CompileHandler(LookupIterator* lookup,
Handle<Object> value,
CacheHolderFlag cache_holder) {
Handle<Object> value) {
UNREACHABLE();
return Handle<Object>::null();
}
......@@ -287,8 +278,8 @@ class LoadIC : public IC {
Handle<Object> GetMapIndependentHandler(LookupIterator* lookup) override;
Handle<Object> CompileHandler(LookupIterator* lookup, Handle<Object> unused,
CacheHolderFlag cache_holder) override;
Handle<Object> CompileHandler(LookupIterator* lookup,
Handle<Object> unused) override;
private:
// Creates a data handler that represents a load of a field by given index.
......@@ -374,8 +365,8 @@ class StoreIC : public IC {
void UpdateCaches(LookupIterator* lookup, Handle<Object> value,
JSReceiver::StoreFromKeyed store_mode);
Handle<Object> GetMapIndependentHandler(LookupIterator* lookup) override;
Handle<Object> CompileHandler(LookupIterator* lookup, Handle<Object> value,
CacheHolderFlag cache_holder) override;
Handle<Object> CompileHandler(LookupIterator* lookup,
Handle<Object> value) override;
private:
Handle<Object> StoreTransition(Handle<Map> receiver_map,
......
......@@ -42,9 +42,9 @@ bool CommonStubCacheChecks(StubCache* stub_cache, Name* name, Map* map,
DCHECK(IC::IsHandler(handler));
if (handler->IsCode()) {
Code* code = Code::cast(handler);
Code::Flags expected_flags = Code::RemoveHolderFromFlags(
Code::ComputeHandlerFlags(stub_cache->ic_kind()));
Code::Flags flags = Code::RemoveHolderFromFlags(code->flags());
Code::Flags expected_flags =
Code::ComputeHandlerFlags(stub_cache->ic_kind());
Code::Flags flags = code->flags();
DCHECK_EQ(expected_flags, flags);
DCHECK_EQ(Code::HANDLER, Code::ExtractKindFromFlags(code->flags()));
}
......
......@@ -5182,18 +5182,15 @@ Address Code::constant_pool() {
return constant_pool;
}
Code::Flags Code::ComputeFlags(Kind kind, ExtraICState extra_ic_state,
CacheHolderFlag holder) {
Code::Flags Code::ComputeFlags(Kind kind, ExtraICState extra_ic_state) {
// Compute the bit mask.
unsigned int bits = KindField::encode(kind) |
ExtraICStateField::encode(extra_ic_state) |
CacheHolderField::encode(holder);
unsigned int bits =
KindField::encode(kind) | ExtraICStateField::encode(extra_ic_state);
return static_cast<Flags>(bits);
}
Code::Flags Code::ComputeHandlerFlags(Kind handler_kind,
CacheHolderFlag holder) {
return ComputeFlags(Code::HANDLER, handler_kind, holder);
Code::Flags Code::ComputeHandlerFlags(Kind handler_kind) {
return ComputeFlags(Code::HANDLER, handler_kind);
}
......@@ -5207,16 +5204,6 @@ ExtraICState Code::ExtractExtraICStateFromFlags(Flags flags) {
}
CacheHolderFlag Code::ExtractCacheHolderFromFlags(Flags flags) {
return CacheHolderField::decode(flags);
}
Code::Flags Code::RemoveHolderFromFlags(Flags flags) {
int bits = flags & ~CacheHolderField::kMask;
return static_cast<Flags>(bits);
}
Code* Code::GetCodeFromTargetAddress(Address address) {
HeapObject* code = HeapObject::FromAddress(address - Code::kHeaderSize);
// GetCodeFromTargetAddress might be called when marking objects during mark
......
......@@ -5116,18 +5116,13 @@ class Code: public HeapObject {
// Flags operations.
static inline Flags ComputeFlags(
Kind kind, ExtraICState extra_ic_state = kNoExtraICState,
CacheHolderFlag holder = kCacheOnReceiver);
Kind kind, ExtraICState extra_ic_state = kNoExtraICState);
static inline Flags ComputeHandlerFlags(
Kind handler_kind, CacheHolderFlag holder = kCacheOnReceiver);
static inline Flags ComputeHandlerFlags(Kind handler_kind);
static inline CacheHolderFlag ExtractCacheHolderFromFlags(Flags flags);
static inline Kind ExtractKindFromFlags(Flags flags);
static inline ExtraICState ExtractExtraICStateFromFlags(Flags flags);
static inline Flags RemoveHolderFromFlags(Flags flags);
// Convert a target address into a code object.
static inline Code* GetCodeFromTargetAddress(Address address);
......@@ -5338,9 +5333,7 @@ class Code: public HeapObject {
// Flags layout. BitField<type, shift, size>.
class HasUnwindingInfoField : public BitField<bool, 0, 1> {};
class CacheHolderField
: public BitField<CacheHolderFlag, HasUnwindingInfoField::kNext, 2> {};
class KindField : public BitField<Kind, CacheHolderField::kNext, 5> {};
class KindField : public BitField<Kind, HasUnwindingInfoField::kNext, 5> {};
STATIC_ASSERT(NUMBER_OF_KINDS <= KindField::kMax);
class ExtraICStateField
: public BitField<ExtraICState, KindField::kNext,
......@@ -5403,9 +5396,6 @@ class Code: public HeapObject {
static const int kArgumentsBits = 16;
static const int kMaxArguments = (1 << kArgumentsBits) - 1;
// This constant should be encodable in an ARM instruction.
static const int kFlagsNotUsedInLookup = CacheHolderField::kMask;
private:
friend class RelocIterator;
friend class Deoptimizer; // For FindCodeAgeSequence.
......
......@@ -204,8 +204,7 @@ TEST(TryProbeStubCache) {
// Generate some number of handlers.
for (int i = 0; i < 30; i++) {
Code::Flags flags =
Code::RemoveHolderFromFlags(Code::ComputeHandlerFlags(ic_kind));
Code::Flags flags = Code::ComputeHandlerFlags(ic_kind);
handlers.push_back(CreateCodeWithFlags(flags));
}
......
......@@ -31,8 +31,7 @@ static Handle<Code> GetDummyCode(Isolate* isolate) {
nullptr, // unwinding_info
0, // unwinding_info_size
nullptr}; // origin
Code::Flags flags =
Code::ComputeFlags(Code::LOAD_IC, kNoExtraICState, kCacheOnReceiver);
Code::Flags flags = Code::ComputeFlags(Code::LOAD_IC, kNoExtraICState);
Handle<Code> self_ref;
return isolate->factory()->NewCode(desc, flags, self_ref);
}
......@@ -60,9 +59,7 @@ TEST(CodeCache) {
codes.Add(GetDummyCode(isolate));
}
Handle<Name> bad_name = isolate->factory()->NewSymbol();
Code::Flags bad_flags =
Code::ComputeFlags(Code::LOAD_IC, kNoExtraICState, kCacheOnPrototype);
DCHECK(bad_flags != codes[0]->flags());
Code::Flags flags = Code::ComputeFlags(Code::LOAD_IC, kNoExtraICState);
// Cache name/code pairs.
for (int i = 0; i < kEntries; i++) {
......@@ -70,9 +67,8 @@ TEST(CodeCache) {
Handle<Code> code = codes.at(i);
Map::UpdateCodeCache(map, name, code);
CHECK_EQ(*code, map->LookupInCodeCache(*name, code->flags()));
CHECK_NULL(map->LookupInCodeCache(*name, bad_flags));
}
CHECK_NULL(map->LookupInCodeCache(*bad_name, bad_flags));
CHECK_NULL(map->LookupInCodeCache(*bad_name, flags));
// Check that lookup works not only right after storing.
for (int i = 0; i < kEntries; i++) {
......
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