Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(289)

Side by Side Diff: test/cctest/test-api.cc

Issue 341453003: Support symbol-named properties in API (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/stub-cache.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 56
57 using ::v8::Boolean; 57 using ::v8::Boolean;
58 using ::v8::BooleanObject; 58 using ::v8::BooleanObject;
59 using ::v8::Context; 59 using ::v8::Context;
60 using ::v8::Extension; 60 using ::v8::Extension;
61 using ::v8::Function; 61 using ::v8::Function;
62 using ::v8::FunctionTemplate; 62 using ::v8::FunctionTemplate;
63 using ::v8::Handle; 63 using ::v8::Handle;
64 using ::v8::HandleScope; 64 using ::v8::HandleScope;
65 using ::v8::Local; 65 using ::v8::Local;
66 using ::v8::Name;
66 using ::v8::Message; 67 using ::v8::Message;
67 using ::v8::MessageCallback; 68 using ::v8::MessageCallback;
68 using ::v8::Object; 69 using ::v8::Object;
69 using ::v8::ObjectTemplate; 70 using ::v8::ObjectTemplate;
70 using ::v8::Persistent; 71 using ::v8::Persistent;
71 using ::v8::Script; 72 using ::v8::Script;
72 using ::v8::StackTrace; 73 using ::v8::StackTrace;
73 using ::v8::String; 74 using ::v8::String;
75 using ::v8::Symbol;
74 using ::v8::TryCatch; 76 using ::v8::TryCatch;
75 using ::v8::Undefined; 77 using ::v8::Undefined;
76 using ::v8::UniqueId; 78 using ::v8::UniqueId;
77 using ::v8::V8; 79 using ::v8::V8;
78 using ::v8::Value; 80 using ::v8::Value;
79 81
80 82
81 #define THREADED_PROFILED_TEST(Name) \ 83 #define THREADED_PROFILED_TEST(Name) \
82 static void Test##Name(); \ 84 static void Test##Name(); \
83 TEST(Name##WithProfiler) { \ 85 TEST(Name##WithProfiler) { \
(...skipping 1785 matching lines...) Expand 10 before | Expand all | Expand 10 after
1869 info.GetReturnValue().Set( 1871 info.GetReturnValue().Set(
1870 self->Get(String::Concat(v8_str("accessor_"), name))); 1872 self->Get(String::Concat(v8_str("accessor_"), name)));
1871 } 1873 }
1872 1874
1873 void SimpleAccessorSetter(Local<String> name, Local<Value> value, 1875 void SimpleAccessorSetter(Local<String> name, Local<Value> value,
1874 const v8::PropertyCallbackInfo<void>& info) { 1876 const v8::PropertyCallbackInfo<void>& info) {
1875 Handle<Object> self = Handle<Object>::Cast(info.This()); 1877 Handle<Object> self = Handle<Object>::Cast(info.This());
1876 self->Set(String::Concat(v8_str("accessor_"), name), value); 1878 self->Set(String::Concat(v8_str("accessor_"), name), value);
1877 } 1879 }
1878 1880
1881 void SymbolAccessorGetter(Local<Symbol> name,
1882 const v8::PropertyCallbackInfo<v8::Value>& info) {
1883 if (name->Name()->IsUndefined())
1884 return;
1885 SimpleAccessorGetter(Local<String>::Cast(name->Name()), info);
1886 }
1887
1888 void SymbolAccessorSetter(Local<Symbol> name, Local<Value> value,
1889 const v8::PropertyCallbackInfo<void>& info) {
1890 if (name->Name()->IsUndefined())
1891 return;
1892 SimpleAccessorSetter(Local<String>::Cast(name->Name()), value, info);
1893 }
1894
1879 void EmptyInterceptorGetter(Local<String> name, 1895 void EmptyInterceptorGetter(Local<String> name,
1880 const v8::PropertyCallbackInfo<v8::Value>& info) { 1896 const v8::PropertyCallbackInfo<v8::Value>& info) {
1881 } 1897 }
1882 1898
1883 void EmptyInterceptorSetter(Local<String> name, 1899 void EmptyInterceptorSetter(Local<String> name,
1884 Local<Value> value, 1900 Local<Value> value,
1885 const v8::PropertyCallbackInfo<v8::Value>& info) { 1901 const v8::PropertyCallbackInfo<v8::Value>& info) {
1886 } 1902 }
1887 1903
1904 void EmptyGenericInterceptorGetter(Local<Name> name,
1905 const v8::PropertyCallbackInfo<v8::Value>& info) {
1906 }
1907
1908 void EmptyGenericInterceptorSetter(Local<Name> name,
1909 Local<Value> value,
1910 const v8::PropertyCallbackInfo<v8::Value>& info) {
1911 }
1912
1888 void InterceptorGetter(Local<String> name, 1913 void InterceptorGetter(Local<String> name,
1889 const v8::PropertyCallbackInfo<v8::Value>& info) { 1914 const v8::PropertyCallbackInfo<v8::Value>& info) {
1890 // Intercept names that start with 'interceptor_'. 1915 // Intercept names that start with 'interceptor_'.
1891 String::Utf8Value utf8(name); 1916 String::Utf8Value utf8(name);
1892 char* name_str = *utf8; 1917 char* name_str = *utf8;
1893 char prefix[] = "interceptor_"; 1918 char prefix[] = "interceptor_";
1894 int i; 1919 int i;
1895 for (i = 0; name_str[i] && prefix[i]; ++i) { 1920 for (i = 0; name_str[i] && prefix[i]; ++i) {
1896 if (name_str[i] != prefix[i]) return; 1921 if (name_str[i] != prefix[i]) return;
1897 } 1922 }
(...skipping 15 matching lines...) Expand all
1913 } 1938 }
1914 if (!prefix[i]) return; 1939 if (!prefix[i]) return;
1915 1940
1916 if (value->IsInt32() && value->Int32Value() < 10000) { 1941 if (value->IsInt32() && value->Int32Value() < 10000) {
1917 Handle<Object> self = Handle<Object>::Cast(info.This()); 1942 Handle<Object> self = Handle<Object>::Cast(info.This());
1918 self->SetHiddenValue(name, value); 1943 self->SetHiddenValue(name, value);
1919 info.GetReturnValue().Set(value); 1944 info.GetReturnValue().Set(value);
1920 } 1945 }
1921 } 1946 }
1922 1947
1948 void GenericInterceptorGetter(Local<Name> generic_name,
1949 const v8::PropertyCallbackInfo<v8::Value>& info) {
1950 Local<String> str;
1951 if (generic_name->IsSymbol()) {
1952 Local<Value> name = Local<Symbol>::Cast(generic_name)->Name();
1953 if (name->IsUndefined()) return;
1954 str = String::Concat(v8_str("_sym_"), Local<String>::Cast(name));
1955 } else {
1956 Local<String> name = Local<String>::Cast(generic_name);
1957 String::Utf8Value utf8(name);
1958 char* name_str = *utf8;
1959 if (*name_str == '_') return;
1960 str = String::Concat(v8_str("_str_"), name);
1961 }
1962
1963 Handle<Object> self = Handle<Object>::Cast(info.This());
1964 info.GetReturnValue().Set(self->Get(str));
1965 }
1966
1967 void GenericInterceptorSetter(Local<Name> generic_name,
1968 Local<Value> value,
1969 const v8::PropertyCallbackInfo<v8::Value>& info) {
1970 Local<String> str;
1971 if (generic_name->IsSymbol()) {
1972 Local<Value> name = Local<Symbol>::Cast(generic_name)->Name();
1973 if (name->IsUndefined()) return;
1974 str = String::Concat(v8_str("_sym_"), Local<String>::Cast(name));
1975 } else {
1976 Local<String> name = Local<String>::Cast(generic_name);
1977 String::Utf8Value utf8(name);
1978 char* name_str = *utf8;
1979 if (*name_str == '_') return;
1980 str = String::Concat(v8_str("_str_"), name);
1981 }
1982
1983 Handle<Object> self = Handle<Object>::Cast(info.This());
1984 self->Set(str, value);
1985 info.GetReturnValue().Set(value);
1986 }
1987
1923 void AddAccessor(Handle<FunctionTemplate> templ, 1988 void AddAccessor(Handle<FunctionTemplate> templ,
1924 Handle<String> name, 1989 Handle<String> name,
1925 v8::AccessorGetterCallback getter, 1990 v8::AccessorGetterCallback getter,
1926 v8::AccessorSetterCallback setter) { 1991 v8::AccessorSetterCallback setter) {
1927 templ->PrototypeTemplate()->SetAccessor(name, getter, setter); 1992 templ->PrototypeTemplate()->SetAccessor(name, getter, setter);
1928 } 1993 }
1929 1994
1930 void AddInterceptor(Handle<FunctionTemplate> templ, 1995 void AddInterceptor(Handle<FunctionTemplate> templ,
1931 v8::NamedPropertyGetterCallback getter, 1996 v8::NamedPropertyGetterCallback getter,
1932 v8::NamedPropertySetterCallback setter) { 1997 v8::NamedPropertySetterCallback setter) {
1933 templ->InstanceTemplate()->SetNamedPropertyHandler(getter, setter); 1998 templ->InstanceTemplate()->SetNamedPropertyHandler(getter, setter);
1934 } 1999 }
1935 2000
1936 2001
2002 void AddAccessor(Handle<FunctionTemplate> templ,
2003 Handle<Symbol> name,
2004 v8::AccessorSymbolGetterCallback getter,
2005 v8::AccessorSymbolSetterCallback setter) {
2006 templ->PrototypeTemplate()->SetAccessor(name, getter, setter);
2007 }
2008
2009 void AddGenericInterceptor(Handle<FunctionTemplate> templ,
2010 v8::GenericNamedPropertyGetterCallback getter,
2011 v8::GenericNamedPropertySetterCallback setter) {
2012 templ->InstanceTemplate()->SetGenericNamedPropertyHandler(getter, setter);
2013 }
2014
2015
1937 THREADED_TEST(EmptyInterceptorDoesNotShadowAccessors) { 2016 THREADED_TEST(EmptyInterceptorDoesNotShadowAccessors) {
1938 v8::HandleScope scope(CcTest::isolate()); 2017 v8::HandleScope scope(CcTest::isolate());
1939 Handle<FunctionTemplate> parent = FunctionTemplate::New(CcTest::isolate()); 2018 Handle<FunctionTemplate> parent = FunctionTemplate::New(CcTest::isolate());
1940 Handle<FunctionTemplate> child = FunctionTemplate::New(CcTest::isolate()); 2019 Handle<FunctionTemplate> child = FunctionTemplate::New(CcTest::isolate());
1941 child->Inherit(parent); 2020 child->Inherit(parent);
1942 AddAccessor(parent, v8_str("age"), 2021 AddAccessor(parent, v8_str("age"),
1943 SimpleAccessorGetter, SimpleAccessorSetter); 2022 SimpleAccessorGetter, SimpleAccessorSetter);
1944 AddInterceptor(child, EmptyInterceptorGetter, EmptyInterceptorSetter); 2023 AddInterceptor(child, EmptyInterceptorGetter, EmptyInterceptorSetter);
1945 LocalContext env; 2024 LocalContext env;
1946 env->Global()->Set(v8_str("Child"), child->GetFunction()); 2025 env->Global()->Set(v8_str("Child"), child->GetFunction());
1947 CompileRun("var child = new Child;" 2026 CompileRun("var child = new Child;"
1948 "child.age = 10;"); 2027 "child.age = 10;");
1949 ExpectBoolean("child.hasOwnProperty('age')", false); 2028 ExpectBoolean("child.hasOwnProperty('age')", false);
1950 ExpectInt32("child.age", 10); 2029 ExpectInt32("child.age", 10);
1951 ExpectInt32("child.accessor_age", 10); 2030 ExpectInt32("child.accessor_age", 10);
1952 } 2031 }
1953 2032
1954 2033
2034 THREADED_TEST(LegacyInterceptorDoesNotSeeSymbols) {
2035 i::FLAG_harmony_symbols = true;
2036
2037 LocalContext env;
2038 v8::Isolate* isolate = CcTest::isolate();
2039 v8::HandleScope scope(isolate);
2040 Handle<FunctionTemplate> parent = FunctionTemplate::New(isolate);
2041 Handle<FunctionTemplate> child = FunctionTemplate::New(isolate);
2042 v8::Local<v8::Symbol> age = v8::Symbol::New(isolate, v8_str("age"));
2043
2044 child->Inherit(parent);
2045 AddAccessor(parent, age, SymbolAccessorGetter, SymbolAccessorSetter);
2046 AddInterceptor(child, InterceptorGetter, InterceptorSetter);
2047
2048 env->Global()->Set(v8_str("Child"), child->GetFunction());
2049 env->Global()->Set(v8_str("age"), age);
2050 CompileRun("var child = new Child;"
2051 "child[age] = 10;");
2052 ExpectInt32("child[age]", 10);
2053 ExpectBoolean("child.hasOwnProperty('age')", false);
2054 ExpectBoolean("child.hasOwnProperty('accessor_age')", true);
2055 }
2056
2057
2058 THREADED_TEST(GenericInterceptorDoesSeeSymbols) {
2059 i::FLAG_harmony_symbols = true;
2060
2061 LocalContext env;
2062 v8::Isolate* isolate = CcTest::isolate();
2063 v8::HandleScope scope(isolate);
2064 Handle<FunctionTemplate> parent = FunctionTemplate::New(isolate);
2065 Handle<FunctionTemplate> child = FunctionTemplate::New(isolate);
2066 v8::Local<v8::Symbol> age = v8::Symbol::New(isolate, v8_str("age"));
2067 v8::Local<v8::Symbol> anon = v8::Symbol::New(isolate);
2068
2069 child->Inherit(parent);
2070 AddAccessor(parent, age, SymbolAccessorGetter, SymbolAccessorSetter);
2071 AddGenericInterceptor(
2072 child, GenericInterceptorGetter, GenericInterceptorSetter);
2073
2074 env->Global()->Set(v8_str("Child"), child->GetFunction());
2075 env->Global()->Set(v8_str("age"), age);
2076 env->Global()->Set(v8_str("anon"), anon);
2077 CompileRun("var child = new Child;"
2078 "child[age] = 10;");
2079 ExpectInt32("child[age]", 10);
2080 ExpectInt32("child._sym_age", 10);
2081
2082 // Check that it also sees strings.
2083 CompileRun("child.foo = 47");
2084 ExpectInt32("child.foo", 47);
2085 ExpectInt32("child._str_foo", 47);
2086
2087 // Check that the interceptor can punt (in this case, on anonymous symbols).
2088 CompileRun("child[anon] = 31337");
2089 ExpectInt32("child[anon]", 31337);
2090 }
2091
2092
1955 THREADED_TEST(ExecutableAccessorIsPreservedOnAttributeChange) { 2093 THREADED_TEST(ExecutableAccessorIsPreservedOnAttributeChange) {
1956 v8::Isolate* isolate = CcTest::isolate(); 2094 v8::Isolate* isolate = CcTest::isolate();
1957 v8::HandleScope scope(isolate); 2095 v8::HandleScope scope(isolate);
1958 LocalContext env; 2096 LocalContext env;
1959 v8::Local<v8::Value> res = CompileRun("var a = []; a;"); 2097 v8::Local<v8::Value> res = CompileRun("var a = []; a;");
1960 i::Handle<i::JSObject> a(v8::Utils::OpenHandle(v8::Object::Cast(*res))); 2098 i::Handle<i::JSObject> a(v8::Utils::OpenHandle(v8::Object::Cast(*res)));
1961 CHECK(a->map()->instance_descriptors()->IsFixedArray()); 2099 CHECK(a->map()->instance_descriptors()->IsFixedArray());
1962 CHECK_GT(i::FixedArray::cast(a->map()->instance_descriptors())->length(), 0); 2100 CHECK_GT(i::FixedArray::cast(a->map()->instance_descriptors())->length(), 0);
1963 CompileRun("Object.defineProperty(a, 'length', { writable: false });"); 2101 CompileRun("Object.defineProperty(a, 'length', { writable: false });");
1964 CHECK_EQ(i::FixedArray::cast(a->map()->instance_descriptors())->length(), 0); 2102 CHECK_EQ(i::FixedArray::cast(a->map()->instance_descriptors())->length(), 0);
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after
2740 i::FLAG_harmony_symbols = true; 2878 i::FLAG_harmony_symbols = true;
2741 2879
2742 LocalContext env; 2880 LocalContext env;
2743 v8::Isolate* isolate = env->GetIsolate(); 2881 v8::Isolate* isolate = env->GetIsolate();
2744 v8::HandleScope scope(isolate); 2882 v8::HandleScope scope(isolate);
2745 2883
2746 v8::Local<v8::Object> obj = v8::Object::New(isolate); 2884 v8::Local<v8::Object> obj = v8::Object::New(isolate);
2747 v8::Local<v8::Symbol> sym1 = v8::Symbol::New(isolate); 2885 v8::Local<v8::Symbol> sym1 = v8::Symbol::New(isolate);
2748 v8::Local<v8::Symbol> sym2 = 2886 v8::Local<v8::Symbol> sym2 =
2749 v8::Symbol::New(isolate, v8_str("my-symbol")); 2887 v8::Symbol::New(isolate, v8_str("my-symbol"));
2888 v8::Local<v8::Symbol> sym3 =
2889 v8::Symbol::New(isolate, v8_str("sym3"));
2750 2890
2751 CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags); 2891 CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
2752 2892
2753 // Check basic symbol functionality. 2893 // Check basic symbol functionality.
2754 CHECK(sym1->IsSymbol()); 2894 CHECK(sym1->IsSymbol());
2755 CHECK(sym2->IsSymbol()); 2895 CHECK(sym2->IsSymbol());
2756 CHECK(!obj->IsSymbol()); 2896 CHECK(!obj->IsSymbol());
2757 2897
2758 CHECK(sym1->Equals(sym1)); 2898 CHECK(sym1->Equals(sym1));
2759 CHECK(sym2->Equals(sym2)); 2899 CHECK(sym2->Equals(sym2));
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2795 2935
2796 CHECK_EQ(0, obj->GetOwnPropertyNames()->Length()); 2936 CHECK_EQ(0, obj->GetOwnPropertyNames()->Length());
2797 int num_props = obj->GetPropertyNames()->Length(); 2937 int num_props = obj->GetPropertyNames()->Length();
2798 CHECK(obj->Set(v8::String::NewFromUtf8(isolate, "bla"), 2938 CHECK(obj->Set(v8::String::NewFromUtf8(isolate, "bla"),
2799 v8::Integer::New(isolate, 20))); 2939 v8::Integer::New(isolate, 20)));
2800 CHECK_EQ(1, obj->GetOwnPropertyNames()->Length()); 2940 CHECK_EQ(1, obj->GetOwnPropertyNames()->Length());
2801 CHECK_EQ(num_props + 1, obj->GetPropertyNames()->Length()); 2941 CHECK_EQ(num_props + 1, obj->GetPropertyNames()->Length());
2802 2942
2803 CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags); 2943 CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
2804 2944
2945 CHECK(obj->SetAccessor(sym3, SymbolAccessorGetter, SymbolAccessorSetter));
2946 CHECK(obj->Get(sym3)->IsUndefined());
2947 CHECK(obj->Set(sym3, v8::Integer::New(isolate, 42)));
2948 CHECK(obj->Get(sym3)->Equals(v8::Integer::New(isolate, 42)));
2949 CHECK(obj->Get(v8::String::NewFromUtf8(isolate, "accessor_sym3"))->Equals(
2950 v8::Integer::New(isolate, 42)));
2951
2805 // Add another property and delete it afterwards to force the object in 2952 // Add another property and delete it afterwards to force the object in
2806 // slow case. 2953 // slow case.
2807 CHECK(obj->Set(sym2, v8::Integer::New(isolate, 2008))); 2954 CHECK(obj->Set(sym2, v8::Integer::New(isolate, 2008)));
2808 CHECK_EQ(2002, obj->Get(sym1)->Int32Value()); 2955 CHECK_EQ(2002, obj->Get(sym1)->Int32Value());
2809 CHECK_EQ(2008, obj->Get(sym2)->Int32Value()); 2956 CHECK_EQ(2008, obj->Get(sym2)->Int32Value());
2810 CHECK_EQ(2002, obj->Get(sym1)->Int32Value()); 2957 CHECK_EQ(2002, obj->Get(sym1)->Int32Value());
2811 CHECK_EQ(1, obj->GetOwnPropertyNames()->Length()); 2958 CHECK_EQ(2, obj->GetOwnPropertyNames()->Length());
2812 2959
2813 CHECK(obj->Has(sym1)); 2960 CHECK(obj->Has(sym1));
2814 CHECK(obj->Has(sym2)); 2961 CHECK(obj->Has(sym2));
2962 CHECK(obj->Has(sym3));
2963 CHECK(obj->Has(v8::String::NewFromUtf8(isolate, "accessor_sym3")));
2815 CHECK(obj->Delete(sym2)); 2964 CHECK(obj->Delete(sym2));
2816 CHECK(obj->Has(sym1)); 2965 CHECK(obj->Has(sym1));
2817 CHECK(!obj->Has(sym2)); 2966 CHECK(!obj->Has(sym2));
2967 CHECK(obj->Has(sym3));
2968 CHECK(obj->Has(v8::String::NewFromUtf8(isolate, "accessor_sym3")));
2818 CHECK_EQ(2002, obj->Get(sym1)->Int32Value()); 2969 CHECK_EQ(2002, obj->Get(sym1)->Int32Value());
2819 CHECK_EQ(1, obj->GetOwnPropertyNames()->Length()); 2970 CHECK(obj->Get(sym3)->Equals(v8::Integer::New(isolate, 42)));
2971 CHECK(obj->Get(v8::String::NewFromUtf8(isolate, "accessor_sym3"))->Equals(
2972 v8::Integer::New(isolate, 42)));
2973 CHECK_EQ(2, obj->GetOwnPropertyNames()->Length());
2820 2974
2821 // Symbol properties are inherited. 2975 // Symbol properties are inherited.
2822 v8::Local<v8::Object> child = v8::Object::New(isolate); 2976 v8::Local<v8::Object> child = v8::Object::New(isolate);
2823 child->SetPrototype(obj); 2977 child->SetPrototype(obj);
2824 CHECK(child->Has(sym1)); 2978 CHECK(child->Has(sym1));
2825 CHECK_EQ(2002, child->Get(sym1)->Int32Value()); 2979 CHECK_EQ(2002, child->Get(sym1)->Int32Value());
2980 CHECK(obj->Get(sym3)->Equals(v8::Integer::New(isolate, 42)));
2981 CHECK(obj->Get(v8::String::NewFromUtf8(isolate, "accessor_sym3"))->Equals(
2982 v8::Integer::New(isolate, 42)));
2826 CHECK_EQ(0, child->GetOwnPropertyNames()->Length()); 2983 CHECK_EQ(0, child->GetOwnPropertyNames()->Length());
2827 } 2984 }
2828 2985
2829 2986
2830 THREADED_TEST(PrivateProperties) { 2987 THREADED_TEST(PrivateProperties) {
2831 LocalContext env; 2988 LocalContext env;
2832 v8::Isolate* isolate = env->GetIsolate(); 2989 v8::Isolate* isolate = env->GetIsolate();
2833 v8::HandleScope scope(isolate); 2990 v8::HandleScope scope(isolate);
2834 2991
2835 v8::Local<v8::Object> obj = v8::Object::New(isolate); 2992 v8::Local<v8::Object> obj = v8::Object::New(isolate);
(...skipping 19963 matching lines...) Expand 10 before | Expand all | Expand 10 after
22799 call_eval_context = v8::Context::New(isolate); 22956 call_eval_context = v8::Context::New(isolate);
22800 v8::Context::Scope scope(call_eval_context); 22957 v8::Context::Scope scope(call_eval_context);
22801 call_eval_bound_function = 22958 call_eval_bound_function =
22802 Local<Function>::Cast(CompileRun("eval.bind(this, '1')")); 22959 Local<Function>::Cast(CompileRun("eval.bind(this, '1')"));
22803 } 22960 }
22804 env->Global()->Set(v8_str("CallEval"), 22961 env->Global()->Set(v8_str("CallEval"),
22805 v8::FunctionTemplate::New(isolate, CallEval)->GetFunction()); 22962 v8::FunctionTemplate::New(isolate, CallEval)->GetFunction());
22806 Local<Value> result = CompileRun("CallEval();"); 22963 Local<Value> result = CompileRun("CallEval();");
22807 CHECK_EQ(result, v8::Integer::New(isolate, 1)); 22964 CHECK_EQ(result, v8::Integer::New(isolate, 1));
22808 } 22965 }
OLDNEW
« no previous file with comments | « src/stub-cache.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698