{
- // Setup the call-as-function delegate.
+ // Set up the call-as-function delegate.
Handle<Code> code =
Handle<Code>(isolate->builtins()->builtin(
Builtins::kHandleApiCallAsFunction));
}
{
- // Setup the call-as-constructor delegate.
+ // Set up the call-as-constructor delegate.
Handle<Code> code =
Handle<Code>(isolate->builtins()->builtin(
Builtins::kHandleApiCallAsConstructor));
void Genesis::InitializeExperimentalGlobal() {
- Isolate* isolate = this->isolate();
Handle<JSObject> global = Handle<JSObject>(global_context()->global());
// TODO(mstarzinger): Move this into Genesis::InitializeGlobal once we no
// longer need to live behind a flag, so WeakMap gets added to the snapshot.
if (FLAG_harmony_weakmaps) { // -- W e a k M a p
+ Handle<JSObject> prototype =
+ factory()->NewJSObject(isolate()->object_function(), TENURED);
InstallFunction(global, "WeakMap", JS_WEAK_MAP_TYPE, JSWeakMap::kSize,
- isolate->initial_object_prototype(),
- Builtins::kIllegal, true);
+ prototype, Builtins::kIllegal, true);
}
}
// -------------------------------------------------------------------
function SetupWeakMap() {
- // Setup the WeakMap constructor function.
+ // Set up the WeakMap constructor function.
%SetCode($WeakMap, WeakMapConstructor);
- // Setup the WeakMap prototype object.
+ // Set up the WeakMap prototype object.
%FunctionSetPrototype($WeakMap, new $WeakMap());
- // Setup the non-enumerable functions on the WeakMap prototype object.
+ // Set up the constructor property on the WeakMap prototype object.
+ %SetProperty($WeakMap.prototype, "constructor", $WeakMap, DONT_ENUM);
+
+ // Set up the non-enumerable functions on the WeakMap prototype object.
InstallFunctionsOnHiddenPrototype($WeakMap.prototype, DONT_ENUM, $Array(
"get", WeakMapGet,
"set", WeakMapSet,
assertTrue(WeakMap.prototype.get instanceof Function)
assertTrue(WeakMap.prototype.has instanceof Function)
assertTrue(WeakMap.prototype.delete instanceof Function)
+assertTrue(WeakMap.prototype.constructor === WeakMap)
// Regression test for issue 1617: The prototype of the WeakMap constructor