Commit 8e9b934e authored by bmeurer@chromium.org's avatar bmeurer@chromium.org

Get rid of the ZoneScopeMode.

No one is using the DONT_DELETE_ON_EXIT mode for ZoneScopes anymore, so
we can safely assume that all ZoneScopes are DELETE_ON_EXIT now.

R=danno@chromium.org
BUG=

Review URL: https://codereview.chromium.org/17826004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15336 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 06200a31
......@@ -546,7 +546,7 @@ static bool DebuggerWantsEagerCompilation(CompilationInfo* info,
static Handle<SharedFunctionInfo> MakeFunctionInfo(CompilationInfo* info) {
Isolate* isolate = info->isolate();
ZoneScope zone_scope(info->zone(), DELETE_ON_EXIT);
ZoneScope zone_scope(info->zone());
PostponeInterruptsScope postpone(isolate);
ASSERT(!isolate->native_context().is_null());
......@@ -910,7 +910,7 @@ static bool InstallCodeFromOptimizedCodeMap(CompilationInfo* info) {
bool Compiler::CompileLazy(CompilationInfo* info) {
Isolate* isolate = info->isolate();
ZoneScope zone_scope(info->zone(), DELETE_ON_EXIT);
ZoneScope zone_scope(info->zone());
// The VM is in the COMPILER state until exiting this function.
VMState<COMPILER> state(isolate);
......@@ -1228,7 +1228,7 @@ void Compiler::RecordFunctionCompilation(Logger::LogEventsAndTags tag,
CompilationPhase::CompilationPhase(const char* name,
Isolate* isolate,
Zone* zone)
: name_(name), isolate_(isolate), zone_scope_(zone, DELETE_ON_EXIT) {
: name_(name), isolate_(isolate), zone_scope_(zone) {
if (FLAG_hydrogen_stats) {
start_allocation_size_ = zone->allocation_size();
start_ticks_ = OS::Ticks();
......
......@@ -441,22 +441,22 @@ class CompilationInfoWithZone: public CompilationInfo {
explicit CompilationInfoWithZone(Handle<Script> script)
: CompilationInfo(script, &zone_, &phase_zone_),
zone_(script->GetIsolate()),
zone_scope_(&zone_, DELETE_ON_EXIT),
zone_scope_(&zone_),
phase_zone_(script->GetIsolate()) {}
explicit CompilationInfoWithZone(Handle<SharedFunctionInfo> shared_info)
: CompilationInfo(shared_info, &zone_, &phase_zone_),
zone_(shared_info->GetIsolate()),
zone_scope_(&zone_, DELETE_ON_EXIT),
zone_scope_(&zone_),
phase_zone_(shared_info->GetIsolate()) {}
explicit CompilationInfoWithZone(Handle<JSFunction> closure)
: CompilationInfo(closure, &zone_, &phase_zone_),
zone_(closure->GetIsolate()),
zone_scope_(&zone_, DELETE_ON_EXIT),
zone_scope_(&zone_),
phase_zone_(closure->GetIsolate()) {}
CompilationInfoWithZone(HydrogenCodeStub* stub, Isolate* isolate)
: CompilationInfo(stub, isolate, &zone_, &phase_zone_),
zone_(isolate),
zone_scope_(&zone_, DELETE_ON_EXIT),
zone_scope_(&zone_),
phase_zone_(isolate) {}
// Virtual destructor because a CompilationInfoWithZone has to exit the
......
......@@ -284,7 +284,7 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
void Deoptimizer::VisitAllOptimizedFunctionsForContext(
Context* context, OptimizedFunctionVisitor* visitor) {
Isolate* isolate = context->GetIsolate();
ZoneScope zone_scope(isolate->runtime_zone(), DELETE_ON_EXIT);
ZoneScope zone_scope(isolate->runtime_zone());
DisallowHeapAllocation no_allocation;
ASSERT(context->IsNativeContext());
......@@ -421,7 +421,7 @@ void Deoptimizer::DeoptimizeFunction(JSFunction* function) {
Isolate* isolate = context->GetIsolate();
Object* undefined = isolate->heap()->undefined_value();
Zone* zone = isolate->runtime_zone();
ZoneScope zone_scope(zone, DELETE_ON_EXIT);
ZoneScope zone_scope(zone);
ZoneList<Code*> codes(1, zone);
DeoptimizeWithMatchingCodeFilter filter(code);
PartitionOptimizedFunctions(context, &filter, &codes, zone, undefined);
......@@ -438,7 +438,7 @@ void Deoptimizer::DeoptimizeAllFunctionsForContext(
Isolate* isolate = context->GetIsolate();
Object* undefined = isolate->heap()->undefined_value();
Zone* zone = isolate->runtime_zone();
ZoneScope zone_scope(zone, DELETE_ON_EXIT);
ZoneScope zone_scope(zone);
ZoneList<Code*> codes(1, zone);
PartitionOptimizedFunctions(context, filter, &codes, zone, undefined);
for (int i = 0; i < codes.length(); ++i) {
......
......@@ -1917,7 +1917,7 @@ static void UnregisterCodeEntry(JITCodeEntry* entry) {
static JITCodeEntry* CreateELFObject(CodeDescription* desc, Zone* zone) {
ZoneScope zone_scope(zone, DELETE_ON_EXIT);
ZoneScope zone_scope(zone);
#ifdef __MACH_O
MachO mach_o;
Writer w(&mach_o);
......
......@@ -37,7 +37,7 @@ EnvironmentSlotLivenessAnalyzer::EnvironmentSlotLivenessAnalyzer(
HGraph* graph)
: graph_(graph),
zone_(graph->isolate()),
zone_scope_(&zone_, DELETE_ON_EXIT),
zone_scope_(&zone_),
block_count_(graph->blocks()->length()),
maximum_environment_size_(graph->maximum_environment_size()),
collect_markers_(true),
......
......@@ -366,7 +366,7 @@ HGlobalValueNumberer::HGlobalValueNumberer(HGraph* graph, CompilationInfo* info)
info_(info),
removed_side_effects_(false),
phase_zone_(info->phase_zone()),
phase_zone_scope_(phase_zone_, DELETE_ON_EXIT),
phase_zone_scope_(phase_zone_),
block_side_effects_(graph->blocks()->length(), phase_zone_),
loop_side_effects_(graph->blocks()->length(), phase_zone_),
visited_on_paths_(phase_zone_, graph->blocks()->length()) {
......
......@@ -323,7 +323,7 @@ Handle<Object> JsonParser<seq_ascii>::ParseJsonObject() {
Handle<JSObject> json_object =
factory()->NewJSObject(object_constructor(), pretenure_);
Handle<Map> map(json_object->map());
ZoneScope zone_scope(zone(), DELETE_ON_EXIT);
ZoneScope zone_scope(zone());
ZoneList<Handle<Object> > properties(8, zone());
ASSERT_EQ(c0_, '{');
......@@ -469,7 +469,7 @@ Handle<Object> JsonParser<seq_ascii>::ParseJsonObject() {
template <bool seq_ascii>
Handle<Object> JsonParser<seq_ascii>::ParseJsonArray() {
HandleScope scope(isolate());
ZoneScope zone_scope(zone(), DELETE_ON_EXIT);
ZoneScope zone_scope(zone());
ZoneList<Handle<Object> > elements(4, zone());
ASSERT_EQ(c0_, '[');
......
......@@ -170,7 +170,7 @@ Handle<Object> RegExpImpl::Compile(Handle<JSRegExp> re,
Handle<String> pattern,
Handle<String> flag_str,
Zone* zone) {
ZoneScope zone_scope(zone, DELETE_ON_EXIT);
ZoneScope zone_scope(zone);
Isolate* isolate = re->GetIsolate();
JSRegExp::Flags flags = RegExpFlagsFromString(flag_str);
CompilationCache* compilation_cache = isolate->compilation_cache();
......@@ -410,7 +410,7 @@ bool RegExpImpl::CompileIrregexp(Handle<JSRegExp> re,
bool is_ascii) {
// Compile the RegExp.
Isolate* isolate = re->GetIsolate();
ZoneScope zone_scope(isolate->runtime_zone(), DELETE_ON_EXIT);
ZoneScope zone_scope(isolate->runtime_zone());
PostponeInterruptsScope postpone(isolate);
// If we had a compilation error the last time this is saved at the
// saved code index.
......
......@@ -1835,7 +1835,7 @@ static const char* DropActivationsInActiveThreadImpl(
TARGET& target, bool do_drop, Zone* zone) {
Isolate* isolate = Isolate::Current();
Debug* debug = isolate->debug();
ZoneScope scope(zone, DELETE_ON_EXIT);
ZoneScope scope(zone);
Vector<StackFrame*> frames = CreateStackMap(isolate, zone);
......
......@@ -3601,7 +3601,7 @@ MUST_USE_RESULT static MaybeObject* StringReplaceGlobalAtomRegExpWithString(
ASSERT(replacement->IsFlat());
Zone* zone = isolate->runtime_zone();
ZoneScope zone_space(zone, DELETE_ON_EXIT);
ZoneScope zone_space(zone);
ZoneList<int> indices(8, zone);
ASSERT_EQ(JSRegExp::ATOM, pattern_regexp->TypeTag());
String* pattern =
......@@ -3688,7 +3688,7 @@ MUST_USE_RESULT static MaybeObject* StringReplaceGlobalRegExpWithString(
// CompiledReplacement uses zone allocation.
Zone* zone = isolate->runtime_zone();
ZoneScope zonescope(zone, DELETE_ON_EXIT);
ZoneScope zonescope(zone);
CompiledReplacement compiled_replacement(zone);
bool simple_replace = compiled_replacement.Compile(replacement,
capture_count,
......@@ -4223,7 +4223,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringMatch) {
int capture_count = regexp->CaptureCount();
Zone* zone = isolate->runtime_zone();
ZoneScope zone_space(zone, DELETE_ON_EXIT);
ZoneScope zone_space(zone);
ZoneList<int> offsets(8, zone);
while (true) {
......@@ -6316,7 +6316,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringSplit) {
static const int kMaxInitialListCapacity = 16;
Zone* zone = isolate->runtime_zone();
ZoneScope scope(zone, DELETE_ON_EXIT);
ZoneScope scope(zone);
// Find (up to limit) indices of separator and end-of-string in subject
int initial_capacity = Min<uint32_t>(kMaxInitialListCapacity, limit);
......
......@@ -110,14 +110,14 @@ void* ZoneList<T>::operator new(size_t size, Zone* zone) {
}
ZoneScope::ZoneScope(Zone* zone, ZoneScopeMode mode)
: zone_(zone), mode_(mode) {
ZoneScope::ZoneScope(Zone* zone)
: zone_(zone) {
zone_->scope_nesting_++;
}
bool ZoneScope::ShouldDeleteOnExit() {
return zone_->scope_nesting_ == 1 && mode_ == DELETE_ON_EXIT;
return zone_->scope_nesting_ == 1;
}
......
......@@ -39,13 +39,6 @@ namespace v8 {
namespace internal {
// Zone scopes are in one of two modes. Either they delete the zone
// on exit or they do not.
enum ZoneScopeMode {
DELETE_ON_EXIT,
DONT_DELETE_ON_EXIT
};
class Segment;
class Isolate;
......@@ -237,7 +230,7 @@ class ZoneList: public List<T, ZoneAllocationPolicy> {
// outer-most scope.
class ZoneScope BASE_EMBEDDED {
public:
INLINE(ZoneScope(Zone* zone, ZoneScopeMode mode));
INLINE(ZoneScope(Zone* zone));
virtual ~ZoneScope();
......@@ -245,17 +238,10 @@ class ZoneScope BASE_EMBEDDED {
inline bool ShouldDeleteOnExit();
// For ZoneScopes that do not delete on exit by default, call this
// method to request deletion on exit.
void DeleteOnExit() {
mode_ = DELETE_ON_EXIT;
}
inline static int nesting();
private:
Zone* zone_;
ZoneScopeMode mode_;
};
......
......@@ -41,7 +41,7 @@ TEST(List) {
Isolate* isolate = Isolate::Current();
Zone* zone = isolate->runtime_zone();
ZoneScope zone_scope(zone, DELETE_ON_EXIT);
ZoneScope zone_scope(zone);
AstNodeFactory<AstNullVisitor> factory(isolate, zone);
AstNode* node = factory.NewEmptyStatement();
list->Add(node);
......
......@@ -37,7 +37,7 @@ using namespace v8::internal;
TEST(BitVector) {
v8::internal::V8::Initialize(NULL);
Zone* zone = Isolate::Current()->runtime_zone();
ZoneScope zone_scope(zone, DELETE_ON_EXIT);
ZoneScope zone_scope(zone);
{
BitVector v(15, zone);
v.Add(1);
......
......@@ -96,7 +96,7 @@ void CompareStringsOneWay(const char* s1, const char* s2,
int expected_diff_parameter = -1) {
StringCompareInput input(s1, s2);
ZoneScope zone_scope(Isolate::Current()->runtime_zone(), DELETE_ON_EXIT);
ZoneScope zone_scope(Isolate::Current()->runtime_zone());
DiffChunkStruct* first_chunk;
ListDiffOutputWriter writer(&first_chunk);
......
......@@ -72,7 +72,7 @@ using namespace v8::internal;
static bool CheckParse(const char* input) {
V8::Initialize(NULL);
v8::HandleScope scope(v8::Isolate::GetCurrent());
ZoneScope zone_scope(Isolate::Current()->runtime_zone(), DELETE_ON_EXIT);
ZoneScope zone_scope(Isolate::Current()->runtime_zone());
FlatStringReader reader(Isolate::Current(), CStrVector(input));
RegExpCompileData result;
return v8::internal::RegExpParser::ParseRegExp(
......@@ -83,7 +83,7 @@ static bool CheckParse(const char* input) {
static SmartArrayPointer<const char> Parse(const char* input) {
V8::Initialize(NULL);
v8::HandleScope scope(v8::Isolate::GetCurrent());
ZoneScope zone_scope(Isolate::Current()->runtime_zone(), DELETE_ON_EXIT);
ZoneScope zone_scope(Isolate::Current()->runtime_zone());
FlatStringReader reader(Isolate::Current(), CStrVector(input));
RegExpCompileData result;
CHECK(v8::internal::RegExpParser::ParseRegExp(
......@@ -98,7 +98,7 @@ static SmartArrayPointer<const char> Parse(const char* input) {
static bool CheckSimple(const char* input) {
V8::Initialize(NULL);
v8::HandleScope scope(v8::Isolate::GetCurrent());
ZoneScope zone_scope(Isolate::Current()->runtime_zone(), DELETE_ON_EXIT);
ZoneScope zone_scope(Isolate::Current()->runtime_zone());
FlatStringReader reader(Isolate::Current(), CStrVector(input));
RegExpCompileData result;
CHECK(v8::internal::RegExpParser::ParseRegExp(
......@@ -116,7 +116,7 @@ struct MinMaxPair {
static MinMaxPair CheckMinMaxMatch(const char* input) {
V8::Initialize(NULL);
v8::HandleScope scope(v8::Isolate::GetCurrent());
ZoneScope zone_scope(Isolate::Current()->runtime_zone(), DELETE_ON_EXIT);
ZoneScope zone_scope(Isolate::Current()->runtime_zone());
FlatStringReader reader(Isolate::Current(), CStrVector(input));
RegExpCompileData result;
CHECK(v8::internal::RegExpParser::ParseRegExp(
......@@ -389,7 +389,7 @@ static void ExpectError(const char* input,
const char* expected) {
V8::Initialize(NULL);
v8::HandleScope scope(v8::Isolate::GetCurrent());
ZoneScope zone_scope(Isolate::Current()->runtime_zone(), DELETE_ON_EXIT);
ZoneScope zone_scope(Isolate::Current()->runtime_zone());
FlatStringReader reader(Isolate::Current(), CStrVector(input));
RegExpCompileData result;
CHECK(!v8::internal::RegExpParser::ParseRegExp(
......@@ -473,7 +473,7 @@ static bool NotWord(uc16 c) {
static void TestCharacterClassEscapes(uc16 c, bool (pred)(uc16 c)) {
ZoneScope scope(Isolate::Current()->runtime_zone(), DELETE_ON_EXIT);
ZoneScope scope(Isolate::Current()->runtime_zone());
Zone* zone = Isolate::Current()->runtime_zone();
ZoneList<CharacterRange>* ranges =
new(zone) ZoneList<CharacterRange>(2, zone);
......@@ -531,7 +531,7 @@ static void Execute(const char* input,
bool is_ascii,
bool dot_output = false) {
v8::HandleScope scope(v8::Isolate::GetCurrent());
ZoneScope zone_scope(Isolate::Current()->runtime_zone(), DELETE_ON_EXIT);
ZoneScope zone_scope(Isolate::Current()->runtime_zone());
RegExpNode* node = Compile(input, multiline, is_ascii);
USE(node);
#ifdef DEBUG
......@@ -571,7 +571,7 @@ static unsigned PseudoRandom(int i, int j) {
TEST(SplayTreeSimple) {
v8::internal::V8::Initialize(NULL);
static const unsigned kLimit = 1000;
ZoneScope zone_scope(Isolate::Current()->runtime_zone(), DELETE_ON_EXIT);
ZoneScope zone_scope(Isolate::Current()->runtime_zone());
ZoneSplayTree<TestConfig> tree(Isolate::Current()->runtime_zone());
bool seen[kLimit];
for (unsigned i = 0; i < kLimit; i++) seen[i] = false;
......@@ -639,7 +639,7 @@ TEST(DispatchTableConstruction) {
}
}
// Enter test data into dispatch table.
ZoneScope zone_scope(Isolate::Current()->runtime_zone(), DELETE_ON_EXIT);
ZoneScope zone_scope(Isolate::Current()->runtime_zone());
DispatchTable table(Isolate::Current()->runtime_zone());
for (int i = 0; i < kRangeCount; i++) {
uc16* range = ranges[i];
......@@ -709,7 +709,7 @@ class ContextInitializer {
ContextInitializer()
: scope_(v8::Isolate::GetCurrent()),
env_(v8::Context::New(v8::Isolate::GetCurrent())),
zone_(Isolate::Current()->runtime_zone(), DELETE_ON_EXIT) {
zone_(Isolate::Current()->runtime_zone()) {
env_->Enter();
}
~ContextInitializer() {
......@@ -1428,7 +1428,7 @@ TEST(AddInverseToTable) {
static const int kLimit = 1000;
static const int kRangeCount = 16;
for (int t = 0; t < 10; t++) {
ZoneScope zone_scope(Isolate::Current()->runtime_zone(), DELETE_ON_EXIT);
ZoneScope zone_scope(Isolate::Current()->runtime_zone());
Zone* zone = Isolate::Current()->runtime_zone();
ZoneList<CharacterRange>* ranges =
new(zone)
......@@ -1452,7 +1452,7 @@ TEST(AddInverseToTable) {
CHECK_EQ(is_on, set->Get(0) == false);
}
}
ZoneScope zone_scope(Isolate::Current()->runtime_zone(), DELETE_ON_EXIT);
ZoneScope zone_scope(Isolate::Current()->runtime_zone());
Zone* zone = Isolate::Current()->runtime_zone();
ZoneList<CharacterRange>* ranges =
new(zone) ZoneList<CharacterRange>(1, zone);
......@@ -1567,7 +1567,7 @@ TEST(UncanonicalizeEquivalence) {
static void TestRangeCaseIndependence(CharacterRange input,
Vector<CharacterRange> expected) {
ZoneScope zone_scope(Isolate::Current()->runtime_zone(), DELETE_ON_EXIT);
ZoneScope zone_scope(Isolate::Current()->runtime_zone());
Zone* zone = Isolate::Current()->runtime_zone();
int count = expected.length();
ZoneList<CharacterRange>* list =
......@@ -1633,7 +1633,7 @@ static bool InClass(uc16 c, ZoneList<CharacterRange>* ranges) {
TEST(CharClassDifference) {
v8::internal::V8::Initialize(NULL);
ZoneScope zone_scope(Isolate::Current()->runtime_zone(), DELETE_ON_EXIT);
ZoneScope zone_scope(Isolate::Current()->runtime_zone());
Zone* zone = Isolate::Current()->runtime_zone();
ZoneList<CharacterRange>* base =
new(zone) ZoneList<CharacterRange>(1, zone);
......@@ -1663,7 +1663,7 @@ TEST(CharClassDifference) {
TEST(CanonicalizeCharacterSets) {
v8::internal::V8::Initialize(NULL);
ZoneScope scope(Isolate::Current()->runtime_zone(), DELETE_ON_EXIT);
ZoneScope scope(Isolate::Current()->runtime_zone());
Zone* zone = Isolate::Current()->runtime_zone();
ZoneList<CharacterRange>* list =
new(zone) ZoneList<CharacterRange>(4, zone);
......@@ -1726,7 +1726,7 @@ TEST(CanonicalizeCharacterSets) {
TEST(CharacterRangeMerge) {
v8::internal::V8::Initialize(NULL);
ZoneScope zone_scope(Isolate::Current()->runtime_zone(), DELETE_ON_EXIT);
ZoneScope zone_scope(Isolate::Current()->runtime_zone());
ZoneList<CharacterRange> l1(4, Isolate::Current()->runtime_zone());
ZoneList<CharacterRange> l2(4, Isolate::Current()->runtime_zone());
Zone* zone = Isolate::Current()->runtime_zone();
......
......@@ -570,7 +570,7 @@ TEST(Traverse) {
printf("TestTraverse\n");
CcTest::InitializeVM();
v8::HandleScope scope(CcTest::isolate());
ZoneScope zone(Isolate::Current()->runtime_zone(), DELETE_ON_EXIT);
ZoneScope zone(Isolate::Current()->runtime_zone());
ConsStringGenerationData data(false);
Handle<String> flat = ConstructBalanced(&data);
FlattenString(flat);
......@@ -660,7 +660,7 @@ void TestStringCharacterStream(BuildString build, int test_cases) {
CcTest::InitializeVM();
Isolate* isolate = Isolate::Current();
HandleScope outer_scope(isolate);
ZoneScope zone(Isolate::Current()->runtime_zone(), DELETE_ON_EXIT);
ZoneScope zone(Isolate::Current()->runtime_zone());
ConsStringGenerationData data(true);
for (int i = 0; i < test_cases; i++) {
printf("%d\n", i);
......@@ -929,7 +929,7 @@ TEST(Utf8Conversion) {
TEST(ExternalShortStringAdd) {
ZoneScope zonescope(Isolate::Current()->runtime_zone(), DELETE_ON_EXIT);
ZoneScope zonescope(Isolate::Current()->runtime_zone());
CcTest::InitializeVM();
v8::HandleScope handle_scope(CcTest::isolate());
......@@ -1021,7 +1021,7 @@ TEST(CachedHashOverflow) {
// values didn't fit in the hash field.
// See http://code.google.com/p/v8/issues/detail?id=728
Isolate* isolate = Isolate::Current();
ZoneScope zone(isolate->runtime_zone(), DELETE_ON_EXIT);
ZoneScope zone(isolate->runtime_zone());
CcTest::InitializeVM();
v8::HandleScope handle_scope(CcTest::isolate());
......
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