| Index: src/ast.cc
|
| diff --git a/src/ast.cc b/src/ast.cc
|
| index 6f9fd7afb23a6c33cdcbaa081e70650269e94033..18f02045fc53d79504ad39c93da3f0b2e3b6a4d0 100644
|
| --- a/src/ast.cc
|
| +++ b/src/ast.cc
|
| @@ -242,8 +242,11 @@ bool IsEqualNumber(void* first, void* second) {
|
| }
|
|
|
|
|
| -void ObjectLiteral::CalculateEmitStore() {
|
| - ZoneHashMap table(Literal::Match);
|
| +void ObjectLiteral::CalculateEmitStore(Zone* zone) {
|
| + ZoneAllocationPolicy allocator(zone);
|
| +
|
| + ZoneHashMap table(Literal::Match, ZoneHashMap::kDefaultHashMapCapacity,
|
| + allocator);
|
| for (int i = properties()->length() - 1; i >= 0; i--) {
|
| ObjectLiteral::Property* property = properties()->at(i);
|
| Literal* literal = property->key();
|
| @@ -252,23 +255,23 @@ void ObjectLiteral::CalculateEmitStore() {
|
| // If the key of a computed property is in the table, do not emit
|
| // a store for the property later.
|
| if (property->kind() == ObjectLiteral::Property::COMPUTED &&
|
| - table.Lookup(literal, hash, false) != NULL) {
|
| + table.Lookup(literal, hash, false, allocator) != NULL) {
|
| property->set_emit_store(false);
|
| } else {
|
| // Add key to the table.
|
| - table.Lookup(literal, hash, true);
|
| + table.Lookup(literal, hash, true, allocator);
|
| }
|
| }
|
| }
|
|
|
|
|
| -void TargetCollector::AddTarget(Label* target) {
|
| +void TargetCollector::AddTarget(Label* target, Zone* zone) {
|
| // Add the label to the collector, but discard duplicates.
|
| int length = targets_.length();
|
| for (int i = 0; i < length; i++) {
|
| if (targets_[i] == target) return;
|
| }
|
| - targets_.Add(target);
|
| + targets_.Add(target, zone);
|
| }
|
|
|
|
|
| @@ -397,7 +400,8 @@ bool FunctionDeclaration::IsInlineable() const {
|
| // ----------------------------------------------------------------------------
|
| // Recording of type feedback
|
|
|
| -void Property::RecordTypeFeedback(TypeFeedbackOracle* oracle) {
|
| +void Property::RecordTypeFeedback(TypeFeedbackOracle* oracle,
|
| + Zone* zone) {
|
| // Record type feedback from the oracle in the AST.
|
| is_uninitialized_ = oracle->LoadIsUninitialized(this);
|
| if (is_uninitialized_) return;
|
| @@ -421,15 +425,17 @@ void Property::RecordTypeFeedback(TypeFeedbackOracle* oracle) {
|
| } else if (oracle->LoadIsBuiltin(this, Builtins::kKeyedLoadIC_String)) {
|
| is_string_access_ = true;
|
| } else if (is_monomorphic_) {
|
| - receiver_types_.Add(oracle->LoadMonomorphicReceiverType(this));
|
| + receiver_types_.Add(oracle->LoadMonomorphicReceiverType(this),
|
| + zone);
|
| } else if (oracle->LoadIsMegamorphicWithTypeInfo(this)) {
|
| - receiver_types_.Reserve(kMaxKeyedPolymorphism);
|
| + receiver_types_.Reserve(kMaxKeyedPolymorphism, zone);
|
| oracle->CollectKeyedReceiverTypes(this->id(), &receiver_types_);
|
| }
|
| }
|
|
|
|
|
| -void Assignment::RecordTypeFeedback(TypeFeedbackOracle* oracle) {
|
| +void Assignment::RecordTypeFeedback(TypeFeedbackOracle* oracle,
|
| + Zone* zone) {
|
| Property* prop = target()->AsProperty();
|
| ASSERT(prop != NULL);
|
| is_monomorphic_ = oracle->StoreIsMonomorphicNormal(this);
|
| @@ -441,22 +447,23 @@ void Assignment::RecordTypeFeedback(TypeFeedbackOracle* oracle) {
|
| oracle->StoreReceiverTypes(this, name, &receiver_types_);
|
| } else if (is_monomorphic_) {
|
| // Record receiver type for monomorphic keyed stores.
|
| - receiver_types_.Add(oracle->StoreMonomorphicReceiverType(this));
|
| + receiver_types_.Add(oracle->StoreMonomorphicReceiverType(this), zone);
|
| } else if (oracle->StoreIsMegamorphicWithTypeInfo(this)) {
|
| - receiver_types_.Reserve(kMaxKeyedPolymorphism);
|
| + receiver_types_.Reserve(kMaxKeyedPolymorphism, zone);
|
| oracle->CollectKeyedReceiverTypes(this->id(), &receiver_types_);
|
| }
|
| }
|
|
|
|
|
| -void CountOperation::RecordTypeFeedback(TypeFeedbackOracle* oracle) {
|
| +void CountOperation::RecordTypeFeedback(TypeFeedbackOracle* oracle,
|
| + Zone* zone) {
|
| is_monomorphic_ = oracle->StoreIsMonomorphicNormal(this);
|
| receiver_types_.Clear();
|
| if (is_monomorphic_) {
|
| // Record receiver type for monomorphic keyed stores.
|
| - receiver_types_.Add(oracle->StoreMonomorphicReceiverType(this));
|
| + receiver_types_.Add(oracle->StoreMonomorphicReceiverType(this), zone);
|
| } else if (oracle->StoreIsMegamorphicWithTypeInfo(this)) {
|
| - receiver_types_.Reserve(kMaxKeyedPolymorphism);
|
| + receiver_types_.Reserve(kMaxKeyedPolymorphism, zone);
|
| oracle->CollectKeyedReceiverTypes(this->id(), &receiver_types_);
|
| }
|
| }
|
| @@ -784,7 +791,7 @@ bool RegExpCapture::IsAnchoredAtEnd() {
|
| // output formats are alike.
|
| class RegExpUnparser: public RegExpVisitor {
|
| public:
|
| - RegExpUnparser();
|
| + explicit RegExpUnparser(Zone* zone);
|
| void VisitCharacterRange(CharacterRange that);
|
| SmartArrayPointer<const char> ToString() { return stream_.ToCString(); }
|
| #define MAKE_CASE(Name) virtual void* Visit##Name(RegExp##Name*, void* data);
|
| @@ -794,10 +801,11 @@ class RegExpUnparser: public RegExpVisitor {
|
| StringStream* stream() { return &stream_; }
|
| HeapStringAllocator alloc_;
|
| StringStream stream_;
|
| + Zone* zone_;
|
| };
|
|
|
|
|
| -RegExpUnparser::RegExpUnparser() : stream_(&alloc_) {
|
| +RegExpUnparser::RegExpUnparser(Zone* zone) : stream_(&alloc_), zone_(zone) {
|
| }
|
|
|
|
|
| @@ -837,9 +845,9 @@ void* RegExpUnparser::VisitCharacterClass(RegExpCharacterClass* that,
|
| if (that->is_negated())
|
| stream()->Add("^");
|
| stream()->Add("[");
|
| - for (int i = 0; i < that->ranges()->length(); i++) {
|
| + for (int i = 0; i < that->ranges(zone_)->length(); i++) {
|
| if (i > 0) stream()->Add(" ");
|
| - VisitCharacterRange(that->ranges()->at(i));
|
| + VisitCharacterRange(that->ranges(zone_)->at(i));
|
| }
|
| stream()->Add("]");
|
| return NULL;
|
| @@ -941,8 +949,8 @@ void* RegExpUnparser::VisitEmpty(RegExpEmpty* that, void* data) {
|
| }
|
|
|
|
|
| -SmartArrayPointer<const char> RegExpTree::ToString() {
|
| - RegExpUnparser unparser;
|
| +SmartArrayPointer<const char> RegExpTree::ToString(Zone* zone) {
|
| + RegExpUnparser unparser(zone);
|
| Accept(&unparser, NULL);
|
| return unparser.ToString();
|
| }
|
|
|