Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(465)

Unified Diff: src/runtime.cc

Issue 10534139: One Zone per CompilationInfo. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index 9e389492eca14cf87aec73a292b6a4794bd21e3e..6669fa1d9b246633631dc8f48cc3faffd2a8ee8a 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -1188,7 +1188,9 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpCompile) {
CONVERT_ARG_HANDLE_CHECKED(JSRegExp, re, 0);
CONVERT_ARG_HANDLE_CHECKED(String, pattern, 1);
CONVERT_ARG_HANDLE_CHECKED(String, flags, 2);
- Handle<Object> result = RegExpImpl::Compile(re, pattern, flags);
+ ZoneScope zone_scope(isolate->runtime_zone(), DELETE_ON_EXIT);
danno 2012/06/14 14:22:19 Why new new ZoneScope here?
sanjoy 2012/06/15 09:24:31 This runtime function is sometimes called without
+ Handle<Object> result =
+ RegExpImpl::Compile(re, pattern, flags, isolate->runtime_zone());
if (result.is_null()) return Failure::Exception();
return *result;
}
@@ -1749,7 +1751,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpExec) {
subject,
index,
last_match_info,
- isolate->zone());
+ isolate->runtime_zone());
if (result.is_null()) return Failure::Exception();
return *result;
}
@@ -2989,8 +2991,8 @@ MUST_USE_RESULT static MaybeObject* StringReplaceAtomRegExpWithString(
ASSERT(subject->IsFlat());
ASSERT(replacement->IsFlat());
- ZoneScope zone_space(isolate, DELETE_ON_EXIT);
- ZoneList<int> indices(8, isolate->zone());
+ ZoneScope zone_space(isolate->runtime_zone(), DELETE_ON_EXIT);
+ ZoneList<int> indices(8, isolate->runtime_zone());
ASSERT_EQ(JSRegExp::ATOM, pattern_regexp->TypeTag());
String* pattern =
String::cast(pattern_regexp->DataAt(JSRegExp::kAtomPatternIndex));
@@ -3084,7 +3086,7 @@ MUST_USE_RESULT static MaybeObject* StringReplaceRegExpWithString(
subject_handle,
0,
last_match_info_handle,
- isolate->zone());
+ zone);
if (match.is_null()) {
return Failure::Exception();
}
@@ -3095,8 +3097,8 @@ MUST_USE_RESULT static MaybeObject* StringReplaceRegExpWithString(
int capture_count = regexp_handle->CaptureCount();
// CompiledReplacement uses zone allocation.
- ZoneScope zonescope(isolate, DELETE_ON_EXIT);
- CompiledReplacement compiled_replacement(isolate->zone());
+ ZoneScope zonescope(zone, DELETE_ON_EXIT);
+ CompiledReplacement compiled_replacement(zone);
compiled_replacement.Compile(replacement_handle,
capture_count,
length);
@@ -3186,7 +3188,7 @@ MUST_USE_RESULT static MaybeObject* StringReplaceRegExpWithString(
subject_handle,
next,
last_match_info_handle,
- isolate->zone());
+ zone);
if (match.is_null()) {
return Failure::Exception();
}
@@ -3243,7 +3245,7 @@ MUST_USE_RESULT static MaybeObject* StringReplaceRegExpWithEmptyString(
subject_handle,
0,
last_match_info_handle,
- isolate->zone());
+ zone);
if (match.is_null()) return Failure::Exception();
if (match->IsNull()) return *subject_handle;
@@ -3318,7 +3320,7 @@ MUST_USE_RESULT static MaybeObject* StringReplaceRegExpWithEmptyString(
subject_handle,
next,
last_match_info_handle,
- isolate->zone());
+ zone);
if (match.is_null()) return Failure::Exception();
if (match->IsNull()) break;
@@ -3394,7 +3396,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringReplaceRegExpWithString) {
ASSERT(last_match_info->HasFastObjectElements());
- Zone* zone = isolate->zone();
+ Zone* zone = isolate->runtime_zone();
if (replacement->length() == 0) {
if (subject->HasOnlyAsciiChars()) {
return StringReplaceRegExpWithEmptyString<SeqAsciiString>(
@@ -3733,8 +3735,9 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringMatch) {
CONVERT_ARG_HANDLE_CHECKED(JSArray, regexp_info, 2);
HandleScope handles;
+ Zone* zone = isolate->runtime_zone();
Handle<Object> match = RegExpImpl::Exec(regexp, subject, 0, regexp_info,
- isolate->zone());
+ zone);
if (match.is_null()) {
return Failure::Exception();
@@ -3744,8 +3747,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringMatch) {
}
int length = subject->length();
- Zone* zone = isolate->zone();
- ZoneScope zone_space(isolate, DELETE_ON_EXIT);
+ ZoneScope zone_space(zone, DELETE_ON_EXIT);
ZoneList<int> offsets(8, zone);
int start;
int end;
@@ -3760,7 +3762,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringMatch) {
offsets.Add(end, zone);
if (start == end) if (++end > length) break;
match = RegExpImpl::Exec(regexp, subject, end, regexp_info,
- isolate->zone());
+ zone);
if (match.is_null()) {
return Failure::Exception();
}
@@ -3855,11 +3857,12 @@ static int SearchRegExpNoCaptureMultiple(
FixedArrayBuilder* builder) {
ASSERT(subject->IsFlat());
ASSERT(regexp->CaptureCount() == 0);
+ Zone* zone = isolate->runtime_zone();
int match_start = -1;
int match_end = 0;
int pos = 0;
int registers_per_match = RegExpImpl::IrregexpPrepare(regexp, subject,
- isolate->zone());
+ zone);
if (registers_per_match < 0) return RegExpImpl::RE_EXCEPTION;
int max_matches;
@@ -3875,7 +3878,7 @@ static int SearchRegExpNoCaptureMultiple(
subject,
pos,
register_vector,
- isolate->zone());
+ zone);
if (num_matches > 0) {
for (int match_index = 0; match_index < num_matches; match_index++) {
int32_t* current_match = &register_vector[match_index * 2];
@@ -3942,11 +3945,12 @@ static int SearchRegExpMultiple(
Handle<String> subject,
Handle<JSRegExp> regexp,
Handle<JSArray> last_match_array,
- FixedArrayBuilder* builder) {
+ FixedArrayBuilder* builder,
+ Zone* zone) {
ASSERT(subject->IsFlat());
int registers_per_match = RegExpImpl::IrregexpPrepare(regexp, subject,
- isolate->zone());
+ zone);
if (registers_per_match < 0) return RegExpImpl::RE_EXCEPTION;
int max_matches;
@@ -3960,7 +3964,7 @@ static int SearchRegExpMultiple(
subject,
0,
register_vector,
- isolate->zone());
+ zone);
int capture_count = regexp->CaptureCount();
int subject_length = subject->length();
@@ -4047,7 +4051,7 @@ static int SearchRegExpMultiple(
subject,
pos,
register_vector,
- isolate->zone());
+ zone);
} while (num_matches > 0);
if (num_matches != RegExpImpl::RE_EXCEPTION) {
@@ -4128,7 +4132,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpExecMultiple) {
subject,
regexp,
last_match_info,
- &builder);
+ &builder,
+ isolate->runtime_zone());
}
if (result == RegExpImpl::RE_SUCCESS) return *builder.ToJSArray(result_array);
if (result == RegExpImpl::RE_FAILURE) return isolate->heap()->null_value();
@@ -6463,8 +6468,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringSplit) {
static const int kMaxInitialListCapacity = 16;
- Zone* zone = isolate->zone();
- ZoneScope scope(isolate, DELETE_ON_EXIT);
+ Zone* zone = isolate->runtime_zone();
+ ZoneScope scope(zone, DELETE_ON_EXIT);
// Find (up to limit) indices of separator and end-of-string in subject
int initial_capacity = Min<uint32_t>(kMaxInitialListCapacity, limit);
@@ -9313,7 +9318,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_ParseJson) {
ASSERT_EQ(1, args.length());
CONVERT_ARG_HANDLE_CHECKED(String, source, 0);
- Zone* zone = isolate->zone();
+ Zone* zone = isolate->runtime_zone();
source = Handle<String>(source->TryFlattenGetString());
// Optimized fast case where we only have ASCII characters.
Handle<Object> result;
@@ -11144,6 +11149,8 @@ class ScopeIterator {
context_(Context::cast(frame->context())),
nested_scope_chain_(4) {
+ Zone zone(isolate);
danno 2012/06/14 14:22:19 Why put this here and not closer to the Compilatio
sanjoy 2012/06/15 09:24:31 Because below a Scope allocated inside a Zone is b
+ ZoneScope zone_scope(&zone, DELETE_ON_EXIT);
// Catch the case when the debugger stops in an internal function.
Handle<SharedFunctionInfo> shared_info(function_->shared());
Handle<ScopeInfo> scope_info(shared_info->scope_info());
@@ -11180,7 +11187,6 @@ class ScopeIterator {
if (scope_info->Type() != EVAL_SCOPE) nested_scope_chain_.Add(scope_info);
} else {
// Reparse the code and analyze the scopes.
- ZoneScope zone_scope(isolate, DELETE_ON_EXIT);
Handle<Script> script(Script::cast(shared_info->script()));
Scope* scope = NULL;
@@ -11188,7 +11194,7 @@ class ScopeIterator {
Handle<ScopeInfo> scope_info(shared_info->scope_info());
if (scope_info->Type() != FUNCTION_SCOPE) {
// Global or eval code.
- CompilationInfo info(script);
+ CompilationInfo info(script, &zone);
if (scope_info->Type() == GLOBAL_SCOPE) {
info.MarkAsGlobal();
} else {
@@ -11201,7 +11207,7 @@ class ScopeIterator {
}
} else {
// Function code
- CompilationInfo info(shared_info);
+ CompilationInfo info(shared_info, &zone);
if (ParserApi::Parse(&info, kNoParsingFlags) && Scope::Analyze(&info)) {
scope = info.function()->scope();
}
@@ -12776,7 +12782,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditCheckAndDropActivations) {
CONVERT_BOOLEAN_ARG_CHECKED(do_drop, 1);
return *LiveEdit::CheckAndDropActivations(shared_array, do_drop,
- isolate->zone());
+ isolate->runtime_zone());
}
// Compares 2 strings line-by-line, then token-wise and returns diff in form

Powered by Google App Engine
This is Rietveld 408576698