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 <stdlib.h> | 5 #include <stdlib.h> |
6 | 6 |
7 #include "test/cctest/test-api.h" | 7 #include "test/cctest/test-api.h" |
8 | 8 |
9 #include "include/v8-util.h" | 9 #include "include/v8-util.h" |
10 #include "src/api.h" | 10 #include "src/api.h" |
(...skipping 2252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2263 " result.push(prop);" | 2263 " result.push(prop);" |
2264 "}" | 2264 "}" |
2265 "result")); | 2265 "result")); |
2266 // Check that we get all the property names returned including the | 2266 // Check that we get all the property names returned including the |
2267 // ones from the enumerators in the right order: indexed properties | 2267 // ones from the enumerators in the right order: indexed properties |
2268 // in numerical order, indexed interceptor properties, named | 2268 // in numerical order, indexed interceptor properties, named |
2269 // properties in insertion order, named interceptor properties. | 2269 // properties in insertion order, named interceptor properties. |
2270 // This order is not mandated by the spec, so this test is just | 2270 // This order is not mandated by the spec, so this test is just |
2271 // documenting our behavior. | 2271 // documenting our behavior. |
2272 CHECK_EQ(17u, result->Length()); | 2272 CHECK_EQ(17u, result->Length()); |
2273 // Indexed properties + indexed interceptor properties in numerical order. | 2273 // Indexed properties. |
2274 CHECK(v8_str("0") | 2274 CHECK(v8_str("5") |
2275 ->Equals(context.local(), | 2275 ->Equals(context.local(), |
2276 result->Get(context.local(), v8::Integer::New(isolate, 0)) | 2276 result->Get(context.local(), v8::Integer::New(isolate, 0)) |
2277 .ToLocalChecked()) | 2277 .ToLocalChecked()) |
2278 .FromJust()); | 2278 .FromJust()); |
2279 CHECK(v8_str("1") | 2279 CHECK(v8_str("10") |
2280 ->Equals(context.local(), | 2280 ->Equals(context.local(), |
2281 result->Get(context.local(), v8::Integer::New(isolate, 1)) | 2281 result->Get(context.local(), v8::Integer::New(isolate, 1)) |
2282 .ToLocalChecked()) | 2282 .ToLocalChecked()) |
2283 .FromJust()); | 2283 .FromJust()); |
2284 CHECK(v8_str("5") | 2284 CHECK(v8_str("140000") |
2285 ->Equals(context.local(), | 2285 ->Equals(context.local(), |
2286 result->Get(context.local(), v8::Integer::New(isolate, 2)) | 2286 result->Get(context.local(), v8::Integer::New(isolate, 2)) |
2287 .ToLocalChecked()) | 2287 .ToLocalChecked()) |
2288 .FromJust()); | 2288 .FromJust()); |
2289 CHECK(v8_str("10") | 2289 CHECK(v8_str("4294967294") |
2290 ->Equals(context.local(), | 2290 ->Equals(context.local(), |
2291 result->Get(context.local(), v8::Integer::New(isolate, 3)) | 2291 result->Get(context.local(), v8::Integer::New(isolate, 3)) |
2292 .ToLocalChecked()) | 2292 .ToLocalChecked()) |
2293 .FromJust()); | 2293 .FromJust()); |
2294 CHECK(v8_str("140000") | 2294 // Indexed Interceptor properties |
| 2295 CHECK(v8_str("0") |
2295 ->Equals(context.local(), | 2296 ->Equals(context.local(), |
2296 result->Get(context.local(), v8::Integer::New(isolate, 4)) | 2297 result->Get(context.local(), v8::Integer::New(isolate, 4)) |
2297 .ToLocalChecked()) | 2298 .ToLocalChecked()) |
2298 .FromJust()); | 2299 .FromJust()); |
2299 CHECK(v8_str("4294967294") | 2300 CHECK(v8_str("1") |
2300 ->Equals(context.local(), | 2301 ->Equals(context.local(), |
2301 result->Get(context.local(), v8::Integer::New(isolate, 5)) | 2302 result->Get(context.local(), v8::Integer::New(isolate, 5)) |
2302 .ToLocalChecked()) | 2303 .ToLocalChecked()) |
2303 .FromJust()); | 2304 .FromJust()); |
2304 // Named properties in insertion order. | 2305 // Named properties in insertion order. |
2305 CHECK(v8_str("a") | 2306 CHECK(v8_str("a") |
2306 ->Equals(context.local(), | 2307 ->Equals(context.local(), |
2307 result->Get(context.local(), v8::Integer::New(isolate, 6)) | 2308 result->Get(context.local(), v8::Integer::New(isolate, 6)) |
2308 .ToLocalChecked()) | 2309 .ToLocalChecked()) |
2309 .FromJust()); | 2310 .FromJust()); |
(...skipping 1596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3906 ->Set(env.local(), v8_str("Fun"), | 3907 ->Set(env.local(), v8_str("Fun"), |
3907 fun_templ->GetFunction(env.local()).ToLocalChecked()) | 3908 fun_templ->GetFunction(env.local()).ToLocalChecked()) |
3908 .FromJust()); | 3909 .FromJust()); |
3909 | 3910 |
3910 CompileRun( | 3911 CompileRun( |
3911 "var f = new Fun();" | 3912 "var f = new Fun();" |
3912 "Number.prototype.__proto__ = f;" | 3913 "Number.prototype.__proto__ = f;" |
3913 "var a = 42;" | 3914 "var a = 42;" |
3914 "for (var i = 0; i<3; i++) { a.foo; }"); | 3915 "for (var i = 0; i<3; i++) { a.foo; }"); |
3915 } | 3916 } |
OLD | NEW |