Commit 179702df authored by vitalyr@chromium.org's avatar vitalyr@chromium.org

Inline more zone stuff.

R=ager@chromium.org

Review URL: http://codereview.chromium.org/7066004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8009 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent b082e6cc
......@@ -337,9 +337,8 @@ bool Compiler::MakeCodeForLiveEdit(CompilationInfo* info) {
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());
......@@ -571,12 +570,13 @@ Handle<SharedFunctionInfo> Compiler::CompileEval(Handle<String> source,
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();
......
......@@ -294,7 +294,9 @@ class Compiler : public AllStatic {
// 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();
......
......@@ -474,7 +474,7 @@ const JSObjectsClusterTreeConfig::Value JSObjectsClusterTreeConfig::kNoValue;
ConstructorHeapProfile::ConstructorHeapProfile()
: zscope_(DELETE_ON_EXIT) {
: zscope_(Isolate::Current(), DELETE_ON_EXIT) {
}
......@@ -584,7 +584,7 @@ inline int ClustersCoarser::ClusterBackRefs::Compare(
ClustersCoarser::ClustersCoarser()
: zscope_(DELETE_ON_EXIT),
: zscope_(Isolate::Current(), DELETE_ON_EXIT),
sim_list_(ClustersCoarser::kInitialSimilarityListCapacity),
current_pair_(NULL),
current_set_(NULL),
......@@ -699,7 +699,7 @@ const JSObjectsRetainerTreeConfig::Value JSObjectsRetainerTreeConfig::kNoValue =
RetainerHeapProfile::RetainerHeapProfile()
: zscope_(DELETE_ON_EXIT),
: zscope_(Isolate::Current(), DELETE_ON_EXIT),
aggregator_(NULL) {
JSObjectsCluster roots(JSObjectsCluster::ROOTS);
ReferencesExtractor extractor(roots, this);
......@@ -1027,7 +1027,7 @@ class AggregatingRetainerTreeIterator {
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_);
......
......@@ -127,7 +127,7 @@ Handle<Object> RegExpImpl::Compile(Handle<JSRegExp> re,
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);
......@@ -302,7 +302,7 @@ bool RegExpImpl::EnsureCompiledIrregexp(Handle<JSRegExp> re, bool is_ascii) {
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()) {
......
......@@ -814,7 +814,7 @@ class FunctionInfoListener {
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());
......@@ -908,7 +908,7 @@ static void ReplaceCodeObject(Code* original, Code* substitution) {
AssertNoAllocation no_allocations_please;
// A zone scope for ReferenceCollectorVisitor.
ZoneScope scope(DELETE_ON_EXIT);
ZoneScope scope(Isolate::Current(), DELETE_ON_EXIT);
ReferenceCollectorVisitor visitor(original);
......@@ -1458,8 +1458,9 @@ static bool IsDropableFrame(StackFrame* frame) {
// 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();
......
......@@ -592,7 +592,7 @@ Parser::Parser(Handle<Script> script,
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());
......@@ -674,7 +674,7 @@ FunctionLiteral* Parser::DoParseProgram(Handle<String> source,
}
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());
......@@ -4179,7 +4179,7 @@ Handle<Object> JsonParser::ParseJsonObject() {
// 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();
......
......@@ -1907,7 +1907,7 @@ void V8HeapExplorer::ExtractClosureReferences(JSObject* js_obj,
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);
......
......@@ -2613,7 +2613,7 @@ MUST_USE_RESULT static MaybeObject* StringReplaceRegExpWithString(
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,
......@@ -3127,7 +3127,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringMatch) {
}
int length = subject->length();
CompilationZoneScope zone_space(DELETE_ON_EXIT);
CompilationZoneScope zone_space(isolate, DELETE_ON_EXIT);
ZoneList<int> offsets(8);
do {
int start;
......@@ -5601,7 +5601,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringSplit) {
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);
......
......@@ -102,7 +102,7 @@ void* ZoneObject::operator new(size_t size, Zone* zone) {
}
void* ZoneListAllocationPolicy::New(int size) {
inline void* ZoneListAllocationPolicy::New(int size) {
return ZONE->New(size);
}
......@@ -119,9 +119,8 @@ void* ZoneList<T>::operator new(size_t size, Zone* zone) {
}
ZoneScope::ZoneScope(ZoneScopeMode mode)
: isolate_(Isolate::Current()),
mode_(mode) {
ZoneScope::ZoneScope(Isolate* isolate, ZoneScopeMode mode)
: isolate_(isolate), mode_(mode) {
isolate_->zone()->scope_nesting_++;
}
......
......@@ -134,8 +134,8 @@ class Zone {
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
......@@ -164,7 +164,7 @@ class AssertNoZoneAllocation {
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) { }
......@@ -178,8 +178,8 @@ class ZoneListAllocationPolicy {
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.
......@@ -203,8 +203,7 @@ typedef ZoneList<Handle<Map> > ZoneMapList;
// 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();
......
......@@ -39,7 +39,7 @@ TEST(List) {
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());
......
......@@ -36,7 +36,7 @@ using namespace v8::internal;
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);
......
......@@ -142,7 +142,7 @@ TEST(ClustersCoarserSimple) {
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());
......@@ -180,7 +180,7 @@ TEST(ClustersCoarserMultipleConstructors) {
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());
......@@ -210,7 +210,7 @@ TEST(ClustersCoarserPathsTraversal) {
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;
......@@ -262,7 +262,7 @@ TEST(ClustersCoarserSelf) {
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;
......
......@@ -95,7 +95,7 @@ void CompareStringsOneWay(const char* s1, const char* s2,
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);
......
......@@ -65,7 +65,7 @@ using namespace v8::internal;
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);
......@@ -75,7 +75,7 @@ static bool CheckParse(const char* input) {
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));
......@@ -89,7 +89,7 @@ static bool CheckSimple(const char* input) {
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));
......@@ -107,7 +107,7 @@ static MinMaxPair CheckMinMaxMatch(const char* input) {
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));
......@@ -378,7 +378,7 @@ static void ExpectError(const char* input,
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));
......@@ -460,7 +460,7 @@ static bool NotWord(uc16 c) {
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++) {
......@@ -506,7 +506,7 @@ static void Execute(const char* input,
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
......@@ -547,7 +547,7 @@ static unsigned PseudoRandom(int i, int j) {
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;
......@@ -615,7 +615,7 @@ TEST(DispatchTableConstruction) {
}
}
// 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];
......@@ -682,7 +682,7 @@ typedef RegExpMacroAssemblerMIPS ArchRegExpMacroAssembler;
class ContextInitializer {
public:
ContextInitializer()
: env_(), scope_(), zone_(DELETE_ON_EXIT) {
: env_(), scope_(), zone_(Isolate::Current(), DELETE_ON_EXIT) {
env_ = v8::Context::New();
env_->Enter();
}
......@@ -1377,7 +1377,7 @@ TEST(AddInverseToTable) {
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++) {
......@@ -1398,7 +1398,7 @@ TEST(AddInverseToTable) {
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));
......@@ -1511,7 +1511,7 @@ TEST(UncanonicalizeEquivalence) {
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);
......@@ -1575,7 +1575,7 @@ static bool InClass(uc16 c, ZoneList<CharacterRange>* ranges) {
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();
......@@ -1602,7 +1602,7 @@ TEST(CharClassDifference) {
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);
......@@ -1673,7 +1673,7 @@ static bool CharacterInSet(ZoneList<CharacterRange>* set, uc16 value) {
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
......
......@@ -233,7 +233,7 @@ TEST(Traverse) {
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);
......@@ -348,7 +348,7 @@ TEST(Utf8Conversion) {
TEST(ExternalShortStringAdd) {
ZoneScope zone(DELETE_ON_EXIT);
ZoneScope zone(Isolate::Current(), DELETE_ON_EXIT);
InitializeVM();
v8::HandleScope handle_scope;
......@@ -439,7 +439,7 @@ TEST(CachedHashOverflow) {
// 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;
......
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