OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/execution.h" | 7 #include "src/execution.h" |
8 #include "src/handles.h" | 8 #include "src/handles.h" |
9 #include "src/interpreter/bytecode-array-builder.h" | 9 #include "src/interpreter/bytecode-array-builder.h" |
10 #include "src/interpreter/bytecode-array-iterator.h" | 10 #include "src/interpreter/bytecode-array-iterator.h" |
(...skipping 2241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2252 std::make_pair("function f(a, b, c, d) {" | 2252 std::make_pair("function f(a, b, c, d) {" |
2253 "'use strict'; return arguments[2]; }", | 2253 "'use strict'; return arguments[2]; }", |
2254 2), | 2254 2), |
2255 // Check arguments are mapped in sloppy mode and unmapped in strict. | 2255 // Check arguments are mapped in sloppy mode and unmapped in strict. |
2256 std::make_pair("function f(a, b, c, d) {" | 2256 std::make_pair("function f(a, b, c, d) {" |
2257 " c = b; return arguments[2]; }", | 2257 " c = b; return arguments[2]; }", |
2258 1), | 2258 1), |
2259 std::make_pair("function f(a, b, c, d) {" | 2259 std::make_pair("function f(a, b, c, d) {" |
2260 " 'use strict'; c = b; return arguments[2]; }", | 2260 " 'use strict'; c = b; return arguments[2]; }", |
2261 2), | 2261 2), |
| 2262 // Check arguments for duplicate parameters in sloppy mode. |
| 2263 std::make_pair("function f(a, a, b) { return arguments[1]; }", 1), |
2262 // check rest parameters | 2264 // check rest parameters |
2263 std::make_pair("function f(...restArray) { return restArray[0]; }", 0), | 2265 std::make_pair("function f(...restArray) { return restArray[0]; }", 0), |
2264 std::make_pair("function f(a, ...restArray) { return restArray[0]; }", 1), | 2266 std::make_pair("function f(a, ...restArray) { return restArray[0]; }", 1), |
2265 std::make_pair("function f(a, ...restArray) { return arguments[0]; }", 0), | 2267 std::make_pair("function f(a, ...restArray) { return arguments[0]; }", 0), |
2266 std::make_pair("function f(a, ...restArray) { return arguments[1]; }", 1), | 2268 std::make_pair("function f(a, ...restArray) { return arguments[1]; }", 1), |
2267 std::make_pair("function f(a, ...restArray) { return restArray[1]; }", 2), | 2269 std::make_pair("function f(a, ...restArray) { return restArray[1]; }", 2), |
2268 std::make_pair("function f(a, ...arguments) { return arguments[0]; }", 1), | 2270 std::make_pair("function f(a, ...arguments) { return arguments[0]; }", 1), |
2269 std::make_pair("function f(a, b, ...restArray) { return restArray[0]; }", | 2271 std::make_pair("function f(a, b, ...restArray) { return restArray[0]; }", |
2270 2), | 2272 2), |
2271 }; | 2273 }; |
(...skipping 1894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4166 CHECK(return_value->SameValue(*tests[i].second)); | 4168 CHECK(return_value->SameValue(*tests[i].second)); |
4167 } | 4169 } |
4168 | 4170 |
4169 FLAG_ignition_generators = old_flag; | 4171 FLAG_ignition_generators = old_flag; |
4170 } | 4172 } |
4171 | 4173 |
4172 | 4174 |
4173 } // namespace interpreter | 4175 } // namespace interpreter |
4174 } // namespace internal | 4176 } // namespace internal |
4175 } // namespace v8 | 4177 } // namespace v8 |
OLD | NEW |