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

Unified Diff: src/bootstrapper.cc

Issue 488017: Give the binary op stubs better names to make profiles more informative. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years 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
« no previous file with comments | « src/bootstrapper.h ('k') | src/ia32/codegen-ia32.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/bootstrapper.cc
===================================================================
--- src/bootstrapper.cc (revision 3439)
+++ src/bootstrapper.cc (working copy)
@@ -95,6 +95,8 @@
static SourceCodeCache extensions_cache(Script::TYPE_EXTENSION);
// This is for delete, not delete[].
static List<char*>* delete_these_non_arrays_on_tear_down = NULL;
+// This is for delete[]
+static List<char*>* delete_these_arrays_on_tear_down = NULL;
NativesExternalStringResource::NativesExternalStringResource(const char* source)
@@ -150,17 +152,41 @@
}
+char* Bootstrapper::AllocateAutoDeletedArray(int bytes) {
+ char* memory = new char[bytes];
+ if (memory != NULL) {
+ if (delete_these_arrays_on_tear_down == NULL) {
+ delete_these_arrays_on_tear_down = new List<char*>(2);
+ }
+ delete_these_arrays_on_tear_down->Add(memory);
+ }
+ return memory;
+}
+
+
void Bootstrapper::TearDown() {
if (delete_these_non_arrays_on_tear_down != NULL) {
int len = delete_these_non_arrays_on_tear_down->length();
ASSERT(len < 20); // Don't use this mechanism for unbounded allocations.
for (int i = 0; i < len; i++) {
delete delete_these_non_arrays_on_tear_down->at(i);
+ delete_these_non_arrays_on_tear_down->at(i) = NULL;
}
delete delete_these_non_arrays_on_tear_down;
delete_these_non_arrays_on_tear_down = NULL;
}
+ if (delete_these_arrays_on_tear_down != NULL) {
+ int len = delete_these_arrays_on_tear_down->length();
+ ASSERT(len < 1000); // Don't use this mechanism for unbounded allocations.
+ for (int i = 0; i < len; i++) {
+ delete[] delete_these_arrays_on_tear_down->at(i);
+ delete_these_arrays_on_tear_down->at(i) = NULL;
+ }
+ delete delete_these_arrays_on_tear_down;
+ delete_these_arrays_on_tear_down = NULL;
+ }
+
natives_cache.Initialize(false); // Yes, symmetrical
extensions_cache.Initialize(false);
}
« no previous file with comments | « src/bootstrapper.h ('k') | src/ia32/codegen-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698