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

Unified Diff: src/global-handles.cc

Issue 1628173002: Don't NULL-check GlobalHandle::Node::object_ (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/cctest/test-global-handles.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/global-handles.cc
diff --git a/src/global-handles.cc b/src/global-handles.cc
index f9c4a4f580213f833f2833b07ad74459cd32a6a8..4a7292547f1c06b6c180bf09671abfd1492f143e 100644
--- a/src/global-handles.cc
+++ b/src/global-handles.cc
@@ -78,6 +78,7 @@ class GlobalHandles::Node {
#endif
void Initialize(int index, Node** first_free) {
+ object_ = reinterpret_cast<Object*>(kGlobalHandleZapValue);
vogelheim 2016/01/25 12:00:19 nitpick: Wouldn't it be better for debugging to di
jochen (gone - plz use gerrit) 2016/01/25 13:05:48 since we recycle handles, they're expected to cons
index_ = static_cast<uint8_t>(index);
DCHECK(static_cast<int>(index_) == index);
set_state(FREE);
@@ -250,9 +251,9 @@ class GlobalHandles::Node {
}
void MakeWeak(void* parameter, WeakCallback weak_callback) {
- DCHECK(weak_callback != NULL);
+ DCHECK(weak_callback != nullptr);
DCHECK(IsInUse());
- CHECK(object_ != NULL);
+ CHECK_NE(object_, reinterpret_cast<Object*>(kGlobalHandleZapValue));
set_state(WEAK);
set_weakness_type(NORMAL_WEAK);
set_parameter(parameter);
@@ -264,7 +265,7 @@ class GlobalHandles::Node {
v8::WeakCallbackType type) {
DCHECK(phantom_callback != nullptr);
DCHECK(IsInUse());
- CHECK(object_ != nullptr);
+ CHECK_NE(object_, reinterpret_cast<Object*>(kGlobalHandleZapValue));
set_state(WEAK);
switch (type) {
case v8::WeakCallbackType::kParameter:
« no previous file with comments | « no previous file | test/cctest/test-global-handles.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698