Index: src/date.js |
diff --git a/src/date.js b/src/date.js |
index c75d12c651c6d6cb2228ee78e89f70674ee19376..62999e9de63b7ee54b6716ea0b5821cebbf49867 100644 |
--- a/src/date.js |
+++ b/src/date.js |
@@ -25,20 +25,16 @@ |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
- |
// This file relies on the fact that the following declarations have been made |
// in v8natives.js: |
// var $isFinite = GlobalIsFinite; |
+var $Date = global.Date; |
+ |
// ------------------------------------------------------------------- |
// This file contains date support implemented in JavaScript. |
-// Keep reference to original values of some global properties. This |
-// has the added benefit that the code in this file is isolated from |
-// changes to these properties. |
-var $Date = global.Date; |
- |
// Helper function to throw error. |
function ThrowDateTypeError() { |
throw new $TypeError('this is not a Date object.'); |
@@ -142,7 +138,7 @@ var Date_cache = { |
}; |
-%SetCode($Date, function(year, month, date, hours, minutes, seconds, ms) { |
+function DateConstructor(year, month, date, hours, minutes, seconds, ms) { |
if (!%_IsConstructCall()) { |
// ECMA 262 - 15.9.2 |
return (new $Date()).toString(); |
@@ -199,10 +195,7 @@ var Date_cache = { |
value = MakeDate(day, time); |
SET_LOCAL_DATE_VALUE(this, value); |
} |
-}); |
- |
- |
-%FunctionSetPrototype($Date, new $Date($NaN)); |
+} |
var WeekDays = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']; |
@@ -767,6 +760,10 @@ function ResetDateCache() { |
function SetUpDate() { |
%CheckIsBootstrapping(); |
+ |
+ %SetCode($Date, DateConstructor); |
+ %FunctionSetPrototype($Date, new $Date($NaN)); |
+ |
// Set up non-enumerable properties of the Date object itself. |
InstallFunctions($Date, DONT_ENUM, $Array( |
"UTC", DateUTC, |