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

Side by Side Diff: src/d8.cc

Issue 9179012: Reduce boot-up memory use of V8. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 i::Mutex* Shell::context_mutex_(i::OS::CreateMutex()); 119 i::Mutex* Shell::context_mutex_(i::OS::CreateMutex());
120 Persistent<Context> Shell::utility_context_; 120 Persistent<Context> Shell::utility_context_;
121 LineEditor* Shell::console = NULL; 121 LineEditor* Shell::console = NULL;
122 #endif // V8_SHARED 122 #endif // V8_SHARED
123 123
124 Persistent<Context> Shell::evaluation_context_; 124 Persistent<Context> Shell::evaluation_context_;
125 ShellOptions Shell::options; 125 ShellOptions Shell::options;
126 const char* Shell::kPrompt = "d8> "; 126 const char* Shell::kPrompt = "d8> ";
127 127
128 128
129 const int MB = 1024 * 1024;
130
131
129 #ifndef V8_SHARED 132 #ifndef V8_SHARED
130 bool CounterMap::Match(void* key1, void* key2) { 133 bool CounterMap::Match(void* key1, void* key2) {
131 const char* name1 = reinterpret_cast<const char*>(key1); 134 const char* name1 = reinterpret_cast<const char*>(key1);
132 const char* name2 = reinterpret_cast<const char*>(key2); 135 const char* name2 = reinterpret_cast<const char*>(key2);
133 return strcmp(name1, name2) == 0; 136 return strcmp(name1, name2) == 0;
134 } 137 }
135 #endif // V8_SHARED 138 #endif // V8_SHARED
136 139
137 140
138 // Converts a V8 value to a C string. 141 // Converts a V8 value to a C string.
(...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after
1184 const char* chars = ReadChars(name, &size); 1187 const char* chars = ReadChars(name, &size);
1185 if (chars == NULL) return Handle<String>(); 1188 if (chars == NULL) return Handle<String>();
1186 Handle<String> result = String::New(chars, size); 1189 Handle<String> result = String::New(chars, size);
1187 delete[] chars; 1190 delete[] chars;
1188 return result; 1191 return result;
1189 } 1192 }
1190 1193
1191 1194
1192 #ifndef V8_SHARED 1195 #ifndef V8_SHARED
1193 i::Thread::Options SourceGroup::GetThreadOptions() { 1196 i::Thread::Options SourceGroup::GetThreadOptions() {
1194 i::Thread::Options options;
1195 options.name = "IsolateThread";
1196 // On some systems (OSX 10.6) the stack size default is 0.5Mb or less 1197 // On some systems (OSX 10.6) the stack size default is 0.5Mb or less
1197 // which is not enough to parse the big literal expressions used in tests. 1198 // which is not enough to parse the big literal expressions used in tests.
1198 // The stack size should be at least StackGuard::kLimitSize + some 1199 // The stack size should be at least StackGuard::kLimitSize + some
1199 // OS-specific padding for thread startup code. 1200 // OS-specific padding for thread startup code. 2Mbytes seems to be enough.
1200 options.stack_size = 2 << 20; // 2 Mb seems to be enough 1201 return i::Thread::Options("IsolateThread", 2 * MB);
1201 return options;
1202 } 1202 }
1203 1203
1204 1204
1205 void SourceGroup::ExecuteInThread() { 1205 void SourceGroup::ExecuteInThread() {
1206 Isolate* isolate = Isolate::New(); 1206 Isolate* isolate = Isolate::New();
1207 do { 1207 do {
1208 if (next_semaphore_ != NULL) next_semaphore_->Wait(); 1208 if (next_semaphore_ != NULL) next_semaphore_->Wait();
1209 { 1209 {
1210 Isolate::Scope iscope(isolate); 1210 Isolate::Scope iscope(isolate);
1211 Locker lock(isolate); 1211 Locker lock(isolate);
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
1504 } 1504 }
1505 1505
1506 } // namespace v8 1506 } // namespace v8
1507 1507
1508 1508
1509 #ifndef GOOGLE3 1509 #ifndef GOOGLE3
1510 int main(int argc, char* argv[]) { 1510 int main(int argc, char* argv[]) {
1511 return v8::Shell::Main(argc, argv); 1511 return v8::Shell::Main(argc, argv);
1512 } 1512 }
1513 #endif 1513 #endif
OLDNEW
« no previous file with comments | « src/cpu-profiler.cc ('k') | src/deoptimizer.cc » ('j') | src/spaces.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698