JSRegExp::Flags flags = RegExpFlagsFromString(flag_str);
Handle<FixedArray> cached = CompilationCache::LookupRegExp(pattern, flags);
bool in_cache = !cached.is_null();
+ LOG(RegExpCompileEvent(re, in_cache));
+
Handle<Object> result;
if (in_cache) {
re->set_data(*cached);
result = re;
} else {
FlattenString(pattern);
+ ZoneScope zone_scope(DELETE_ON_EXIT);
RegExpParseResult parse_result;
FlatStringReader reader(pattern);
if (!ParseRegExp(&reader, flags.is_multiline(), &parse_result)) {
}
}
- LOG(RegExpCompileEvent(re, in_cache));
return result;
}
SC(enum_cache_hits, V8.EnumCacheHits) \
SC(enum_cache_misses, V8.EnumCacheMisses) \
SC(reloc_info_count, V8.RelocInfoCount) \
- SC(reloc_info_size, V8.RelocInfoSize)
+ SC(reloc_info_size, V8.RelocInfoSize) \
+ SC(zone_segment_bytes, V8.ZoneSegmentBytes)
// This file contains all the v8 counters that are in use.
#define V8_ZONE_INL_H_
#include "zone.h"
+#include "v8-counters.h"
namespace v8 { namespace internal {
inline void* Zone::New(int size) {
ASSERT(AssertNoZoneAllocation::allow_allocation());
+ ASSERT(ZoneScope::nesting() > 0);
// Round up the requested size to fit the alignment.
size = RoundUp(size, kAlignment);
}
+void Zone::adjust_segment_bytes_allocated(int delta) {
+ segment_bytes_allocated_ += delta;
+ Counters::zone_segment_bytes.Set(segment_bytes_allocated_);
+}
+
+
} } // namespace v8::internal
#endif // V8_ZONE_INL_H_
// of the segment chain. Returns the new segment.
static Segment* New(int size) {
Segment* result = reinterpret_cast<Segment*>(Malloced::New(size));
- Zone::segment_bytes_allocated_ += size;
+ Zone::adjust_segment_bytes_allocated(size);
if (result != NULL) {
result->next_ = head_;
result->size_ = size;
// Deletes the given segment. Does not touch the segment chain.
static void Delete(Segment* segment, int size) {
- Zone::segment_bytes_allocated_ -= size;
+ Zone::adjust_segment_bytes_allocated(-size);
Malloced::Delete(segment);
}
// the limit allows.
static inline bool excess_allocation();
+ static inline void adjust_segment_bytes_allocated(int delta);
+
private:
- friend class Segment;
// All pointers returned from New() have this alignment.
static const int kAlignment = kPointerSize;
mode_ = DELETE_ON_EXIT;
}
+ static int nesting() { return nesting_; }
+
private:
ZoneScopeMode mode_;
static int nesting_;
List<Node*>* list = new List<Node*>(0);
CHECK_EQ(0, list->length());
+ ZoneScope zone_scope(DELETE_ON_EXIT);
Node* node = new EmptyStatement();
list->Add(node);
CHECK_EQ(1, list->length());