Index: src/v8natives.js |
=================================================================== |
--- src/v8natives.js (revision 9531) |
+++ src/v8natives.js (working copy) |
@@ -193,13 +193,14 @@ |
function SetUpGlobal() { |
%CheckIsBootstrapping(); |
// ECMA 262 - 15.1.1.1. |
- %SetProperty(global, "NaN", $NaN, DONT_ENUM | DONT_DELETE); |
+ %SetProperty(global, "NaN", $NaN, DONT_ENUM | DONT_DELETE | READ_ONLY); |
// ECMA-262 - 15.1.1.2. |
- %SetProperty(global, "Infinity", 1/0, DONT_ENUM | DONT_DELETE); |
+ %SetProperty(global, "Infinity", 1/0, DONT_ENUM | DONT_DELETE | READ_ONLY); |
// ECMA-262 - 15.1.1.3. |
- %SetProperty(global, "undefined", void 0, DONT_ENUM | DONT_DELETE); |
+ %SetProperty(global, "undefined", void 0, |
+ DONT_ENUM | DONT_DELETE | READ_ONLY); |
// Set up non-enumerable function on the global object. |
InstallFunctions(global, DONT_ENUM, $Array( |
@@ -1042,12 +1043,21 @@ |
throw MakeTypeError("handler_returned_undefined", [handler, "fix"]); |
} |
- if (IS_SPEC_FUNCTION(obj)) { |
+ if (%IsJSFunctionProxy(obj)) { |
var callTrap = %GetCallTrap(obj); |
var constructTrap = %GetConstructTrap(obj); |
var code = DelegateCallAndConstruct(callTrap, constructTrap); |
%Fix(obj); // becomes a regular function |
%SetCode(obj, code); |
+ // TODO(rossberg): What about length and other properties? Not specified. |
+ // We just put in some half-reasonable defaults for now. |
+ var prototype = new $Object(); |
+ $Object.defineProperty(prototype, "constructor", |
+ {value: obj, writable: true, enumerable: false, configrable: true}); |
+ $Object.defineProperty(obj, "prototype", |
+ {value: prototype, writable: true, enumerable: false, configrable: false}) |
+ $Object.defineProperty(obj, "length", |
+ {value: 0, writable: true, enumerable: false, configrable: false}); |
} else { |
%Fix(obj); |
} |