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

Side by Side Diff: src/bootstrapper.cc

Issue 18581: Enable preemption in d8. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 10 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
« no previous file with comments | « src/bootstrapper.h ('k') | src/d8.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 Genesis(Handle<Object> global_object, 258 Genesis(Handle<Object> global_object,
259 v8::Handle<v8::ObjectTemplate> global_template, 259 v8::Handle<v8::ObjectTemplate> global_template,
260 v8::ExtensionConfiguration* extensions); 260 v8::ExtensionConfiguration* extensions);
261 ~Genesis(); 261 ~Genesis();
262 262
263 Handle<Context> result() { return result_; } 263 Handle<Context> result() { return result_; }
264 264
265 Genesis* previous() { return previous_; } 265 Genesis* previous() { return previous_; }
266 static Genesis* current() { return current_; } 266 static Genesis* current() { return current_; }
267 267
268 // Support for thread preemption.
269 static int ArchiveSpacePerThread();
270 static char* ArchiveState(char* to);
271 static char* RestoreState(char* from);
272
268 private: 273 private:
269 Handle<Context> global_context_; 274 Handle<Context> global_context_;
270 275
271 // There may be more than one active genesis object: When GC is 276 // There may be more than one active genesis object: When GC is
272 // triggered during environment creation there may be weak handle 277 // triggered during environment creation there may be weak handle
273 // processing callbacks which may create new environments. 278 // processing callbacks which may create new environments.
274 Genesis* previous_; 279 Genesis* previous_;
275 static Genesis* current_; 280 static Genesis* current_;
276 281
277 Handle<Context> global_context() { return global_context_; } 282 Handle<Context> global_context() { return global_context_; }
(...skipping 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after
1459 1464
1460 if (!ConfigureGlobalObjects(global_template)) return; 1465 if (!ConfigureGlobalObjects(global_template)) return;
1461 1466
1462 if (!InstallExtensions(extensions)) return; 1467 if (!InstallExtensions(extensions)) return;
1463 1468
1464 if (!InstallSpecialObjects()) return; 1469 if (!InstallSpecialObjects()) return;
1465 1470
1466 result_ = global_context_; 1471 result_ = global_context_;
1467 } 1472 }
1468 1473
1474
1475 // Support for thread preemption.
1476
1477 // Reserve space for statics needing saving and restoring.
1478 int Bootstrapper::ArchiveSpacePerThread() {
1479 return Genesis::ArchiveSpacePerThread();
1480 }
1481
1482
1483 // Archive statics that are thread local.
1484 char* Bootstrapper::ArchiveState(char* to) {
1485 return Genesis::ArchiveState(to);
1486 }
1487
1488
1489 // Restore statics that are thread local.
1490 char* Bootstrapper::RestoreState(char* from) {
1491 return Genesis::RestoreState(from);
1492 }
1493
1494
1495 // Reserve space for statics needing saving and restoring.
1496 int Genesis::ArchiveSpacePerThread() {
1497 return sizeof(current_);
1498 }
1499
1500
1501 // Archive statics that are thread local.
1502 char* Genesis::ArchiveState(char* to) {
1503 *reinterpret_cast<Genesis**>(to) = current_;
1504 current_ = NULL;
1505 return to + sizeof(current_);
1506 }
1507
1508
1509 // Restore statics that are thread local.
1510 char* Genesis::RestoreState(char* from) {
1511 current_ = *reinterpret_cast<Genesis**>(from);
1512 return from + sizeof(current_);
1513 }
1514
1469 } } // namespace v8::internal 1515 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/bootstrapper.h ('k') | src/d8.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698