OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1044 if (%IsJSFunctionProxy(obj)) { | 1044 if (%IsJSFunctionProxy(obj)) { |
1045 var callTrap = %GetCallTrap(obj); | 1045 var callTrap = %GetCallTrap(obj); |
1046 var constructTrap = %GetConstructTrap(obj); | 1046 var constructTrap = %GetConstructTrap(obj); |
1047 var code = DelegateCallAndConstruct(callTrap, constructTrap); | 1047 var code = DelegateCallAndConstruct(callTrap, constructTrap); |
1048 %Fix(obj); // becomes a regular function | 1048 %Fix(obj); // becomes a regular function |
1049 %SetCode(obj, code); | 1049 %SetCode(obj, code); |
1050 // TODO(rossberg): What about length and other properties? Not specified. | 1050 // TODO(rossberg): What about length and other properties? Not specified. |
1051 // We just put in some half-reasonable defaults for now. | 1051 // We just put in some half-reasonable defaults for now. |
1052 var prototype = new $Object(); | 1052 var prototype = new $Object(); |
1053 $Object.defineProperty(prototype, "constructor", | 1053 $Object.defineProperty(prototype, "constructor", |
1054 {value: obj, writable: true, enumerable: false, configrable: true}); | 1054 {value: obj, writable: true, enumerable: false, configurable: true}); |
1055 $Object.defineProperty(obj, "prototype", | 1055 %FunctionSetPrototype(obj, prototype); |
1056 {value: prototype, writable: true, enumerable: false, configrable: false}) | 1056 obj.length = 0; |
Michael Starzinger
2011/11/10 14:20:00
I'm fine with this hack for now. But can you pleas
rossberg
2011/11/10 15:20:23
There is a bug already, see:
http://code.google.c
| |
1057 $Object.defineProperty(obj, "length", | |
1058 {value: 0, writable: true, enumerable: false, configrable: false}); | |
1059 } else { | 1057 } else { |
1060 %Fix(obj); | 1058 %Fix(obj); |
1061 } | 1059 } |
1062 ObjectDefineProperties(obj, props); | 1060 ObjectDefineProperties(obj, props); |
1063 } | 1061 } |
1064 | 1062 |
1065 | 1063 |
1066 // ES5 section 15.2.3.8. | 1064 // ES5 section 15.2.3.8. |
1067 function ObjectSeal(obj) { | 1065 function ObjectSeal(obj) { |
1068 if (!IS_SPEC_OBJECT(obj)) { | 1066 if (!IS_SPEC_OBJECT(obj)) { |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1550 | 1548 |
1551 function SetUpFunction() { | 1549 function SetUpFunction() { |
1552 %CheckIsBootstrapping(); | 1550 %CheckIsBootstrapping(); |
1553 InstallFunctions($Function.prototype, DONT_ENUM, $Array( | 1551 InstallFunctions($Function.prototype, DONT_ENUM, $Array( |
1554 "bind", FunctionBind, | 1552 "bind", FunctionBind, |
1555 "toString", FunctionToString | 1553 "toString", FunctionToString |
1556 )); | 1554 )); |
1557 } | 1555 } |
1558 | 1556 |
1559 SetUpFunction(); | 1557 SetUpFunction(); |
OLD | NEW |