Status: New
Owner: ----

New issue 179 by polarjs: CallIC_Miss() disables handles allocation and  
then allocates handles
http://code.google.com/p/v8/issues/detail?id=179

This issue was found running a v8 build built with -DDEBUG.

In v8::HandleScope::CreateHandle() (in api.cc), we see:

     if (!ApiCheck(current_.extensions >= 0,
                   "v8::HandleScope::CreateHandle()",
                   "Cannot create a handle without a HandleScope")) {
       return NULL;
     }

This test checks to see if handles allocation is allowed before creating a
handle.  Else, it returns NULL.

In CallIC_Miss() (in ic.cc), we see:

Object* CallIC_Miss(Arguments args) {
   NoHandleAllocation na;
   ...
   return ic.LoadFunction(state, args.at<Object>(0), args.at<String>(1));
}

The instantiation of NoHandleAllocation sets current_.extensions to -1.
See implementation of NoHandleAllocation::NoHandleAllocation() (in
handles-inl.h) for when DEBUG is #define'd.  This will cause
HandleScope::CreateHandle() to fail (as shown above).

The implementation of args.at() (in arguments.h) is as follows:

   template <class S> Handle<S> at(int index) {
     ...
     return Handle<S>(reinterpret_cast<S**>(value));
   }

The calls to args.at() that follows the instantiation of NoHandleAllocation
ends up calling Handle<T>::Handle(T* obj) in handles-inl.h, which in turn
calls CreateHandle().  The comment in handles.h also says "Handles are only
valid withing a HandleScope" which confirms that CreateHandle() should be
called as is done in this case.

As a result, it fails to allocate handles.  All this seems to imply that
there is some mismatch between the intentions of the code owners.  Can you
please clarify how this mismatch in expectations should be resolved?   
Thanks.




--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"v8-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/v8-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to