OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1992 LocalContext env; | 1992 LocalContext env; |
1993 env->Global()->Set(v8_str("Child"), child->GetFunction()); | 1993 env->Global()->Set(v8_str("Child"), child->GetFunction()); |
1994 CompileRun("var child = new Child;" | 1994 CompileRun("var child = new Child;" |
1995 "child.age = 10;"); | 1995 "child.age = 10;"); |
1996 ExpectBoolean("child.hasOwnProperty('age')", false); | 1996 ExpectBoolean("child.hasOwnProperty('age')", false); |
1997 ExpectInt32("child.age", 10); | 1997 ExpectInt32("child.age", 10); |
1998 ExpectInt32("child.accessor_age", 10); | 1998 ExpectInt32("child.accessor_age", 10); |
1999 } | 1999 } |
2000 | 2000 |
2001 | 2001 |
| 2002 THREADED_TEST(EmptyInterceptorBreakTransitions) { |
| 2003 v8::HandleScope scope(CcTest::isolate()); |
| 2004 Handle<FunctionTemplate> templ = FunctionTemplate::New(CcTest::isolate()); |
| 2005 AddInterceptor(templ, EmptyInterceptorGetter, EmptyInterceptorSetter); |
| 2006 LocalContext env; |
| 2007 env->Global()->Set(v8_str("Constructor"), templ->GetFunction()); |
| 2008 CompileRun("var o1 = new Constructor;" |
| 2009 "o1.a = 1;" // Ensure a and x share the descriptor array. |
| 2010 "Object.defineProperty(o1, 'x', {value: 10});"); |
| 2011 CompileRun("var o2 = new Constructor;" |
| 2012 "o2.a = 1;" |
| 2013 "Object.defineProperty(o2, 'x', {value: 10});"); |
| 2014 } |
| 2015 |
| 2016 |
2002 THREADED_TEST(EmptyInterceptorDoesNotShadowJSAccessors) { | 2017 THREADED_TEST(EmptyInterceptorDoesNotShadowJSAccessors) { |
2003 v8::Isolate* isolate = CcTest::isolate(); | 2018 v8::Isolate* isolate = CcTest::isolate(); |
2004 v8::HandleScope scope(isolate); | 2019 v8::HandleScope scope(isolate); |
2005 Handle<FunctionTemplate> parent = FunctionTemplate::New(isolate); | 2020 Handle<FunctionTemplate> parent = FunctionTemplate::New(isolate); |
2006 Handle<FunctionTemplate> child = FunctionTemplate::New(isolate); | 2021 Handle<FunctionTemplate> child = FunctionTemplate::New(isolate); |
2007 child->Inherit(parent); | 2022 child->Inherit(parent); |
2008 AddInterceptor(child, EmptyInterceptorGetter, EmptyInterceptorSetter); | 2023 AddInterceptor(child, EmptyInterceptorGetter, EmptyInterceptorSetter); |
2009 LocalContext env; | 2024 LocalContext env; |
2010 env->Global()->Set(v8_str("Child"), child->GetFunction()); | 2025 env->Global()->Set(v8_str("Child"), child->GetFunction()); |
2011 CompileRun("var child = new Child;" | 2026 CompileRun("var child = new Child;" |
(...skipping 19805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
21817 context->Global()->Set(v8_str("P"), templ->NewInstance()); | 21832 context->Global()->Set(v8_str("P"), templ->NewInstance()); |
21818 CompileRun( | 21833 CompileRun( |
21819 "function C1() {" | 21834 "function C1() {" |
21820 " this.x = 23;" | 21835 " this.x = 23;" |
21821 "};" | 21836 "};" |
21822 "C1.prototype = P;" | 21837 "C1.prototype = P;" |
21823 "for (var i = 0; i < 4; i++ ) {" | 21838 "for (var i = 0; i < 4; i++ ) {" |
21824 " new C1();" | 21839 " new C1();" |
21825 "}"); | 21840 "}"); |
21826 } | 21841 } |
OLD | NEW |