Index: test/mjsunit/regress/regress-1436.js |
diff --git a/src/preparse-data-format.h b/test/mjsunit/regress/regress-1436.js |
similarity index 58% |
copy from src/preparse-data-format.h |
copy to test/mjsunit/regress/regress-1436.js |
index 64c4f18169ac353447f3c44002469c5e0640ca84..5e26e6d846bd2d4f326bf2a264fa614e6674120d 100644 |
--- a/src/preparse-data-format.h |
+++ b/test/mjsunit/regress/regress-1436.js |
@@ -1,4 +1,4 @@ |
-// Copyright 2010 the V8 project authors. All rights reserved. |
+// Copyright 2011 the V8 project authors. All rights reserved. |
// Redistribution and use in source and binary forms, with or without |
// modification, are permitted provided that the following conditions are |
// met: |
@@ -25,38 +25,30 @@ |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
-#ifndef V8_PREPARSE_DATA_FORMAT_H_ |
-#define V8_PREPARSE_DATA_FORMAT_H_ |
- |
-namespace v8 { |
-namespace internal { |
- |
-// Generic and general data used by preparse data recorders and readers. |
- |
-struct PreparseDataConstants { |
- public: |
- // Layout and constants of the preparse data exchange format. |
- static const unsigned kMagicNumber = 0xBadDead; |
- static const unsigned kCurrentVersion = 6; |
- |
- static const int kMagicOffset = 0; |
- static const int kVersionOffset = 1; |
- static const int kHasErrorOffset = 2; |
- static const int kFunctionsSizeOffset = 3; |
- static const int kSymbolCountOffset = 4; |
- static const int kSizeOffset = 5; |
- static const int kHeaderSize = 6; |
- |
- // If encoding a message, the following positions are fixed. |
- static const int kMessageStartPos = 0; |
- static const int kMessageEndPos = 1; |
- static const int kMessageArgCountPos = 2; |
- static const int kMessageTextPos = 3; |
- |
- static const unsigned char kNumberTerminator = 0x80u; |
-}; |
- |
- |
-} } // namespace v8::internal. |
- |
-#endif // V8_PREPARSE_DATA_FORMAT_H_ |
+// Check that reduce and reduceRight call the callback function with |
+// undefined as the receiver (which for non-strict functions is |
+// transformed to the global object). |
+ |
+// Check receiver for reduce and reduceRight. |
+ |
+var global = this; |
+function non_strict(){ assertEquals(global, this); } |
+function strict(){ "use strict"; assertEquals(void 0, this); } |
+ |
+[2, 3].reduce(non_strict); |
+[2, 3].reduceRight(non_strict); |
+[2, 3].reduce(strict); |
Lasse Reichstein
2011/06/09 08:57:02
Group by function called, like below (i.e., both r
Mads Ager (chromium)
2011/06/09 09:05:03
Done.
|
+[2, 3].reduceRight(strict); |
+ |
+ |
+// Check the receiver for callbacks in other array methods. |
+[2, 3].filter(non_strict); |
+[2, 3].filter(strict); |
+[2, 3].forEach(non_strict); |
+[2, 3].forEach(strict); |
+[2, 3].some(non_strict); |
+[2, 3].some(strict); |
+[2, 3].every(non_strict); |
+[2, 3].every(strict); |
+[2, 3].map(non_strict); |
+[2, 3].map(strict); |
Lasse Reichstein
2011/06/09 08:57:02
How about putting them in alphabetic order.
Matbe
Mads Ager (chromium)
2011/06/09 09:05:03
Done.
|