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 1986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1997 LocalContext env; | 1997 LocalContext env; |
1998 env->Global()->Set(v8_str("Child"), child->GetFunction()); | 1998 env->Global()->Set(v8_str("Child"), child->GetFunction()); |
1999 CompileRun("var child = new Child;" | 1999 CompileRun("var child = new Child;" |
2000 "child.age = 10;"); | 2000 "child.age = 10;"); |
2001 ExpectBoolean("child.hasOwnProperty('age')", false); | 2001 ExpectBoolean("child.hasOwnProperty('age')", false); |
2002 ExpectInt32("child.age", 10); | 2002 ExpectInt32("child.age", 10); |
2003 ExpectInt32("child.accessor_age", 10); | 2003 ExpectInt32("child.accessor_age", 10); |
2004 } | 2004 } |
2005 | 2005 |
2006 | 2006 |
| 2007 THREADED_TEST(ExecutableAccessorIsPreservedOnAttributeChange) { |
| 2008 v8::Isolate* isolate = CcTest::isolate(); |
| 2009 v8::HandleScope scope(isolate); |
| 2010 LocalContext env; |
| 2011 v8::Local<v8::Value> res = CompileRun("var a = []; a;"); |
| 2012 i::Handle<i::JSObject> a(v8::Utils::OpenHandle(v8::Object::Cast(*res))); |
| 2013 CHECK(a->map()->instance_descriptors()->IsFixedArray()); |
| 2014 CHECK_GT(i::FixedArray::cast(a->map()->instance_descriptors())->length(), 0); |
| 2015 CompileRun("Object.defineProperty(a, 'length', { writable: false });"); |
| 2016 CHECK_EQ(i::FixedArray::cast(a->map()->instance_descriptors())->length(), 0); |
| 2017 // But we should still have an ExecutableAccessorInfo. |
| 2018 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
| 2019 i::LookupResult lookup(i_isolate); |
| 2020 i::Handle<i::String> name(v8::Utils::OpenHandle(*v8_str("length"))); |
| 2021 a->LocalLookupRealNamedProperty(name, &lookup); |
| 2022 CHECK(lookup.IsPropertyCallbacks()); |
| 2023 i::Handle<i::Object> callback(lookup.GetCallbackObject(), i_isolate); |
| 2024 CHECK(callback->IsExecutableAccessorInfo()); |
| 2025 } |
| 2026 |
| 2027 |
2007 THREADED_TEST(EmptyInterceptorBreakTransitions) { | 2028 THREADED_TEST(EmptyInterceptorBreakTransitions) { |
2008 v8::HandleScope scope(CcTest::isolate()); | 2029 v8::HandleScope scope(CcTest::isolate()); |
2009 Handle<FunctionTemplate> templ = FunctionTemplate::New(CcTest::isolate()); | 2030 Handle<FunctionTemplate> templ = FunctionTemplate::New(CcTest::isolate()); |
2010 AddInterceptor(templ, EmptyInterceptorGetter, EmptyInterceptorSetter); | 2031 AddInterceptor(templ, EmptyInterceptorGetter, EmptyInterceptorSetter); |
2011 LocalContext env; | 2032 LocalContext env; |
2012 env->Global()->Set(v8_str("Constructor"), templ->GetFunction()); | 2033 env->Global()->Set(v8_str("Constructor"), templ->GetFunction()); |
2013 CompileRun("var o1 = new Constructor;" | 2034 CompileRun("var o1 = new Constructor;" |
2014 "o1.a = 1;" // Ensure a and x share the descriptor array. | 2035 "o1.a = 1;" // Ensure a and x share the descriptor array. |
2015 "Object.defineProperty(o1, 'x', {value: 10});"); | 2036 "Object.defineProperty(o1, 'x', {value: 10});"); |
2016 CompileRun("var o2 = new Constructor;" | 2037 CompileRun("var o2 = new Constructor;" |
(...skipping 20501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
22518 v8::internal::FLAG_stack_size = 150; | 22539 v8::internal::FLAG_stack_size = 150; |
22519 LocalContext current; | 22540 LocalContext current; |
22520 v8::Isolate* isolate = current->GetIsolate(); | 22541 v8::Isolate* isolate = current->GetIsolate(); |
22521 v8::HandleScope scope(isolate); | 22542 v8::HandleScope scope(isolate); |
22522 V8::SetCaptureStackTraceForUncaughtExceptions( | 22543 V8::SetCaptureStackTraceForUncaughtExceptions( |
22523 true, 10, v8::StackTrace::kDetailed); | 22544 true, 10, v8::StackTrace::kDetailed); |
22524 v8::TryCatch try_catch; | 22545 v8::TryCatch try_catch; |
22525 CompileRun("(function f(x) { f(x+1); })(0)"); | 22546 CompileRun("(function f(x) { f(x+1); })(0)"); |
22526 CHECK(try_catch.HasCaught()); | 22547 CHECK(try_catch.HasCaught()); |
22527 } | 22548 } |
OLD | NEW |