I want to do the equivalent of Object.create() in javascript from C++, but I don't see any way to specify the prototype of a new v8::Object from the API.
I was planning on creating the object with v8::Object::New and then calling v8::Object::SetPrototype() on it, until I saw this:
Warning: Changing the [[Prototype]] of an object is, by the nature of how modern JavaScript engines optimize property accesses, a very slow operation, in every browser and JavaScript engine. The effects on performance of altering inheritance are subtle and far-flung, and are not limited to simply the time spent in obj.__proto__ = ... statement, but may extend to any code that has access to any object whose [[Prototype]] has been altered. If you care about performance you should avoid setting the [[Prototype]] of an object. Instead, create a new object with the desired [[Prototype]] using Object.create().
That's a pretty terrifying situation, so I want to make sure that using SetPrototype() doesn't incur that kind of penalty - at least on a newly created and unused object.
Thank you.
--Zac