static Handle<SharedFunctionInfo> MakeFunctionInfo(CompilationInfo* info) {
- CompilationZoneScope zone_scope(DELETE_ON_EXIT);
-
Isolate* isolate = info->isolate();
+ CompilationZoneScope zone_scope(isolate, DELETE_ON_EXIT);
PostponeInterruptsScope postpone(isolate);
ASSERT(!isolate->global_context().is_null());
bool Compiler::CompileLazy(CompilationInfo* info) {
- CompilationZoneScope zone_scope(DELETE_ON_EXIT);
+ Isolate* isolate = info->isolate();
+
+ CompilationZoneScope zone_scope(isolate, DELETE_ON_EXIT);
// The VM is in the COMPILER state until exiting this function.
- VMState state(info->isolate(), COMPILER);
+ VMState state(isolate, COMPILER);
- Isolate* isolate = info->isolate();
PostponeInterruptsScope postpone(isolate);
Handle<SharedFunctionInfo> shared = info->shared_info();
// clear this list of handles as well.
class CompilationZoneScope : public ZoneScope {
public:
- explicit CompilationZoneScope(ZoneScopeMode mode) : ZoneScope(mode) { }
+ CompilationZoneScope(Isolate* isolate, ZoneScopeMode mode)
+ : ZoneScope(isolate, mode) {}
+
virtual ~CompilationZoneScope() {
if (ShouldDeleteOnExit()) {
Isolate* isolate = Isolate::Current();
ConstructorHeapProfile::ConstructorHeapProfile()
- : zscope_(DELETE_ON_EXIT) {
+ : zscope_(Isolate::Current(), DELETE_ON_EXIT) {
}
ClustersCoarser::ClustersCoarser()
- : zscope_(DELETE_ON_EXIT),
+ : zscope_(Isolate::Current(), DELETE_ON_EXIT),
sim_list_(ClustersCoarser::kInitialSimilarityListCapacity),
current_pair_(NULL),
current_set_(NULL),
RetainerHeapProfile::RetainerHeapProfile()
- : zscope_(DELETE_ON_EXIT),
+ : zscope_(Isolate::Current(), DELETE_ON_EXIT),
aggregator_(NULL) {
JSObjectsCluster roots(JSObjectsCluster::ROOTS);
ReferencesExtractor extractor(roots, this);
if (coarser_ != NULL &&
!coarser_->GetCoarseEquivalent(cluster).is_null()) return;
JSObjectsClusterTree* tree_to_iterate = tree;
- ZoneScope zs(DELETE_ON_EXIT);
+ ZoneScope zs(Isolate::Current(), DELETE_ON_EXIT);
JSObjectsClusterTree dest_tree_;
if (coarser_ != NULL) {
RetainersAggregator retainers_aggregator(coarser_, &dest_tree_);
return re;
}
pattern = FlattenGetString(pattern);
- CompilationZoneScope zone_scope(DELETE_ON_EXIT);
+ CompilationZoneScope zone_scope(isolate, DELETE_ON_EXIT);
PostponeInterruptsScope postpone(isolate);
RegExpCompileData parse_result;
FlatStringReader reader(isolate, pattern);
bool RegExpImpl::CompileIrregexp(Handle<JSRegExp> re, bool is_ascii) {
// Compile the RegExp.
Isolate* isolate = re->GetIsolate();
- CompilationZoneScope zone_scope(DELETE_ON_EXIT);
+ CompilationZoneScope zone_scope(isolate, DELETE_ON_EXIT);
PostponeInterruptsScope postpone(isolate);
Object* entry = re->DataAt(JSRegExp::code_index(is_ascii));
if (entry->IsJSObject()) {
JSArray* LiveEdit::GatherCompileInfo(Handle<Script> script,
Handle<String> source) {
Isolate* isolate = Isolate::Current();
- CompilationZoneScope zone_scope(DELETE_ON_EXIT);
+ CompilationZoneScope zone_scope(isolate, DELETE_ON_EXIT);
FunctionInfoListener listener;
Handle<Object> original_source = Handle<Object>(script->source());
AssertNoAllocation no_allocations_please;
// A zone scope for ReferenceCollectorVisitor.
- ZoneScope scope(DELETE_ON_EXIT);
+ ZoneScope scope(Isolate::Current(), DELETE_ON_EXIT);
ReferenceCollectorVisitor visitor(original);
// removing all listed function if possible and if do_drop is true.
static const char* DropActivationsInActiveThread(
Handle<JSArray> shared_info_array, Handle<JSArray> result, bool do_drop) {
- Debug* debug = Isolate::Current()->debug();
- ZoneScope scope(DELETE_ON_EXIT);
+ Isolate* isolate = Isolate::Current();
+ Debug* debug = isolate->debug();
+ ZoneScope scope(isolate, DELETE_ON_EXIT);
Vector<StackFrame*> frames = CreateStackMap();
int array_len = Smi::cast(shared_info_array->length())->value();
FunctionLiteral* Parser::ParseProgram(Handle<String> source,
bool in_global_context,
StrictModeFlag strict_mode) {
- CompilationZoneScope zone_scope(DONT_DELETE_ON_EXIT);
+ CompilationZoneScope zone_scope(isolate(), DONT_DELETE_ON_EXIT);
HistogramTimerScope timer(isolate()->counters()->parse());
isolate()->counters()->total_parse_size()->Increment(source->length());
}
FunctionLiteral* Parser::ParseLazy(CompilationInfo* info) {
- CompilationZoneScope zone_scope(DONT_DELETE_ON_EXIT);
+ CompilationZoneScope zone_scope(isolate(), DONT_DELETE_ON_EXIT);
HistogramTimerScope timer(isolate()->counters()->parse_lazy());
Handle<String> source(String::cast(script_->source()));
isolate()->counters()->total_parse_size()->Increment(source->length());
// Parse a JSON array. Scanner must be right after '[' token.
Handle<Object> JsonParser::ParseJsonArray() {
- ZoneScope zone_scope(DELETE_ON_EXIT);
+ ZoneScope zone_scope(isolate(), DELETE_ON_EXIT);
ZoneList<Handle<Object> > elements(4);
Token::Value token = scanner_.peek();
HandleScope hs;
JSFunction* func = JSFunction::cast(js_obj);
Context* context = func->context();
- ZoneScope zscope(DELETE_ON_EXIT);
+ ZoneScope zscope(Isolate::Current(), DELETE_ON_EXIT);
SerializedScopeInfo* serialized_scope_info =
context->closure()->shared()->scope_info();
ScopeInfo<ZoneListAllocationPolicy> zone_scope_info(serialized_scope_info);
int capture_count = regexp_handle->CaptureCount();
// CompiledReplacement uses zone allocation.
- CompilationZoneScope zone(DELETE_ON_EXIT);
+ CompilationZoneScope zone(isolate, DELETE_ON_EXIT);
CompiledReplacement compiled_replacement;
compiled_replacement.Compile(replacement_handle,
capture_count,
}
int length = subject->length();
- CompilationZoneScope zone_space(DELETE_ON_EXIT);
+ CompilationZoneScope zone_space(isolate, DELETE_ON_EXIT);
ZoneList<int> offsets(8);
do {
int start;
static const int kMaxInitialListCapacity = 16;
- ZoneScope scope(DELETE_ON_EXIT);
+ ZoneScope scope(isolate, DELETE_ON_EXIT);
// Find (up to limit) indices of separator and end-of-string in subject
int initial_capacity = Min<uint32_t>(kMaxInitialListCapacity, limit);
}
-void* ZoneListAllocationPolicy::New(int size) {
+inline void* ZoneListAllocationPolicy::New(int size) {
return ZONE->New(size);
}
}
-ZoneScope::ZoneScope(ZoneScopeMode mode)
- : isolate_(Isolate::Current()),
- mode_(mode) {
+ZoneScope::ZoneScope(Isolate* isolate, ZoneScopeMode mode)
+ : isolate_(isolate), mode_(mode) {
isolate_->zone()->scope_nesting_++;
}
class ZoneObject {
public:
// Allocate a new ZoneObject of 'size' bytes in the Zone.
- inline void* operator new(size_t size);
- inline void* operator new(size_t size, Zone* zone);
+ INLINE(void* operator new(size_t size));
+ INLINE(void* operator new(size_t size, Zone* zone));
// Ideally, the delete operator should be private instead of
// public, but unfortunately the compiler sometimes synthesizes
class ZoneListAllocationPolicy {
public:
// Allocate 'size' bytes of memory in the zone.
- static inline void* New(int size);
+ INLINE(static void* New(int size));
// De-allocation attempts are silently ignored.
static void Delete(void* p) { }
template<typename T>
class ZoneList: public List<T, ZoneListAllocationPolicy> {
public:
- inline void* operator new(size_t size);
- inline void* operator new(size_t size, Zone* zone);
+ INLINE(void* operator new(size_t size));
+ INLINE(void* operator new(size_t size, Zone* zone));
// Construct a new ZoneList with the given capacity; the length is
// always zero. The capacity must be non-negative.
// outer-most scope.
class ZoneScope BASE_EMBEDDED {
public:
- // TODO(isolates): pass isolate pointer here.
- inline explicit ZoneScope(ZoneScopeMode mode);
+ INLINE(ZoneScope(Isolate* isolate, ZoneScopeMode mode));
virtual ~ZoneScope();
List<AstNode*>* list = new List<AstNode*>(0);
CHECK_EQ(0, list->length());
- ZoneScope zone_scope(DELETE_ON_EXIT);
+ ZoneScope zone_scope(Isolate::Current(), DELETE_ON_EXIT);
AstNode* node = new EmptyStatement();
list->Add(node);
CHECK_EQ(1, list->length());
TEST(BitVector) {
v8::internal::V8::Initialize(NULL);
- ZoneScope zone(DELETE_ON_EXIT);
+ ZoneScope zone(Isolate::Current(), DELETE_ON_EXIT);
{
BitVector v(15);
v.Add(1);
v8::HandleScope scope;
LocalContext env;
- i::ZoneScope zn_scope(i::DELETE_ON_EXIT);
+ i::ZoneScope zn_scope(i::Isolate::Current(), i::DELETE_ON_EXIT);
JSObjectsRetainerTree tree;
JSObjectsCluster function(HEAP->function_class_symbol());
v8::HandleScope scope;
LocalContext env;
- i::ZoneScope zn_scope(i::DELETE_ON_EXIT);
+ i::ZoneScope zn_scope(i::Isolate::Current(), i::DELETE_ON_EXIT);
JSObjectsRetainerTree tree;
JSObjectsCluster function(HEAP->function_class_symbol());
v8::HandleScope scope;
LocalContext env;
- i::ZoneScope zn_scope(i::DELETE_ON_EXIT);
+ i::ZoneScope zn_scope(i::Isolate::Current(), i::DELETE_ON_EXIT);
JSObjectsRetainerTree tree;
v8::HandleScope scope;
LocalContext env;
- i::ZoneScope zn_scope(i::DELETE_ON_EXIT);
+ i::ZoneScope zn_scope(i::Isolate::Current(), i::DELETE_ON_EXIT);
JSObjectsRetainerTree tree;
int expected_diff_parameter = -1) {
StringCompareInput input(s1, s2);
- ZoneScope zone_scope(DELETE_ON_EXIT);
+ ZoneScope zone_scope(Isolate::Current(), DELETE_ON_EXIT);
DiffChunkStruct* first_chunk;
ListDiffOutputWriter writer(&first_chunk);
static bool CheckParse(const char* input) {
V8::Initialize(NULL);
v8::HandleScope scope;
- ZoneScope zone_scope(DELETE_ON_EXIT);
+ ZoneScope zone_scope(Isolate::Current(), DELETE_ON_EXIT);
FlatStringReader reader(Isolate::Current(), CStrVector(input));
RegExpCompileData result;
return v8::internal::RegExpParser::ParseRegExp(&reader, false, &result);
static SmartPointer<const char> Parse(const char* input) {
V8::Initialize(NULL);
v8::HandleScope scope;
- ZoneScope zone_scope(DELETE_ON_EXIT);
+ ZoneScope zone_scope(Isolate::Current(), DELETE_ON_EXIT);
FlatStringReader reader(Isolate::Current(), CStrVector(input));
RegExpCompileData result;
CHECK(v8::internal::RegExpParser::ParseRegExp(&reader, false, &result));
V8::Initialize(NULL);
v8::HandleScope scope;
unibrow::Utf8InputBuffer<> buffer(input, StrLength(input));
- ZoneScope zone_scope(DELETE_ON_EXIT);
+ ZoneScope zone_scope(Isolate::Current(), DELETE_ON_EXIT);
FlatStringReader reader(Isolate::Current(), CStrVector(input));
RegExpCompileData result;
CHECK(v8::internal::RegExpParser::ParseRegExp(&reader, false, &result));
V8::Initialize(NULL);
v8::HandleScope scope;
unibrow::Utf8InputBuffer<> buffer(input, StrLength(input));
- ZoneScope zone_scope(DELETE_ON_EXIT);
+ ZoneScope zone_scope(Isolate::Current(), DELETE_ON_EXIT);
FlatStringReader reader(Isolate::Current(), CStrVector(input));
RegExpCompileData result;
CHECK(v8::internal::RegExpParser::ParseRegExp(&reader, false, &result));
const char* expected) {
V8::Initialize(NULL);
v8::HandleScope scope;
- ZoneScope zone_scope(DELETE_ON_EXIT);
+ ZoneScope zone_scope(Isolate::Current(), DELETE_ON_EXIT);
FlatStringReader reader(Isolate::Current(), CStrVector(input));
RegExpCompileData result;
CHECK(!v8::internal::RegExpParser::ParseRegExp(&reader, false, &result));
static void TestCharacterClassEscapes(uc16 c, bool (pred)(uc16 c)) {
- ZoneScope scope(DELETE_ON_EXIT);
+ ZoneScope scope(Isolate::Current(), DELETE_ON_EXIT);
ZoneList<CharacterRange>* ranges = new ZoneList<CharacterRange>(2);
CharacterRange::AddClassEscape(c, ranges);
for (unsigned i = 0; i < (1 << 16); i++) {
bool is_ascii,
bool dot_output = false) {
v8::HandleScope scope;
- ZoneScope zone_scope(DELETE_ON_EXIT);
+ ZoneScope zone_scope(Isolate::Current(), DELETE_ON_EXIT);
RegExpNode* node = Compile(input, multiline, is_ascii);
USE(node);
#ifdef DEBUG
TEST(SplayTreeSimple) {
v8::internal::V8::Initialize(NULL);
static const unsigned kLimit = 1000;
- ZoneScope zone_scope(DELETE_ON_EXIT);
+ ZoneScope zone_scope(Isolate::Current(), DELETE_ON_EXIT);
ZoneSplayTree<TestConfig> tree;
bool seen[kLimit];
for (unsigned i = 0; i < kLimit; i++) seen[i] = false;
}
}
// Enter test data into dispatch table.
- ZoneScope zone_scope(DELETE_ON_EXIT);
+ ZoneScope zone_scope(Isolate::Current(), DELETE_ON_EXIT);
DispatchTable table;
for (int i = 0; i < kRangeCount; i++) {
uc16* range = ranges[i];
class ContextInitializer {
public:
ContextInitializer()
- : env_(), scope_(), zone_(DELETE_ON_EXIT) {
+ : env_(), scope_(), zone_(Isolate::Current(), DELETE_ON_EXIT) {
env_ = v8::Context::New();
env_->Enter();
}
static const int kLimit = 1000;
static const int kRangeCount = 16;
for (int t = 0; t < 10; t++) {
- ZoneScope zone_scope(DELETE_ON_EXIT);
+ ZoneScope zone_scope(Isolate::Current(), DELETE_ON_EXIT);
ZoneList<CharacterRange>* ranges =
new ZoneList<CharacterRange>(kRangeCount);
for (int i = 0; i < kRangeCount; i++) {
CHECK_EQ(is_on, set->Get(0) == false);
}
}
- ZoneScope zone_scope(DELETE_ON_EXIT);
+ ZoneScope zone_scope(Isolate::Current(), DELETE_ON_EXIT);
ZoneList<CharacterRange>* ranges =
new ZoneList<CharacterRange>(1);
ranges->Add(CharacterRange(0xFFF0, 0xFFFE));
static void TestRangeCaseIndependence(CharacterRange input,
Vector<CharacterRange> expected) {
- ZoneScope zone_scope(DELETE_ON_EXIT);
+ ZoneScope zone_scope(Isolate::Current(), DELETE_ON_EXIT);
int count = expected.length();
ZoneList<CharacterRange>* list = new ZoneList<CharacterRange>(count);
input.AddCaseEquivalents(list, false);
TEST(CharClassDifference) {
v8::internal::V8::Initialize(NULL);
- ZoneScope zone_scope(DELETE_ON_EXIT);
+ ZoneScope zone_scope(Isolate::Current(), DELETE_ON_EXIT);
ZoneList<CharacterRange>* base = new ZoneList<CharacterRange>(1);
base->Add(CharacterRange::Everything());
Vector<const uc16> overlay = CharacterRange::GetWordBounds();
TEST(CanonicalizeCharacterSets) {
v8::internal::V8::Initialize(NULL);
- ZoneScope scope(DELETE_ON_EXIT);
+ ZoneScope scope(Isolate::Current(), DELETE_ON_EXIT);
ZoneList<CharacterRange>* list = new ZoneList<CharacterRange>(4);
CharacterSet set(list);
TEST(CharacterRangeMerge) {
v8::internal::V8::Initialize(NULL);
- ZoneScope zone_scope(DELETE_ON_EXIT);
+ ZoneScope zone_scope(Isolate::Current(), DELETE_ON_EXIT);
ZoneList<CharacterRange> l1(4);
ZoneList<CharacterRange> l2(4);
// Create all combinations of intersections of ranges, both singletons and
InitializeVM();
v8::HandleScope scope;
Handle<String> building_blocks[NUMBER_OF_BUILDING_BLOCKS];
- ZoneScope zone(DELETE_ON_EXIT);
+ ZoneScope zone(Isolate::Current(), DELETE_ON_EXIT);
InitializeBuildingBlocks(building_blocks);
Handle<String> flat = ConstructBalanced(building_blocks);
FlattenString(flat);
TEST(ExternalShortStringAdd) {
- ZoneScope zone(DELETE_ON_EXIT);
+ ZoneScope zone(Isolate::Current(), DELETE_ON_EXIT);
InitializeVM();
v8::HandleScope handle_scope;
// We incorrectly allowed strings to be tagged as array indices even if their
// values didn't fit in the hash field.
// See http://code.google.com/p/v8/issues/detail?id=728
- ZoneScope zone(DELETE_ON_EXIT);
+ ZoneScope zone(Isolate::Current(), DELETE_ON_EXIT);
InitializeVM();
v8::HandleScope handle_scope;