Skip to content

Commit 5dbf1f7

Browse files
committed
Version 4.4.63.31 (cherry-pick)
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}
1 parent 09fdd96 commit 5dbf1f7

File tree

12 files changed

+195
-145
lines changed

12 files changed

+195
-145
lines changed

include/v8-version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#define V8_MAJOR_VERSION 4
1212
#define V8_MINOR_VERSION 4
1313
#define V8_BUILD_NUMBER 63
14-
#define V8_PATCH_LEVEL 30
14+
#define V8_PATCH_LEVEL 31
1515

1616
// Use 1 for candidates and 0 otherwise.
1717
// (Boolean macro values are not supported by all preprocessors.)

src/ast-numbering.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class AstNumberingVisitor final : public AstVisitor {
1818
: AstVisitor(),
1919
next_id_(BailoutId::FirstUsable().ToInt()),
2020
properties_(zone),
21-
ic_slot_cache_(FLAG_vector_ics ? 4 : 0),
21+
ic_slot_cache_(zone),
2222
dont_optimize_reason_(kNoReason) {
2323
InitializeAstVisitor(isolate, zone);
2424
}

src/ast.cc

+6-7
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ void VariableProxy::SetFirstFeedbackICSlot(FeedbackVectorICSlot slot,
9696
ICSlotCache* cache) {
9797
variable_feedback_slot_ = slot;
9898
if (var()->IsUnallocated()) {
99-
cache->Add(VariableICSlotPair(var(), slot));
99+
cache->Put(var(), slot);
100100
}
101101
}
102102

@@ -107,12 +107,11 @@ FeedbackVectorRequirements VariableProxy::ComputeFeedbackRequirements(
107107
// VariableProxies that point to the same Variable within a function can
108108
// make their loads from the same IC slot.
109109
if (var()->IsUnallocated()) {
110-
for (int i = 0; i < cache->length(); i++) {
111-
VariableICSlotPair& pair = cache->at(i);
112-
if (pair.variable() == var()) {
113-
variable_feedback_slot_ = pair.slot();
114-
return FeedbackVectorRequirements(0, 0);
115-
}
110+
ZoneHashMap::Entry* entry = cache->Get(var());
111+
if (entry != NULL) {
112+
variable_feedback_slot_ = FeedbackVectorICSlot(
113+
static_cast<int>(reinterpret_cast<intptr_t>(entry->value)));
114+
return FeedbackVectorRequirements(0, 0);
116115
}
117116
}
118117
return FeedbackVectorRequirements(0, 1);

src/ast.h

+17-12
Original file line numberDiff line numberDiff line change
@@ -158,25 +158,30 @@ class FeedbackVectorRequirements {
158158
};
159159

160160

161-
class VariableICSlotPair final {
161+
class ICSlotCache {
162162
public:
163-
VariableICSlotPair(Variable* variable, FeedbackVectorICSlot slot)
164-
: variable_(variable), slot_(slot) {}
165-
VariableICSlotPair()
166-
: variable_(NULL), slot_(FeedbackVectorICSlot::Invalid()) {}
163+
explicit ICSlotCache(Zone* zone)
164+
: zone_(zone),
165+
hash_map_(HashMap::PointersMatch,
166+
FLAG_vector_ics ? ZoneHashMap::kDefaultHashMapCapacity : 0,
167+
ZoneAllocationPolicy(zone)) {}
167168

168-
Variable* variable() const { return variable_; }
169-
FeedbackVectorICSlot slot() const { return slot_; }
169+
void Put(Variable* variable, FeedbackVectorICSlot slot) {
170+
ZoneHashMap::Entry* entry = hash_map_.LookupOrInsert(
171+
variable, ComputePointerHash(variable), ZoneAllocationPolicy(zone_));
172+
entry->value = reinterpret_cast<void*>(slot.ToInt());
173+
}
174+
175+
ZoneHashMap::Entry* Get(Variable* variable) const {
176+
return hash_map_.Lookup(variable, ComputePointerHash(variable));
177+
}
170178

171179
private:
172-
Variable* variable_;
173-
FeedbackVectorICSlot slot_;
180+
Zone* zone_;
181+
ZoneHashMap hash_map_;
174182
};
175183

176184

177-
typedef List<VariableICSlotPair> ICSlotCache;
178-
179-
180185
class AstProperties final BASE_EMBEDDED {
181186
public:
182187
class Flags : public EnumSet<AstPropertiesFlag, int> {};

src/factory.cc

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ Handle<PrototypeInfo> Factory::NewPrototypeInfo() {
5555
Handle<PrototypeInfo> result =
5656
Handle<PrototypeInfo>::cast(NewStruct(PROTOTYPE_INFO_TYPE));
5757
result->set_prototype_users(WeakFixedArray::Empty());
58+
result->set_registry_slot(PrototypeInfo::UNREGISTERED);
5859
result->set_validity_cell(Smi::FromInt(0));
5960
result->set_constructor_name(Smi::FromInt(0));
6061
return result;

src/hashmap.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class TemplateHashMapImpl {
4343

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

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

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

114114
template <class AllocationPolicy>
115115
typename TemplateHashMapImpl<AllocationPolicy>::Entry*
116-
TemplateHashMapImpl<AllocationPolicy>::Lookup(void* key, uint32_t hash) {
116+
TemplateHashMapImpl<AllocationPolicy>::Lookup(void* key, uint32_t hash) const {
117117
Entry* p = Probe(key, hash);
118118
return p->key != NULL ? p : NULL;
119119
}
@@ -242,7 +242,7 @@ typename TemplateHashMapImpl<AllocationPolicy>::Entry*
242242

243243
template <class AllocationPolicy>
244244
typename TemplateHashMapImpl<AllocationPolicy>::Entry*
245-
TemplateHashMapImpl<AllocationPolicy>::Probe(void* key, uint32_t hash) {
245+
TemplateHashMapImpl<AllocationPolicy>::Probe(void* key, uint32_t hash) const {
246246
DCHECK(key != NULL);
247247

248248
DCHECK(base::bits::IsPowerOfTwo32(capacity_));

src/objects-inl.h

+1
Original file line numberDiff line numberDiff line change
@@ -5455,6 +5455,7 @@ ACCESSORS(ExecutableAccessorInfo, data, Object, kDataOffset)
54555455
ACCESSORS(Box, value, Object, kValueOffset)
54565456

54575457
ACCESSORS(PrototypeInfo, prototype_users, Object, kPrototypeUsersOffset)
5458+
SMI_ACCESSORS(PrototypeInfo, registry_slot, kRegistrySlotOffset)
54585459
ACCESSORS(PrototypeInfo, validity_cell, Object, kValidityCellOffset)
54595460
ACCESSORS(PrototypeInfo, constructor_name, Object, kConstructorNameOffset)
54605461

src/objects-printer.cc

+1
Original file line numberDiff line numberDiff line change
@@ -884,6 +884,7 @@ void Box::BoxPrint(std::ostream& os) { // NOLINT
884884
void PrototypeInfo::PrototypeInfoPrint(std::ostream& os) { // NOLINT
885885
HeapObject::PrintHeader(os, "PrototypeInfo");
886886
os << "\n - prototype users: " << Brief(prototype_users());
887+
os << "\n - registry slot: " << registry_slot();
887888
os << "\n - validity cell: " << Brief(validity_cell());
888889
os << "\n - constructor name: " << Brief(constructor_name());
889890
os << "\n";

0 commit comments

Comments
 (0)