Commit a0d1e58f authored by Marja Hölttä's avatar Marja Hölttä Committed by Commit Bot

[parser] Skipping inner funcs: use ZoneChunkList instead of ZoneDeque.

ZoneDeque is memory-inefficient, see
https://bugs.chromium.org/p/chromium/issues/detail?id=674287

As a downside, ZoneChunkList is not const correct, see

https: //bugs.chromium.org/p/v8/issues/detail?id=6473 .
Bug: v8:5516
Change-Id: I2db15006afd78aa932ab831cd9c0cff659229321
Reviewed-on: https://chromium-review.googlesource.com/750782Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Commit-Queue: Marja Hölttä <marja@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49182}
parent 201a40d2
......@@ -102,16 +102,16 @@ void ProducedPreParsedScopeData::ByteData::WriteUint32(uint32_t data) {
}
void ProducedPreParsedScopeData::ByteData::OverwriteFirstUint32(uint32_t data) {
size_t position = 0;
auto it = backing_store_.begin();
#ifdef DEBUG
// Check that that position already holds an item of the expected size.
DCHECK_GE(backing_store_.size(), kUint32Size);
DCHECK_EQ(backing_store_[0], kUint32Size);
++position;
DCHECK_EQ(*it, kUint32Size);
++it;
#endif
const uint8_t* d = reinterpret_cast<uint8_t*>(&data);
for (size_t i = 0; i < 4; ++i) {
backing_store_[position + i] = *d++;
*it++ = *d++;
}
}
......@@ -143,7 +143,7 @@ void ProducedPreParsedScopeData::ByteData::WriteQuarter(uint8_t data) {
}
Handle<PodArray<uint8_t>> ProducedPreParsedScopeData::ByteData::Serialize(
Isolate* isolate) const {
Isolate* isolate) {
Handle<PodArray<uint8_t>> array = PodArray<uint8_t>::New(
isolate, static_cast<int>(backing_store_.size()), TENURED);
......@@ -275,7 +275,7 @@ bool ProducedPreParsedScopeData::ContainsInnerFunctions() const {
}
MaybeHandle<PreParsedScopeData> ProducedPreParsedScopeData::Serialize(
Isolate* isolate) const {
Isolate* isolate) {
if (!previously_produced_preparsed_scope_data_.is_null()) {
DCHECK(!bailed_out_);
DCHECK_EQ(data_for_inner_functions_.size(), 0);
......
......@@ -13,7 +13,7 @@
#include "src/handles.h"
#include "src/objects/shared-function-info.h"
#include "src/parsing/preparse-data.h"
#include "src/zone/zone-containers.h"
#include "src/zone/zone-chunk-list.h"
namespace v8 {
namespace internal {
......@@ -79,12 +79,12 @@ class ProducedPreParsedScopeData : public ZoneObject {
// For overwriting previously written data at position 0.
void OverwriteFirstUint32(uint32_t data);
Handle<PodArray<uint8_t>> Serialize(Isolate* isolate) const;
Handle<PodArray<uint8_t>> Serialize(Isolate* isolate);
size_t size() const { return backing_store_.size(); }
private:
ZoneDeque<uint8_t> backing_store_;
ZoneChunkList<uint8_t> backing_store_;
uint8_t free_quarters_in_last_byte_;
};
......@@ -150,7 +150,7 @@ class ProducedPreParsedScopeData : public ZoneObject {
// If there is data (if the Scope contains skippable inner functions), move
// the data into the heap and return a Handle to it; otherwise return a null
// MaybeHandle.
MaybeHandle<PreParsedScopeData> Serialize(Isolate* isolate) const;
MaybeHandle<PreParsedScopeData> Serialize(Isolate* isolate);
static bool ScopeNeedsData(Scope* scope);
static bool ScopeIsSkippableFunctionScope(Scope* scope);
......@@ -168,7 +168,7 @@ class ProducedPreParsedScopeData : public ZoneObject {
ProducedPreParsedScopeData* parent_;
ByteData* byte_data_;
ZoneDeque<ProducedPreParsedScopeData*> data_for_inner_functions_;
ZoneChunkList<ProducedPreParsedScopeData*> data_for_inner_functions_;
// Whether we've given up producing the data for this function.
bool bailed_out_;
......
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