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 1963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1974 v8::Local<v8::Value> res = CompileRun("var a = []; a;"); | 1974 v8::Local<v8::Value> res = CompileRun("var a = []; a;"); |
1975 i::Handle<i::JSObject> a(v8::Utils::OpenHandle(v8::Object::Cast(*res))); | 1975 i::Handle<i::JSObject> a(v8::Utils::OpenHandle(v8::Object::Cast(*res))); |
1976 CHECK(a->map()->instance_descriptors()->IsFixedArray()); | 1976 CHECK(a->map()->instance_descriptors()->IsFixedArray()); |
1977 CHECK_GT(i::FixedArray::cast(a->map()->instance_descriptors())->length(), 0); | 1977 CHECK_GT(i::FixedArray::cast(a->map()->instance_descriptors())->length(), 0); |
1978 CompileRun("Object.defineProperty(a, 'length', { writable: false });"); | 1978 CompileRun("Object.defineProperty(a, 'length', { writable: false });"); |
1979 CHECK_EQ(i::FixedArray::cast(a->map()->instance_descriptors())->length(), 0); | 1979 CHECK_EQ(i::FixedArray::cast(a->map()->instance_descriptors())->length(), 0); |
1980 // But we should still have an ExecutableAccessorInfo. | 1980 // But we should still have an ExecutableAccessorInfo. |
1981 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 1981 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
1982 i::LookupResult lookup(i_isolate); | 1982 i::LookupResult lookup(i_isolate); |
1983 i::Handle<i::String> name(v8::Utils::OpenHandle(*v8_str("length"))); | 1983 i::Handle<i::String> name(v8::Utils::OpenHandle(*v8_str("length"))); |
1984 a->LookupOwnRealNamedProperty(name, &lookup); | 1984 i::LookupIterator it(a, name, i::LookupIterator::CHECK_PROPERTY); |
1985 CHECK(lookup.IsPropertyCallbacks()); | 1985 CHECK(it.HasProperty()); |
1986 i::Handle<i::Object> callback(lookup.GetCallbackObject(), i_isolate); | 1986 CHECK(it.GetAccessors()->IsExecutableAccessorInfo()); |
1987 CHECK(callback->IsExecutableAccessorInfo()); | |
1988 } | 1987 } |
1989 | 1988 |
1990 | 1989 |
1991 THREADED_TEST(EmptyInterceptorBreakTransitions) { | 1990 THREADED_TEST(EmptyInterceptorBreakTransitions) { |
1992 v8::HandleScope scope(CcTest::isolate()); | 1991 v8::HandleScope scope(CcTest::isolate()); |
1993 Handle<FunctionTemplate> templ = FunctionTemplate::New(CcTest::isolate()); | 1992 Handle<FunctionTemplate> templ = FunctionTemplate::New(CcTest::isolate()); |
1994 AddInterceptor(templ, EmptyInterceptorGetter, EmptyInterceptorSetter); | 1993 AddInterceptor(templ, EmptyInterceptorGetter, EmptyInterceptorSetter); |
1995 LocalContext env; | 1994 LocalContext env; |
1996 env->Global()->Set(v8_str("Constructor"), templ->GetFunction()); | 1995 env->Global()->Set(v8_str("Constructor"), templ->GetFunction()); |
1997 CompileRun("var o1 = new Constructor;" | 1996 CompileRun("var o1 = new Constructor;" |
(...skipping 20901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
22899 desc = x->GetOwnPropertyDescriptor(v8_str("p1")); | 22898 desc = x->GetOwnPropertyDescriptor(v8_str("p1")); |
22900 Local<Function> set = | 22899 Local<Function> set = |
22901 Local<Function>::Cast(Local<Object>::Cast(desc)->Get(v8_str("set"))); | 22900 Local<Function>::Cast(Local<Object>::Cast(desc)->Get(v8_str("set"))); |
22902 Local<Function> get = | 22901 Local<Function> get = |
22903 Local<Function>::Cast(Local<Object>::Cast(desc)->Get(v8_str("get"))); | 22902 Local<Function>::Cast(Local<Object>::Cast(desc)->Get(v8_str("get"))); |
22904 CHECK_EQ(v8_num(13), get->Call(x, 0, NULL)); | 22903 CHECK_EQ(v8_num(13), get->Call(x, 0, NULL)); |
22905 Handle<Value> args[] = { v8_num(14) }; | 22904 Handle<Value> args[] = { v8_num(14) }; |
22906 set->Call(x, 1, args); | 22905 set->Call(x, 1, args); |
22907 CHECK_EQ(v8_num(14), get->Call(x, 0, NULL)); | 22906 CHECK_EQ(v8_num(14), get->Call(x, 0, NULL)); |
22908 } | 22907 } |
OLD | NEW |