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

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

Issue 368783006: Treat ExecutableAccessorInfo as regular data properties. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 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
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 1906 matching lines...) Expand 10 before | Expand all | Expand 10 after
1917 Handle<Object> self = Handle<Object>::Cast(info.This()); 1917 Handle<Object> self = Handle<Object>::Cast(info.This());
1918 self->SetHiddenValue(name, value); 1918 self->SetHiddenValue(name, value);
1919 info.GetReturnValue().Set(value); 1919 info.GetReturnValue().Set(value);
1920 } 1920 }
1921 } 1921 }
1922 1922
1923 void AddAccessor(Handle<FunctionTemplate> templ, 1923 void AddAccessor(Handle<FunctionTemplate> templ,
1924 Handle<String> name, 1924 Handle<String> name,
1925 v8::AccessorGetterCallback getter, 1925 v8::AccessorGetterCallback getter,
1926 v8::AccessorSetterCallback setter) { 1926 v8::AccessorSetterCallback setter) {
1927 templ->PrototypeTemplate()->SetAccessor(name, getter, setter); 1927 templ->InstanceTemplate()->SetAccessor(name, getter, setter);
1928 } 1928 }
1929 1929
1930 void AddInterceptor(Handle<FunctionTemplate> templ, 1930 void AddInterceptor(Handle<FunctionTemplate> templ,
1931 v8::NamedPropertyGetterCallback getter, 1931 v8::NamedPropertyGetterCallback getter,
1932 v8::NamedPropertySetterCallback setter) { 1932 v8::NamedPropertySetterCallback setter) {
1933 templ->InstanceTemplate()->SetNamedPropertyHandler(getter, setter); 1933 templ->InstanceTemplate()->SetNamedPropertyHandler(getter, setter);
1934 } 1934 }
1935 1935
1936 1936
1937 THREADED_TEST(EmptyInterceptorDoesNotShadowAccessors) { 1937 THREADED_TEST(EmptyInterceptorDoesNotShadowAccessors) {
1938 v8::HandleScope scope(CcTest::isolate()); 1938 v8::HandleScope scope(CcTest::isolate());
1939 Handle<FunctionTemplate> parent = FunctionTemplate::New(CcTest::isolate()); 1939 Handle<FunctionTemplate> parent = FunctionTemplate::New(CcTest::isolate());
1940 parent->SetHiddenPrototype(true);
1940 Handle<FunctionTemplate> child = FunctionTemplate::New(CcTest::isolate()); 1941 Handle<FunctionTemplate> child = FunctionTemplate::New(CcTest::isolate());
1941 child->Inherit(parent); 1942 child->Inherit(parent);
1942 AddAccessor(parent, v8_str("age"), 1943 AddAccessor(parent, v8_str("age"),
1943 SimpleAccessorGetter, SimpleAccessorSetter); 1944 SimpleAccessorGetter, SimpleAccessorSetter);
1944 AddInterceptor(child, EmptyInterceptorGetter, EmptyInterceptorSetter); 1945 AddInterceptor(child, EmptyInterceptorGetter, EmptyInterceptorSetter);
1945 LocalContext env; 1946 LocalContext env;
1946 env->Global()->Set(v8_str("Child"), child->GetFunction()); 1947 env->Global()->Set(v8_str("Child"), child->GetFunction());
1947 CompileRun("var child = new Child;" 1948 CompileRun("var child = new Child;"
1948 "child.age = 10;"); 1949 "child.age = 10;");
1949 ExpectBoolean("child.hasOwnProperty('age')", false); 1950 ExpectBoolean("child.hasOwnProperty('age')", true);
1950 ExpectInt32("child.age", 10); 1951 ExpectInt32("child.age", 10);
1951 ExpectInt32("child.accessor_age", 10); 1952 ExpectInt32("child.accessor_age", 10);
1952 } 1953 }
1953 1954
1954 1955
1955 THREADED_TEST(ExecutableAccessorIsPreservedOnAttributeChange) { 1956 THREADED_TEST(ExecutableAccessorIsPreservedOnAttributeChange) {
1956 v8::Isolate* isolate = CcTest::isolate(); 1957 v8::Isolate* isolate = CcTest::isolate();
1957 v8::HandleScope scope(isolate); 1958 v8::HandleScope scope(isolate);
1958 LocalContext env; 1959 LocalContext env;
1959 v8::Local<v8::Value> res = CompileRun("var a = []; a;"); 1960 v8::Local<v8::Value> res = CompileRun("var a = []; a;");
(...skipping 8018 matching lines...) Expand 10 before | Expand all | Expand 10 after
9978 9979
9979 THREADED_TEST(ShadowObject) { 9980 THREADED_TEST(ShadowObject) {
9980 shadow_y = shadow_y_setter_call_count = shadow_y_getter_call_count = 0; 9981 shadow_y = shadow_y_setter_call_count = shadow_y_getter_call_count = 0;
9981 v8::Isolate* isolate = CcTest::isolate(); 9982 v8::Isolate* isolate = CcTest::isolate();
9982 v8::HandleScope handle_scope(isolate); 9983 v8::HandleScope handle_scope(isolate);
9983 9984
9984 Local<ObjectTemplate> global_template = v8::ObjectTemplate::New(isolate); 9985 Local<ObjectTemplate> global_template = v8::ObjectTemplate::New(isolate);
9985 LocalContext context(NULL, global_template); 9986 LocalContext context(NULL, global_template);
9986 9987
9987 Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(isolate); 9988 Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(isolate);
9988 t->InstanceTemplate()->SetNamedPropertyHandler(ShadowNamedGet); 9989 t->SetHiddenPrototype(true);
9989 t->InstanceTemplate()->SetIndexedPropertyHandler(ShadowIndexedGet); 9990 Local<v8::FunctionTemplate> pt = v8::FunctionTemplate::New(isolate);
9990 Local<ObjectTemplate> proto = t->PrototypeTemplate(); 9991 t->Inherit(pt);
9992 Local<ObjectTemplate> proto = pt->PrototypeTemplate();
9991 Local<ObjectTemplate> instance = t->InstanceTemplate(); 9993 Local<ObjectTemplate> instance = t->InstanceTemplate();
9994 instance->SetNamedPropertyHandler(ShadowNamedGet);
9995 instance->SetIndexedPropertyHandler(ShadowIndexedGet);
9992 9996
9993 proto->Set(v8_str("f"), 9997 proto->Set(v8_str("f"),
9994 v8::FunctionTemplate::New(isolate, 9998 v8::FunctionTemplate::New(isolate,
9995 ShadowFunctionCallback, 9999 ShadowFunctionCallback,
9996 Local<Value>())); 10000 Local<Value>()));
9997 proto->Set(v8_str("x"), v8_num(12)); 10001 proto->Set(v8_str("x"), v8_num(12));
9998 10002
9999 instance->SetAccessor(v8_str("y"), ShadowYGetter, ShadowYSetter); 10003 instance->SetAccessor(v8_str("y"), ShadowYGetter, ShadowYSetter);
10000 10004
10001 Local<Value> o = t->GetFunction()->NewInstance(); 10005 Local<Value> o = t->GetFunction()->NewInstance();
(...skipping 8525 matching lines...) Expand 10 before | Expand all | Expand 10 after
18527 CHECK(v8::Utils::OpenHandle(*info.Holder())->IsJSObject()); 18531 CHECK(v8::Utils::OpenHandle(*info.Holder())->IsJSObject());
18528 if (!name->Equals(v8_str("foo"))) return; 18532 if (!name->Equals(v8_str("foo"))) return;
18529 Local<Object>::Cast(info.This())->Set(v8_str("y"), v8_num(23)); 18533 Local<Object>::Cast(info.This())->Set(v8_str("y"), v8_num(23));
18530 info.GetReturnValue().Set(v8_num(23)); 18534 info.GetReturnValue().Set(v8_num(23));
18531 } 18535 }
18532 18536
18533 18537
18534 TEST(SetterOnConstructorPrototype) { 18538 TEST(SetterOnConstructorPrototype) {
18535 v8::Isolate* isolate = CcTest::isolate(); 18539 v8::Isolate* isolate = CcTest::isolate();
18536 v8::HandleScope scope(isolate); 18540 v8::HandleScope scope(isolate);
18537 Local<ObjectTemplate> templ = ObjectTemplate::New(isolate); 18541 Local<FunctionTemplate> templ = FunctionTemplate::New(isolate);
18538 templ->SetAccessor(v8_str("x"), 18542 templ->SetHiddenPrototype(true);
18539 GetterWhichReturns42, 18543 templ->InstanceTemplate()->SetAccessor(
18540 SetterWhichSetsYOnThisTo23); 18544 v8_str("x"), GetterWhichReturns42, SetterWhichSetsYOnThisTo23);
18541 LocalContext context; 18545 LocalContext context;
18542 context->Global()->Set(v8_str("P"), templ->NewInstance()); 18546 context->Global()->Set(v8_str("P"), templ->InstanceTemplate()->NewInstance());
18543 CompileRun("function C1() {" 18547 CompileRun("function C1() {"
18544 " this.x = 23;" 18548 " this.x = 23;"
18545 "};" 18549 "};"
18546 "C1.prototype = P;" 18550 "C1.prototype = P;"
18547 "function C2() {" 18551 "function C2() {"
18548 " this.x = 23" 18552 " this.x = 23"
18549 "};" 18553 "};"
18550 "C2.prototype = { };" 18554 "C2.prototype = { };"
18551 "C2.prototype.__proto__ = P;"); 18555 "C2.prototype.__proto__ = P;");
18552 18556
18553 v8::Local<v8::Script> script; 18557 v8::Local<v8::Script> script;
18554 script = v8_compile("new C1();"); 18558 script = v8_compile("new C1();");
18555 for (int i = 0; i < 10; i++) { 18559 for (int i = 0; i < 10; i++) {
18556 v8::Handle<v8::Object> c1 = v8::Handle<v8::Object>::Cast(script->Run()); 18560 v8::Handle<v8::Object> c1 = v8::Handle<v8::Object>::Cast(script->Run());
18557 CHECK_EQ(42, c1->Get(v8_str("x"))->Int32Value()); 18561 CHECK_EQ(42, c1->Get(v8_str("x"))->Int32Value());
18558 CHECK_EQ(23, c1->Get(v8_str("y"))->Int32Value()); 18562 CHECK_EQ(23, c1->Get(v8_str("y"))->Int32Value());
18559 } 18563 }
18560 18564
18561 script = v8_compile("new C2();"); 18565 script = v8_compile("new C2();");
18562 for (int i = 0; i < 10; i++) { 18566 for (int i = 0; i < 10; i++) {
18563 v8::Handle<v8::Object> c2 = v8::Handle<v8::Object>::Cast(script->Run()); 18567 v8::Handle<v8::Object> c2 = v8::Handle<v8::Object>::Cast(script->Run());
18564 CHECK_EQ(42, c2->Get(v8_str("x"))->Int32Value()); 18568 CHECK_EQ(23, c2->Get(v8_str("x"))->Int32Value());
18565 CHECK_EQ(23, c2->Get(v8_str("y"))->Int32Value());
18566 } 18569 }
18567 } 18570 }
18568 18571
18569 18572
18570 static void NamedPropertyGetterWhichReturns42( 18573 static void NamedPropertyGetterWhichReturns42(
18571 Local<String> name, 18574 Local<String> name,
18572 const v8::PropertyCallbackInfo<v8::Value>& info) { 18575 const v8::PropertyCallbackInfo<v8::Value>& info) {
18573 info.GetReturnValue().Set(v8_num(42)); 18576 info.GetReturnValue().Set(v8_num(42));
18574 } 18577 }
18575 18578
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
18641 script = v8_compile("new C1();"); 18644 script = v8_compile("new C1();");
18642 // Allow enough iterations for the inobject slack tracking logic 18645 // Allow enough iterations for the inobject slack tracking logic
18643 // to finalize instance size and install the fast construct stub. 18646 // to finalize instance size and install the fast construct stub.
18644 for (int i = 0; i < 256; i++) { 18647 for (int i = 0; i < 256; i++) {
18645 v8::Handle<v8::Object> c1 = v8::Handle<v8::Object>::Cast(script->Run()); 18648 v8::Handle<v8::Object> c1 = v8::Handle<v8::Object>::Cast(script->Run());
18646 CHECK_EQ(23, c1->Get(v8_str("x"))->Int32Value()); 18649 CHECK_EQ(23, c1->Get(v8_str("x"))->Int32Value());
18647 CHECK_EQ(42, c1->Get(v8_str("y"))->Int32Value()); 18650 CHECK_EQ(42, c1->Get(v8_str("y"))->Int32Value());
18648 } 18651 }
18649 18652
18650 // Use an API object with accessors as prototype. 18653 // Use an API object with accessors as prototype.
18651 Local<ObjectTemplate> templ = ObjectTemplate::New(isolate); 18654 Local<FunctionTemplate> templ = FunctionTemplate::New(isolate);
18652 templ->SetAccessor(v8_str("x"), 18655 templ->SetHiddenPrototype(true);
18653 GetterWhichReturns42, 18656 templ->InstanceTemplate()->SetAccessor(
18654 SetterWhichSetsYOnThisTo23); 18657 v8_str("x"), GetterWhichReturns42, SetterWhichSetsYOnThisTo23);
18655 context->Global()->Set(v8_str("P"), templ->NewInstance()); 18658 context->Global()->Set(v8_str("P"), templ->InstanceTemplate()->NewInstance());
18656 18659
18657 // This compile will get the code from the compilation cache. 18660 // This compile will get the code from the compilation cache.
18658 CompileRun(source); 18661 CompileRun(source);
18659 18662
18660 script = v8_compile("new C1();"); 18663 script = v8_compile("new C1();");
18661 for (int i = 0; i < 10; i++) { 18664 for (int i = 0; i < 10; i++) {
18662 v8::Handle<v8::Object> c1 = v8::Handle<v8::Object>::Cast(script->Run()); 18665 v8::Handle<v8::Object> c1 = v8::Handle<v8::Object>::Cast(script->Run());
18663 CHECK_EQ(42, c1->Get(v8_str("x"))->Int32Value()); 18666 CHECK_EQ(42, c1->Get(v8_str("x"))->Int32Value());
18664 CHECK_EQ(23, c1->Get(v8_str("y"))->Int32Value()); 18667 CHECK_EQ(23, c1->Get(v8_str("y"))->Int32Value());
18665 } 18668 }
(...skipping 2393 matching lines...) Expand 10 before | Expand all | Expand 10 after
21059 const v8::PropertyCallbackInfo<void>& info) { 21062 const v8::PropertyCallbackInfo<void>& info) {
21060 CHECK_EQ(name, v8_str("foo")); 21063 CHECK_EQ(name, v8_str("foo"));
21061 CHECK_EQ(value, v8_num(23)); 21064 CHECK_EQ(value, v8_num(23));
21062 instance_checked_setter_count++; 21065 instance_checked_setter_count++;
21063 } 21066 }
21064 21067
21065 21068
21066 static void CheckInstanceCheckedResult(int getters, 21069 static void CheckInstanceCheckedResult(int getters,
21067 int setters, 21070 int setters,
21068 bool expects_callbacks, 21071 bool expects_callbacks,
21072 bool is_setter,
21069 TryCatch* try_catch) { 21073 TryCatch* try_catch) {
21070 if (expects_callbacks) { 21074 if (expects_callbacks) {
21071 CHECK(!try_catch->HasCaught()); 21075 CHECK(!try_catch->HasCaught());
21072 CHECK_EQ(getters, instance_checked_getter_count); 21076 CHECK_EQ(getters, instance_checked_getter_count);
21073 CHECK_EQ(setters, instance_checked_setter_count); 21077 CHECK_EQ(setters, instance_checked_setter_count);
21074 } else { 21078 } else {
21075 CHECK(try_catch->HasCaught()); 21079 CHECK((is_setter && !try_catch->HasCaught()) ||
21080 (!is_setter && try_catch->HasCaught()));
21076 CHECK_EQ(0, instance_checked_getter_count); 21081 CHECK_EQ(0, instance_checked_getter_count);
21077 CHECK_EQ(0, instance_checked_setter_count); 21082 CHECK_EQ(0, instance_checked_setter_count);
21078 } 21083 }
21079 try_catch->Reset(); 21084 try_catch->Reset();
21080 } 21085 }
21081 21086
21082 21087
21083 static void CheckInstanceCheckedAccessors(bool expects_callbacks) { 21088 static void CheckInstanceCheckedAccessors(bool expects_callbacks) {
21084 instance_checked_getter_count = 0; 21089 instance_checked_getter_count = 0;
21085 instance_checked_setter_count = 0; 21090 instance_checked_setter_count = 0;
21086 TryCatch try_catch; 21091 TryCatch try_catch;
21087 21092
21088 // Test path through generic runtime code. 21093 // Test path through generic runtime code.
21089 CompileRun("obj.foo"); 21094 CompileRun("obj.foo");
21090 CheckInstanceCheckedResult(1, 0, expects_callbacks, &try_catch); 21095 CheckInstanceCheckedResult(1, 0, expects_callbacks, false, &try_catch);
21091 CompileRun("obj.foo = 23"); 21096 CompileRun("obj.foo = 23");
21092 CheckInstanceCheckedResult(1, 1, expects_callbacks, &try_catch); 21097 CheckInstanceCheckedResult(1, 1, expects_callbacks, true, &try_catch);
21098 if (!expects_callbacks) CompileRun("delete obj.foo");
21093 21099
21094 // Test path through generated LoadIC and StoredIC. 21100 // Test path through generated LoadIC and StoredIC.
21095 CompileRun("function test_get(o) { o.foo; }" 21101 CompileRun("function test_get(o) { o.foo; }"
21096 "test_get(obj);"); 21102 "test_get(obj);");
21097 CheckInstanceCheckedResult(2, 1, expects_callbacks, &try_catch); 21103 CheckInstanceCheckedResult(2, 1, expects_callbacks, false, &try_catch);
21098 CompileRun("test_get(obj);"); 21104 CompileRun("test_get(obj);");
21099 CheckInstanceCheckedResult(3, 1, expects_callbacks, &try_catch); 21105 CheckInstanceCheckedResult(3, 1, expects_callbacks, false, &try_catch);
21100 CompileRun("test_get(obj);"); 21106 CompileRun("test_get(obj);");
21101 CheckInstanceCheckedResult(4, 1, expects_callbacks, &try_catch); 21107 CheckInstanceCheckedResult(4, 1, expects_callbacks, false, &try_catch);
21102 CompileRun("function test_set(o) { o.foo = 23; }" 21108 CompileRun("function test_set(o) { o.foo = 23; }"
21103 "test_set(obj);"); 21109 "test_set(obj);");
21104 CheckInstanceCheckedResult(4, 2, expects_callbacks, &try_catch); 21110 CheckInstanceCheckedResult(4, 2, expects_callbacks, true, &try_catch);
21111 if (!expects_callbacks) CompileRun("delete obj.foo");
21105 CompileRun("test_set(obj);"); 21112 CompileRun("test_set(obj);");
21106 CheckInstanceCheckedResult(4, 3, expects_callbacks, &try_catch); 21113 CheckInstanceCheckedResult(4, 3, expects_callbacks, true, &try_catch);
21114 if (!expects_callbacks) CompileRun("delete obj.foo");
21107 CompileRun("test_set(obj);"); 21115 CompileRun("test_set(obj);");
21108 CheckInstanceCheckedResult(4, 4, expects_callbacks, &try_catch); 21116 CheckInstanceCheckedResult(4, 4, expects_callbacks, true, &try_catch);
21117 if (!expects_callbacks) CompileRun("delete obj.foo");
21109 21118
21110 // Test path through optimized code. 21119 // Test path through optimized code.
21111 CompileRun("%OptimizeFunctionOnNextCall(test_get);" 21120 CompileRun("%OptimizeFunctionOnNextCall(test_get);"
21112 "test_get(obj);"); 21121 "test_get(obj);");
21113 CheckInstanceCheckedResult(5, 4, expects_callbacks, &try_catch); 21122 CheckInstanceCheckedResult(5, 4, expects_callbacks, false, &try_catch);
21114 CompileRun("%OptimizeFunctionOnNextCall(test_set);" 21123 CompileRun("%OptimizeFunctionOnNextCall(test_set);"
21115 "test_set(obj);"); 21124 "test_set(obj);");
21116 CheckInstanceCheckedResult(5, 5, expects_callbacks, &try_catch); 21125 if (!expects_callbacks) CompileRun("delete obj.foo");
21126 CheckInstanceCheckedResult(5, 5, expects_callbacks, true, &try_catch);
21117 21127
21118 // Cleanup so that closures start out fresh in next check. 21128 // Cleanup so that closures start out fresh in next check.
21119 CompileRun("%DeoptimizeFunction(test_get);" 21129 CompileRun("%DeoptimizeFunction(test_get);"
21120 "%ClearFunctionTypeFeedback(test_get);" 21130 "%ClearFunctionTypeFeedback(test_get);"
21121 "%DeoptimizeFunction(test_set);" 21131 "%DeoptimizeFunction(test_set);"
21122 "%ClearFunctionTypeFeedback(test_set);"); 21132 "%ClearFunctionTypeFeedback(test_set);");
21123 } 21133 }
21124 21134
21125 21135
21126 THREADED_TEST(InstanceCheckOnInstanceAccessor) { 21136 THREADED_TEST(InstanceCheckOnInstanceAccessor) {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
21178 CHECK(!templ->HasInstance(context->Global()->Get(v8_str("obj")))); 21188 CHECK(!templ->HasInstance(context->Global()->Get(v8_str("obj"))));
21179 CheckInstanceCheckedAccessors(false); 21189 CheckInstanceCheckedAccessors(false);
21180 } 21190 }
21181 21191
21182 21192
21183 THREADED_TEST(InstanceCheckOnPrototypeAccessor) { 21193 THREADED_TEST(InstanceCheckOnPrototypeAccessor) {
21184 v8::internal::FLAG_allow_natives_syntax = true; 21194 v8::internal::FLAG_allow_natives_syntax = true;
21185 LocalContext context; 21195 LocalContext context;
21186 v8::HandleScope scope(context->GetIsolate()); 21196 v8::HandleScope scope(context->GetIsolate());
21187 21197
21188 Local<FunctionTemplate> templ = FunctionTemplate::New(context->GetIsolate()); 21198 Local<FunctionTemplate> proto_templ =
21189 Local<ObjectTemplate> proto = templ->PrototypeTemplate(); 21199 FunctionTemplate::New(context->GetIsolate());
21200 proto_templ->SetHiddenPrototype(true);
21201 Local<ObjectTemplate> proto = proto_templ->InstanceTemplate();
21190 proto->SetAccessor(v8_str("foo"), 21202 proto->SetAccessor(v8_str("foo"),
21191 InstanceCheckedGetter, InstanceCheckedSetter, 21203 InstanceCheckedGetter, InstanceCheckedSetter,
21192 Handle<Value>(), 21204 Handle<Value>(),
21193 v8::DEFAULT, 21205 v8::DEFAULT,
21194 v8::None, 21206 v8::None,
21195 v8::AccessorSignature::New(context->GetIsolate(), templ)); 21207 v8::AccessorSignature::New(context->GetIsolate(),
21208 proto_templ));
21209 Local<FunctionTemplate> templ =
21210 FunctionTemplate::New(context->GetIsolate());
21211 templ->Inherit(proto_templ);
21196 context->Global()->Set(v8_str("f"), templ->GetFunction()); 21212 context->Global()->Set(v8_str("f"), templ->GetFunction());
21197 21213
21198 printf("Testing positive ...\n"); 21214 printf("Testing positive ...\n");
21199 CompileRun("var obj = new f();"); 21215 CompileRun("var obj = new f();");
21200 CHECK(templ->HasInstance(context->Global()->Get(v8_str("obj")))); 21216 CHECK(templ->HasInstance(context->Global()->Get(v8_str("obj"))));
21201 CheckInstanceCheckedAccessors(true); 21217 CheckInstanceCheckedAccessors(true);
21202 21218
21203 printf("Testing negative ...\n"); 21219 printf("Testing negative ...\n");
21204 CompileRun("var obj = {};" 21220 CompileRun("var obj = {};"
21205 "obj.__proto__ = new f();"); 21221 "obj.__proto__ = new f();");
(...skipping 1656 matching lines...) Expand 10 before | Expand all | Expand 10 after
22862 SourceURLHelper("function foo() {}\n" 22878 SourceURLHelper("function foo() {}\n"
22863 "//# sourceURL=bar19\".js \n" 22879 "//# sourceURL=bar19\".js \n"
22864 "//# sourceMappingURL=bar20\".js \n", 22880 "//# sourceMappingURL=bar20\".js \n",
22865 NULL, NULL); 22881 NULL, NULL);
22866 22882
22867 // Not too much whitespace. 22883 // Not too much whitespace.
22868 SourceURLHelper("function foo() {}\n" 22884 SourceURLHelper("function foo() {}\n"
22869 "//# sourceURL= bar21.js \n" 22885 "//# sourceURL= bar21.js \n"
22870 "//# sourceMappingURL= bar22.js \n", "bar21.js", "bar22.js"); 22886 "//# sourceMappingURL= bar22.js \n", "bar21.js", "bar22.js");
22871 } 22887 }
OLDNEW
« src/objects.cc ('K') | « src/objects.cc ('k') | test/mjsunit/es7/object-observe.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698