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

Unified Diff: src/isolate.cc

Issue 768543002: [WIP] TrapHandler 2014/11/27. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years, 1 month 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/isolate.h ('k') | src/objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/isolate.cc
diff --git a/src/isolate.cc b/src/isolate.cc
index 09ca02854f12282e81d70327209e7c0f52f1c903..54bfc83a0ed08db167a211b3e06e580b2aaee7e2 100644
--- a/src/isolate.cc
+++ b/src/isolate.cc
@@ -2532,6 +2532,44 @@ std::string Isolate::GetTurboCfgFileName() {
}
+void Isolate::AddGuardArea(void const* address, size_t const length) {
+ DCHECK(address != nullptr);
+ DCHECK(length != 0);
+ DCHECK((bit_cast<uintptr_t>(address) % base::OS::CommitPageSize()) == 0);
+ DCHECK((length % base::OS::CommitPageSize()) == 0);
+ DCHECK(!IsInGuardArea(address));
+ base::OS::Guard(const_cast<void*>(address), length);
+ guard_areas_.push_back(
+ std::make_pair(address, static_cast<uint8_t const*>(address) + length));
+}
+
+
+void Isolate::RemoveGuardArea(void const* address, size_t const length) {
+ DCHECK(address != nullptr);
+ DCHECK(length != 0);
+ DCHECK((bit_cast<uintptr_t>(address) % base::OS::CommitPageSize()) == 0);
+ DCHECK((length % base::OS::CommitPageSize()) == 0);
+ base::OS::Unguard(const_cast<void*>(address), length);
+ for (auto i = guard_areas_.begin(); ; ++i) {
+ DCHECK(i != guard_areas_.end());
+ if (i->first == address) {
+ guard_areas_.erase(i);
+ break;
+ }
+ }
+}
+
+
+bool Isolate::IsInGuardArea(void const* address) const {
+ for (auto i = guard_areas_.begin(); i != guard_areas_.end(); ++i) {
+ if (i->first <= address && address < i->second) {
+ return true;
+ }
+ }
+ return false;
+}
+
+
bool StackLimitCheck::JsHasOverflowed() const {
StackGuard* stack_guard = isolate_->stack_guard();
#ifdef USE_SIMULATOR
« no previous file with comments | « src/isolate.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698