Comment #4 on issue 2148 by [email protected]: Null(Isolate* isolate)
crashes if we pass 0 for isolate
http://code.google.com/p/v8/issues/detail?id=2148
I discussed with WebKit folks and decided to use the NULL check macro in
the V8 bindings side. Eventually we want to remove optional Isolate*
arguments from V8 bindings and make the Isolate* argument mandatory (and
thus we can remove the NULL check macro).
FYI: In my experiment in my Linux desktop, it seems that inserting the NULL
check into V8 regresses performance by 1.6%:
static inline bool IsInitialized(v8::Isolate* isolate) {
if (!isolate) // Add the NULL check.
return false; // Add the NULL check.
uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) + kIsolateStateOffset;
return *reinterpret_cast<int*>(addr) == 1;
}
The performance results of dom-bindings/undefined_first_child_getter.cc
without the NULL check:
$ for i in `seq 1 10`; do ./a.out; done
Time (undefined_first_child_getter): 12.4 ns
Time (undefined_first_child_getter): 13.8 ns
Time (undefined_first_child_getter): 12.6 ns
Time (undefined_first_child_getter): 12.4 ns
Time (undefined_first_child_getter): 12.8 ns
Time (undefined_first_child_getter): 12.6 ns
Time (undefined_first_child_getter): 12.6 ns
Time (undefined_first_child_getter): 12.6 ns
Time (undefined_first_child_getter): 12.4 ns
Time (undefined_first_child_getter): 12.8 ns
The performance results of dom-bindings/undefined_first_child_getter.cc
with the NULL check:
$ for i in `seq 1 10`; do ./a.out; done
Time (undefined_first_child_getter): 12.6 ns
Time (undefined_first_child_getter): 13.8 ns
Time (undefined_first_child_getter): 12.8 ns
Time (undefined_first_child_getter): 12.8 ns
Time (undefined_first_child_getter): 12.8 ns
Time (undefined_first_child_getter): 12.8 ns
Time (undefined_first_child_getter): 12.8 ns
Time (undefined_first_child_getter): 12.6 ns
Time (undefined_first_child_getter): 13.4 ns
Time (undefined_first_child_getter): 12.8 ns
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev