Just thinking out loud: instead of a base class that both Failure and Object
(couldn't it be HeapObject?) extend, you could use two separate channels.
 Change all the allocation functions to take a HeapObject** and return a
error code.

Instead of:

MUST_USE_RESULT static Object* CreateJSValue(JSFunction* constructor,
                                             Object* value) {
  Object* result;
  ALLOC_CHECK(result =, Heap::AllocateJSObject(constructor));
  JSValue::cast(result)->set_value(value);
  return result;
}

You could have some variant of:

MUST_USE_RESULT static ErrorCode CreateJSValue(JSFunction* constructor,
                                               Object* value,
                                               HeapObject** result) {
  ErrorCode code;
  if (!(code = Heap::AllocateJSObject(constructor, result))) {
    return code;
  }
  JSValue::cast(result)->set_value(value);
  return ErrorCode::Success();
}

It avoids the nasty macro that takes half an assignment expression as
argument.

On Thu, Sep 30, 2010 at 3:39 AM, Erik Corry <[email protected]> wrote:

> http://codereview.chromium.org/3522008
>
> This is an experiment.  The edits to objects.cc are done with an
> automated tool and are intended as an illustration.  They probably
> don't compile.  Would this be a win and can anyone think of a neater
> way to do it?
>
> --
> Erik Corry, Software Engineer
> Google Denmark ApS - Frederiksborggade 20B, 1 sal,
> 1360 København K - Denmark - CVR nr. 28 86 69 84
>
> --
> v8-dev mailing list
> [email protected]
> http://groups.google.com/group/v8-dev
>

-- 
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to