Skip to content

Commit

Permalink
Version 4.4.63.31 (cherry-pick)
Browse files Browse the repository at this point in the history
Merged 1e65e20
Merged 6ea0d55

Fasterify JSObject::UnregisterPrototypeUser

Fasterify ICSlotCache

BUG=chromium:517406,chromium:517406,chromium:517778
LOG=N
[email protected]

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

Cr-Commit-Position: refs/branch-heads/4.4@{#36}
Cr-Branched-From: 2e4c550-refs/heads/4.4.63@{#1}
Cr-Branched-From: 0208b8e-refs/heads/master@{#28333}
  • Loading branch information
jakobkummerow committed Aug 11, 2015
1 parent 09fdd96 commit 5dbf1f7
Show file tree
Hide file tree
Showing 12 changed files with 195 additions and 145 deletions.
2 changes: 1 addition & 1 deletion include/v8-version.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#define V8_MAJOR_VERSION 4
#define V8_MINOR_VERSION 4
#define V8_BUILD_NUMBER 63
#define V8_PATCH_LEVEL 30
#define V8_PATCH_LEVEL 31

// Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.)
Expand Down
2 changes: 1 addition & 1 deletion src/ast-numbering.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class AstNumberingVisitor final : public AstVisitor {
: AstVisitor(),
next_id_(BailoutId::FirstUsable().ToInt()),
properties_(zone),
ic_slot_cache_(FLAG_vector_ics ? 4 : 0),
ic_slot_cache_(zone),
dont_optimize_reason_(kNoReason) {
InitializeAstVisitor(isolate, zone);
}
Expand Down
13 changes: 6 additions & 7 deletions src/ast.cc
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ void VariableProxy::SetFirstFeedbackICSlot(FeedbackVectorICSlot slot,
ICSlotCache* cache) {
variable_feedback_slot_ = slot;
if (var()->IsUnallocated()) {
cache->Add(VariableICSlotPair(var(), slot));
cache->Put(var(), slot);
}
}

Expand All @@ -107,12 +107,11 @@ FeedbackVectorRequirements VariableProxy::ComputeFeedbackRequirements(
// VariableProxies that point to the same Variable within a function can
// make their loads from the same IC slot.
if (var()->IsUnallocated()) {
for (int i = 0; i < cache->length(); i++) {
VariableICSlotPair& pair = cache->at(i);
if (pair.variable() == var()) {
variable_feedback_slot_ = pair.slot();
return FeedbackVectorRequirements(0, 0);
}
ZoneHashMap::Entry* entry = cache->Get(var());
if (entry != NULL) {
variable_feedback_slot_ = FeedbackVectorICSlot(
static_cast<int>(reinterpret_cast<intptr_t>(entry->value)));
return FeedbackVectorRequirements(0, 0);
}
}
return FeedbackVectorRequirements(0, 1);
Expand Down
29 changes: 17 additions & 12 deletions src/ast.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,25 +158,30 @@ class FeedbackVectorRequirements {
};


class VariableICSlotPair final {
class ICSlotCache {
public:
VariableICSlotPair(Variable* variable, FeedbackVectorICSlot slot)
: variable_(variable), slot_(slot) {}
VariableICSlotPair()
: variable_(NULL), slot_(FeedbackVectorICSlot::Invalid()) {}
explicit ICSlotCache(Zone* zone)
: zone_(zone),
hash_map_(HashMap::PointersMatch,
FLAG_vector_ics ? ZoneHashMap::kDefaultHashMapCapacity : 0,
ZoneAllocationPolicy(zone)) {}

Variable* variable() const { return variable_; }
FeedbackVectorICSlot slot() const { return slot_; }
void Put(Variable* variable, FeedbackVectorICSlot slot) {
ZoneHashMap::Entry* entry = hash_map_.LookupOrInsert(
variable, ComputePointerHash(variable), ZoneAllocationPolicy(zone_));
entry->value = reinterpret_cast<void*>(slot.ToInt());
}

ZoneHashMap::Entry* Get(Variable* variable) const {
return hash_map_.Lookup(variable, ComputePointerHash(variable));
}

private:
Variable* variable_;
FeedbackVectorICSlot slot_;
Zone* zone_;
ZoneHashMap hash_map_;
};


typedef List<VariableICSlotPair> ICSlotCache;


class AstProperties final BASE_EMBEDDED {
public:
class Flags : public EnumSet<AstPropertiesFlag, int> {};
Expand Down
1 change: 1 addition & 0 deletions src/factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ Handle<PrototypeInfo> Factory::NewPrototypeInfo() {
Handle<PrototypeInfo> result =
Handle<PrototypeInfo>::cast(NewStruct(PROTOTYPE_INFO_TYPE));
result->set_prototype_users(WeakFixedArray::Empty());
result->set_registry_slot(PrototypeInfo::UNREGISTERED);
result->set_validity_cell(Smi::FromInt(0));
result->set_constructor_name(Smi::FromInt(0));
return result;
Expand Down
8 changes: 4 additions & 4 deletions src/hashmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class TemplateHashMapImpl {

// If an entry with matching key is found, returns that entry.
// Otherwise, NULL is returned.
Entry* Lookup(void* key, uint32_t hash);
Entry* Lookup(void* key, uint32_t hash) const;

// If an entry with matching key is found, returns that entry.
// If no matching entry is found, a new entry is inserted with
Expand Down Expand Up @@ -90,7 +90,7 @@ class TemplateHashMapImpl {
uint32_t occupancy_;

Entry* map_end() const { return map_ + capacity_; }
Entry* Probe(void* key, uint32_t hash);
Entry* Probe(void* key, uint32_t hash) const;
void Initialize(uint32_t capacity, AllocationPolicy allocator);
void Resize(AllocationPolicy allocator);
};
Expand All @@ -113,7 +113,7 @@ TemplateHashMapImpl<AllocationPolicy>::~TemplateHashMapImpl() {

template <class AllocationPolicy>
typename TemplateHashMapImpl<AllocationPolicy>::Entry*
TemplateHashMapImpl<AllocationPolicy>::Lookup(void* key, uint32_t hash) {
TemplateHashMapImpl<AllocationPolicy>::Lookup(void* key, uint32_t hash) const {
Entry* p = Probe(key, hash);
return p->key != NULL ? p : NULL;
}
Expand Down Expand Up @@ -242,7 +242,7 @@ typename TemplateHashMapImpl<AllocationPolicy>::Entry*

template <class AllocationPolicy>
typename TemplateHashMapImpl<AllocationPolicy>::Entry*
TemplateHashMapImpl<AllocationPolicy>::Probe(void* key, uint32_t hash) {
TemplateHashMapImpl<AllocationPolicy>::Probe(void* key, uint32_t hash) const {
DCHECK(key != NULL);

DCHECK(base::bits::IsPowerOfTwo32(capacity_));
Expand Down
1 change: 1 addition & 0 deletions src/objects-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -5455,6 +5455,7 @@ ACCESSORS(ExecutableAccessorInfo, data, Object, kDataOffset)
ACCESSORS(Box, value, Object, kValueOffset)

ACCESSORS(PrototypeInfo, prototype_users, Object, kPrototypeUsersOffset)
SMI_ACCESSORS(PrototypeInfo, registry_slot, kRegistrySlotOffset)
ACCESSORS(PrototypeInfo, validity_cell, Object, kValidityCellOffset)
ACCESSORS(PrototypeInfo, constructor_name, Object, kConstructorNameOffset)

Expand Down
1 change: 1 addition & 0 deletions src/objects-printer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -884,6 +884,7 @@ void Box::BoxPrint(std::ostream& os) { // NOLINT
void PrototypeInfo::PrototypeInfoPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "PrototypeInfo");
os << "\n - prototype users: " << Brief(prototype_users());
os << "\n - registry slot: " << registry_slot();
os << "\n - validity cell: " << Brief(validity_cell());
os << "\n - constructor name: " << Brief(constructor_name());
os << "\n";
Expand Down
Loading

0 comments on commit 5dbf1f7

Please sign in to comment.