Index: test/mjsunit/date.js |
diff --git a/test/mjsunit/date.js b/test/mjsunit/date.js |
index 3e153aba7f9113e113783815b4a34732b16468f0..5aaa3bb94e2dc76fea950223fb6f118ebd86eeb4 100644 |
--- a/test/mjsunit/date.js |
+++ b/test/mjsunit/date.js |
@@ -25,6 +25,8 @@ |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
+// Flags: --allow-natives-syntax |
+ |
// Test date construction from other dates. |
var date0 = new Date(1111); |
var date1 = new Date(date0); |
@@ -319,3 +321,23 @@ for (var i = 0; i < 24; i++) { |
assertEquals(70674603500 - ms, Date.parse(string), string); |
} |
} |
+ |
+assertThrows('Date.prototype.setTime.call("", 1);', TypeError); |
+assertThrows('Date.prototype.setYear.call("", 1);', TypeError); |
+assertThrows('Date.prototype.setHours.call("", 1, 2, 3, 4);', TypeError); |
+assertThrows('Date.prototype.getDate.call("");', TypeError); |
+assertThrows('Date.prototype.getUTCDate.call("");', TypeError); |
+ |
+var date = new Date(); |
+date.getTime(); |
+date.getTime(); |
+%OptimizeFunctionOnNextCall(Date.prototype.getTime); |
+assertThrows(function() { Date.prototype.getTime.call(""); }, TypeError); |
+assertTrue(%GetOptimizationStatus(Date.prototype.getTime) != 1); |
+ |
+date.getYear(); |
+date.getYear(); |
+%OptimizeFunctionOnNextCall(Date.prototype.getYear); |
+assertThrows(function() { Date.prototype.getYear.call(""); }, TypeError); |
+opt_status = %GetOptimizationStatus(Date.prototype.getYear); |
+assertTrue(%GetOptimizationStatus(Date.prototype.getTime) != 1); |