Bug 769871 - Remove x_CheckThisX methods, as the extract-the-primitive-value methods immediately after perform that check already. r=Norbert

--HG--
extra : rebase_source : b4dd0efb5acad176a07ac8c1dada64dddd0dc3a9
This commit is contained in:
Jeff Walden 2013-03-22 12:35:44 -07:00
Родитель d1dd89b2a1
Коммит 12cb6e942b
7 изменённых файлов: 6 добавлений и 76 удалений

Просмотреть файл

@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*global date_CheckThisDate: false, intl_DateTimeFormat: false, */
/*global intl_DateTimeFormat: false, */
var dateTimeFormatCache = new Record();
@ -16,8 +16,7 @@ var dateTimeFormatCache = new Record();
* Spec: ECMAScript Internationalization API Specification, 13.3.1.
*/
function Date_toLocaleString() {
// Steps 1-2.
callFunction(date_CheckThisDate, this);
// Steps 1-2. Note that valueOf enforces "this time value" restrictions.
var x = callFunction(std_Date_valueOf, this);
if (std_isNaN(x))
return "Invalid Date";
@ -54,8 +53,7 @@ function Date_toLocaleString() {
* Spec: ECMAScript Internationalization API Specification, 13.3.2.
*/
function Date_toLocaleDateString() {
// Steps 1-2.
callFunction(date_CheckThisDate, this);
// Steps 1-2. Note that valueOf enforces "this time value" restrictions.
var x = callFunction(std_Date_valueOf, this);
if (std_isNaN(x))
return "Invalid Date";
@ -92,8 +90,7 @@ function Date_toLocaleDateString() {
* Spec: ECMAScript Internationalization API Specification, 13.3.3.
*/
function Date_toLocaleTimeString() {
// Steps 1-2.
callFunction(date_CheckThisDate, this);
// Steps 1-2. Note that valueOf enforces "this time value" restrictions.
var x = callFunction(std_Date_valueOf, this);
if (std_isNaN(x))
return "Invalid Date";

Просмотреть файл

@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*global num_CheckThisNumber: false, intl_NumberFormat: false, */
/*global intl_NumberFormat: false, */
var numberFormatCache = new Record();
@ -16,8 +16,7 @@ var numberFormatCache = new Record();
* Spec: ECMAScript Internationalization API Specification, 13.2.1.
*/
function Number_toLocaleString() {
// Step 1.
callFunction(num_CheckThisNumber, this);
// Steps 1-2. Note that valueOf enforces "this Number value" restrictions.
var x = callFunction(std_Number_valueOf, this);
// Steps 2-3.

Просмотреть файл

@ -1392,26 +1392,6 @@ IsDate(const Value &v)
return v.isObject() && v.toObject().hasClass(&DateClass);
}
JS_ALWAYS_INLINE bool
date_nop(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsDate(args.thisv()));
args.rval().setUndefined();
return true;
}
JSBool
date_CheckThisDate(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
// CallNonGenericMethod will handle proxies correctly and throw exceptions
// in the right circumstances, but will report date_CheckThisDate as the
// function name in the message. We need a better solution:
// https://bugzilla.mozilla.org/show_bug.cgi?id=844677
return CallNonGenericMethod<IsDate, date_nop>(cx, args);
}
/*
* See ECMA 15.9.5.4 thru 15.9.5.23
*/

Просмотреть файл

@ -65,15 +65,6 @@ js_DateGetMinutes(JSContext *cx, JSRawObject obj);
extern JS_FRIEND_API(int)
js_DateGetSeconds(JSRawObject obj);
/**
* Checks that the this value provided meets the requirements for "this Date
* object" in ES5.1, 15.9.5, and throws a TypeError if not.
*
* Usage: callFunction(date_CheckThisDate, this)
*/
extern JSBool
date_CheckThisDate(JSContext *cx, unsigned argc, js::Value *vp);
/* Date constructor native. Exposed only so the JIT can know its address. */
JSBool
js_Date(JSContext *cx, unsigned argc, js::Value *vp);

Просмотреть файл

@ -445,26 +445,6 @@ IsNumber(const Value &v)
return v.isNumber() || (v.isObject() && v.toObject().hasClass(&NumberClass));
}
JS_ALWAYS_INLINE bool
num_nop(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsNumber(args.thisv()));
args.rval().setUndefined();
return true;
}
JSBool
js::num_CheckThisNumber(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
// CallNonGenericMethod will handle proxies correctly and throw exceptions
// in the right circumstances, but will report date_CheckThisNumber as the
// function name in the message. We need a better solution:
// https://bugzilla.mozilla.org/show_bug.cgi?id=844677
return CallNonGenericMethod<IsNumber, num_nop>(cx, args);
}
inline double
Extract(const Value &v)
{

Просмотреть файл

@ -149,15 +149,6 @@ ToNumber(JSContext *cx, Value *vp)
JSBool
num_parseInt(JSContext *cx, unsigned argc, Value *vp);
/**
* Checks that the this value provided meets the requirements for "this Number
* object" in ES5.1, 15.7.4, and throws a TypeError if not.
*
* Usage: callFunction(num_CheckThisNumber, this);
*/
extern JSBool
num_CheckThisNumber(JSContext *cx, unsigned argc, js::Value *vp);
} /* namespace js */
/*

Просмотреть файл

@ -7,9 +7,7 @@
#include "jscntxt.h"
#include "jscompartment.h"
#include "jsdate.h"
#include "jsinterp.h"
#include "jsnum.h"
#include "jsobj.h"
#include "builtin/Intl.h"
@ -471,9 +469,6 @@ JSFunctionSpec intrinsic_functions[] = {
JS_FN("ShouldForceSequential", intrinsic_ShouldForceSequential, 0,0),
JS_FN("ParallelTestsShouldPass", intrinsic_ParallelTestsShouldPass, 0,0),
// See jsdate.h for descriptions of the date_* functions.
JS_FN("date_CheckThisDate", date_CheckThisDate, 2,0),
// See builtin/Intl.h for descriptions of the intl_* functions.
JS_FN("intl_availableCalendars", intl_availableCalendars, 1,0),
JS_FN("intl_availableCollations", intl_availableCollations, 1,0),
@ -489,9 +484,6 @@ JSFunctionSpec intrinsic_functions[] = {
JS_FN("intl_numberingSystem", intl_numberingSystem, 1,0),
JS_FN("intl_patternForSkeleton", intl_patternForSkeleton, 2,0),
// See jsnum.h for descriptions of the num_* functions.
JS_FN("num_CheckThisNumber", num_CheckThisNumber, 2,0),
#ifdef DEBUG
JS_FN("Dump", intrinsic_Dump, 1,0),
#endif