| 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 1288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1299 void* ptr = v8::External::Cast(*args.Data())->Value(); | 1299 void* ptr = v8::External::Cast(*args.Data())->Value(); |
| 1300 CHECK_EQ(expected_ptr, ptr); | 1300 CHECK_EQ(expected_ptr, ptr); |
| 1301 args.GetReturnValue().Set(true); | 1301 args.GetReturnValue().Set(true); |
| 1302 } | 1302 } |
| 1303 | 1303 |
| 1304 | 1304 |
| 1305 static void TestExternalPointerWrapping() { | 1305 static void TestExternalPointerWrapping() { |
| 1306 LocalContext env; | 1306 LocalContext env; |
| 1307 v8::HandleScope scope(env->GetIsolate()); | 1307 v8::HandleScope scope(env->GetIsolate()); |
| 1308 | 1308 |
| 1309 v8::Handle<v8::Value> data = v8::External::New(expected_ptr); | 1309 v8::Handle<v8::Value> data = |
| 1310 v8::External::New(env->GetIsolate(), expected_ptr); |
| 1310 | 1311 |
| 1311 v8::Handle<v8::Object> obj = v8::Object::New(); | 1312 v8::Handle<v8::Object> obj = v8::Object::New(); |
| 1312 obj->Set(v8_str("func"), | 1313 obj->Set(v8_str("func"), |
| 1313 v8::FunctionTemplate::New(callback, data)->GetFunction()); | 1314 v8::FunctionTemplate::New(callback, data)->GetFunction()); |
| 1314 env->Global()->Set(v8_str("obj"), obj); | 1315 env->Global()->Set(v8_str("obj"), obj); |
| 1315 | 1316 |
| 1316 CHECK(CompileRun( | 1317 CHECK(CompileRun( |
| 1317 "function foo() {\n" | 1318 "function foo() {\n" |
| 1318 " for (var i = 0; i < 13; i++) obj.func();\n" | 1319 " for (var i = 0; i < 13; i++) obj.func();\n" |
| 1319 "}\n" | 1320 "}\n" |
| (...skipping 1792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3112 Local<v8::Object> obj = function->NewInstance(); | 3113 Local<v8::Object> obj = function->NewInstance(); |
| 3113 CHECK(obj->SetHiddenValue(key, v8::Integer::New(2302))); | 3114 CHECK(obj->SetHiddenValue(key, v8::Integer::New(2302))); |
| 3114 CHECK_EQ(2302, obj->GetHiddenValue(key)->Int32Value()); | 3115 CHECK_EQ(2302, obj->GetHiddenValue(key)->Int32Value()); |
| 3115 CHECK(!interceptor_for_hidden_properties_called); | 3116 CHECK(!interceptor_for_hidden_properties_called); |
| 3116 } | 3117 } |
| 3117 | 3118 |
| 3118 | 3119 |
| 3119 THREADED_TEST(External) { | 3120 THREADED_TEST(External) { |
| 3120 v8::HandleScope scope(CcTest::isolate()); | 3121 v8::HandleScope scope(CcTest::isolate()); |
| 3121 int x = 3; | 3122 int x = 3; |
| 3122 Local<v8::External> ext = v8::External::New(&x); | 3123 Local<v8::External> ext = v8::External::New(CcTest::isolate(), &x); |
| 3123 LocalContext env; | 3124 LocalContext env; |
| 3124 env->Global()->Set(v8_str("ext"), ext); | 3125 env->Global()->Set(v8_str("ext"), ext); |
| 3125 Local<Value> reext_obj = Script::Compile(v8_str("this.ext"))->Run(); | 3126 Local<Value> reext_obj = Script::Compile(v8_str("this.ext"))->Run(); |
| 3126 v8::Handle<v8::External> reext = reext_obj.As<v8::External>(); | 3127 v8::Handle<v8::External> reext = reext_obj.As<v8::External>(); |
| 3127 int* ptr = static_cast<int*>(reext->Value()); | 3128 int* ptr = static_cast<int*>(reext->Value()); |
| 3128 CHECK_EQ(x, 3); | 3129 CHECK_EQ(x, 3); |
| 3129 *ptr = 10; | 3130 *ptr = 10; |
| 3130 CHECK_EQ(x, 10); | 3131 CHECK_EQ(x, 10); |
| 3131 | 3132 |
| 3132 // Make sure unaligned pointers are wrapped properly. | 3133 // Make sure unaligned pointers are wrapped properly. |
| 3133 char* data = i::StrDup("0123456789"); | 3134 char* data = i::StrDup("0123456789"); |
| 3134 Local<v8::Value> zero = v8::External::New(&data[0]); | 3135 Local<v8::Value> zero = v8::External::New(CcTest::isolate(), &data[0]); |
| 3135 Local<v8::Value> one = v8::External::New(&data[1]); | 3136 Local<v8::Value> one = v8::External::New(CcTest::isolate(), &data[1]); |
| 3136 Local<v8::Value> two = v8::External::New(&data[2]); | 3137 Local<v8::Value> two = v8::External::New(CcTest::isolate(), &data[2]); |
| 3137 Local<v8::Value> three = v8::External::New(&data[3]); | 3138 Local<v8::Value> three = v8::External::New(CcTest::isolate(), &data[3]); |
| 3138 | 3139 |
| 3139 char* char_ptr = reinterpret_cast<char*>(v8::External::Cast(*zero)->Value()); | 3140 char* char_ptr = reinterpret_cast<char*>(v8::External::Cast(*zero)->Value()); |
| 3140 CHECK_EQ('0', *char_ptr); | 3141 CHECK_EQ('0', *char_ptr); |
| 3141 char_ptr = reinterpret_cast<char*>(v8::External::Cast(*one)->Value()); | 3142 char_ptr = reinterpret_cast<char*>(v8::External::Cast(*one)->Value()); |
| 3142 CHECK_EQ('1', *char_ptr); | 3143 CHECK_EQ('1', *char_ptr); |
| 3143 char_ptr = reinterpret_cast<char*>(v8::External::Cast(*two)->Value()); | 3144 char_ptr = reinterpret_cast<char*>(v8::External::Cast(*two)->Value()); |
| 3144 CHECK_EQ('2', *char_ptr); | 3145 CHECK_EQ('2', *char_ptr); |
| 3145 char_ptr = reinterpret_cast<char*>(v8::External::Cast(*three)->Value()); | 3146 char_ptr = reinterpret_cast<char*>(v8::External::Cast(*three)->Value()); |
| 3146 CHECK_EQ('3', *char_ptr); | 3147 CHECK_EQ('3', *char_ptr); |
| 3147 i::DeleteArray(data); | 3148 i::DeleteArray(data); |
| (...skipping 3719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6867 info.GetReturnValue().Set(whammy->getScript()->Run()); | 6868 info.GetReturnValue().Set(whammy->getScript()->Run()); |
| 6868 } | 6869 } |
| 6869 | 6870 |
| 6870 | 6871 |
| 6871 THREADED_TEST(WeakReference) { | 6872 THREADED_TEST(WeakReference) { |
| 6872 v8::HandleScope handle_scope(CcTest::isolate()); | 6873 v8::HandleScope handle_scope(CcTest::isolate()); |
| 6873 v8::Handle<v8::ObjectTemplate> templ= v8::ObjectTemplate::New(); | 6874 v8::Handle<v8::ObjectTemplate> templ= v8::ObjectTemplate::New(); |
| 6874 Whammy* whammy = new Whammy(CcTest::isolate()); | 6875 Whammy* whammy = new Whammy(CcTest::isolate()); |
| 6875 templ->SetNamedPropertyHandler(WhammyPropertyGetter, | 6876 templ->SetNamedPropertyHandler(WhammyPropertyGetter, |
| 6876 0, 0, 0, 0, | 6877 0, 0, 0, 0, |
| 6877 v8::External::New(whammy)); | 6878 v8::External::New(CcTest::isolate(), whammy)); |
| 6878 const char* extension_list[] = { "v8/gc" }; | 6879 const char* extension_list[] = { "v8/gc" }; |
| 6879 v8::ExtensionConfiguration extensions(1, extension_list); | 6880 v8::ExtensionConfiguration extensions(1, extension_list); |
| 6880 v8::Handle<Context> context = | 6881 v8::Handle<Context> context = |
| 6881 Context::New(CcTest::isolate(), &extensions); | 6882 Context::New(CcTest::isolate(), &extensions); |
| 6882 Context::Scope context_scope(context); | 6883 Context::Scope context_scope(context); |
| 6883 | 6884 |
| 6884 v8::Handle<v8::Object> interceptor = templ->NewInstance(); | 6885 v8::Handle<v8::Object> interceptor = templ->NewInstance(); |
| 6885 context->Global()->Set(v8_str("whammy"), interceptor); | 6886 context->Global()->Set(v8_str("whammy"), interceptor); |
| 6886 const char* code = | 6887 const char* code = |
| 6887 "var last;" | 6888 "var last;" |
| (...skipping 4674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11562 int interceptor_call_count = 0; | 11563 int interceptor_call_count = 0; |
| 11563 v8::HandleScope scope(CcTest::isolate()); | 11564 v8::HandleScope scope(CcTest::isolate()); |
| 11564 v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New(); | 11565 v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New(); |
| 11565 v8::Handle<v8::FunctionTemplate> method_templ = | 11566 v8::Handle<v8::FunctionTemplate> method_templ = |
| 11566 v8::FunctionTemplate::New(FastApiCallback_TrivialSignature, | 11567 v8::FunctionTemplate::New(FastApiCallback_TrivialSignature, |
| 11567 v8_str("method_data"), | 11568 v8_str("method_data"), |
| 11568 v8::Handle<v8::Signature>()); | 11569 v8::Handle<v8::Signature>()); |
| 11569 v8::Handle<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate(); | 11570 v8::Handle<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate(); |
| 11570 proto_templ->Set(v8_str("method"), method_templ); | 11571 proto_templ->Set(v8_str("method"), method_templ); |
| 11571 v8::Handle<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate(); | 11572 v8::Handle<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate(); |
| 11572 templ->SetNamedPropertyHandler(InterceptorCallICFastApi, | 11573 templ->SetNamedPropertyHandler( |
| 11573 NULL, NULL, NULL, NULL, | 11574 InterceptorCallICFastApi, NULL, NULL, NULL, NULL, |
| 11574 v8::External::New(&interceptor_call_count)); | 11575 v8::External::New(CcTest::isolate(), &interceptor_call_count)); |
| 11575 LocalContext context; | 11576 LocalContext context; |
| 11576 v8::Handle<v8::Function> fun = fun_templ->GetFunction(); | 11577 v8::Handle<v8::Function> fun = fun_templ->GetFunction(); |
| 11577 GenerateSomeGarbage(); | 11578 GenerateSomeGarbage(); |
| 11578 context->Global()->Set(v8_str("o"), fun->NewInstance()); | 11579 context->Global()->Set(v8_str("o"), fun->NewInstance()); |
| 11579 CompileRun( | 11580 CompileRun( |
| 11580 "var result = 0;" | 11581 "var result = 0;" |
| 11581 "for (var i = 0; i < 100; i++) {" | 11582 "for (var i = 0; i < 100; i++) {" |
| 11582 " result = o.method(41);" | 11583 " result = o.method(41);" |
| 11583 "}"); | 11584 "}"); |
| 11584 CHECK_EQ(42, context->Global()->Get(v8_str("result"))->Int32Value()); | 11585 CHECK_EQ(42, context->Global()->Get(v8_str("result"))->Int32Value()); |
| 11585 CHECK_EQ(100, interceptor_call_count); | 11586 CHECK_EQ(100, interceptor_call_count); |
| 11586 } | 11587 } |
| 11587 | 11588 |
| 11588 | 11589 |
| 11589 THREADED_PROFILED_TEST(InterceptorCallICFastApi_SimpleSignature) { | 11590 THREADED_PROFILED_TEST(InterceptorCallICFastApi_SimpleSignature) { |
| 11590 int interceptor_call_count = 0; | 11591 int interceptor_call_count = 0; |
| 11591 v8::HandleScope scope(CcTest::isolate()); | 11592 v8::HandleScope scope(CcTest::isolate()); |
| 11592 v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New(); | 11593 v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New(); |
| 11593 v8::Handle<v8::FunctionTemplate> method_templ = | 11594 v8::Handle<v8::FunctionTemplate> method_templ = |
| 11594 v8::FunctionTemplate::New(FastApiCallback_SimpleSignature, | 11595 v8::FunctionTemplate::New(FastApiCallback_SimpleSignature, |
| 11595 v8_str("method_data"), | 11596 v8_str("method_data"), |
| 11596 v8::Signature::New(fun_templ)); | 11597 v8::Signature::New(fun_templ)); |
| 11597 v8::Handle<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate(); | 11598 v8::Handle<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate(); |
| 11598 proto_templ->Set(v8_str("method"), method_templ); | 11599 proto_templ->Set(v8_str("method"), method_templ); |
| 11599 fun_templ->SetHiddenPrototype(true); | 11600 fun_templ->SetHiddenPrototype(true); |
| 11600 v8::Handle<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate(); | 11601 v8::Handle<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate(); |
| 11601 templ->SetNamedPropertyHandler(InterceptorCallICFastApi, | 11602 templ->SetNamedPropertyHandler( |
| 11602 NULL, NULL, NULL, NULL, | 11603 InterceptorCallICFastApi, NULL, NULL, NULL, NULL, |
| 11603 v8::External::New(&interceptor_call_count)); | 11604 v8::External::New(CcTest::isolate(), &interceptor_call_count)); |
| 11604 LocalContext context; | 11605 LocalContext context; |
| 11605 v8::Handle<v8::Function> fun = fun_templ->GetFunction(); | 11606 v8::Handle<v8::Function> fun = fun_templ->GetFunction(); |
| 11606 GenerateSomeGarbage(); | 11607 GenerateSomeGarbage(); |
| 11607 context->Global()->Set(v8_str("o"), fun->NewInstance()); | 11608 context->Global()->Set(v8_str("o"), fun->NewInstance()); |
| 11608 CompileRun( | 11609 CompileRun( |
| 11609 "o.foo = 17;" | 11610 "o.foo = 17;" |
| 11610 "var receiver = {};" | 11611 "var receiver = {};" |
| 11611 "receiver.__proto__ = o;" | 11612 "receiver.__proto__ = o;" |
| 11612 "var result = 0;" | 11613 "var result = 0;" |
| 11613 "for (var i = 0; i < 100; i++) {" | 11614 "for (var i = 0; i < 100; i++) {" |
| 11614 " result = receiver.method(41);" | 11615 " result = receiver.method(41);" |
| 11615 "}"); | 11616 "}"); |
| 11616 CHECK_EQ(42, context->Global()->Get(v8_str("result"))->Int32Value()); | 11617 CHECK_EQ(42, context->Global()->Get(v8_str("result"))->Int32Value()); |
| 11617 CHECK_EQ(100, interceptor_call_count); | 11618 CHECK_EQ(100, interceptor_call_count); |
| 11618 } | 11619 } |
| 11619 | 11620 |
| 11620 | 11621 |
| 11621 THREADED_PROFILED_TEST(InterceptorCallICFastApi_SimpleSignature_Miss1) { | 11622 THREADED_PROFILED_TEST(InterceptorCallICFastApi_SimpleSignature_Miss1) { |
| 11622 int interceptor_call_count = 0; | 11623 int interceptor_call_count = 0; |
| 11623 v8::HandleScope scope(CcTest::isolate()); | 11624 v8::HandleScope scope(CcTest::isolate()); |
| 11624 v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New(); | 11625 v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New(); |
| 11625 v8::Handle<v8::FunctionTemplate> method_templ = | 11626 v8::Handle<v8::FunctionTemplate> method_templ = |
| 11626 v8::FunctionTemplate::New(FastApiCallback_SimpleSignature, | 11627 v8::FunctionTemplate::New(FastApiCallback_SimpleSignature, |
| 11627 v8_str("method_data"), | 11628 v8_str("method_data"), |
| 11628 v8::Signature::New(fun_templ)); | 11629 v8::Signature::New(fun_templ)); |
| 11629 v8::Handle<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate(); | 11630 v8::Handle<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate(); |
| 11630 proto_templ->Set(v8_str("method"), method_templ); | 11631 proto_templ->Set(v8_str("method"), method_templ); |
| 11631 fun_templ->SetHiddenPrototype(true); | 11632 fun_templ->SetHiddenPrototype(true); |
| 11632 v8::Handle<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate(); | 11633 v8::Handle<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate(); |
| 11633 templ->SetNamedPropertyHandler(InterceptorCallICFastApi, | 11634 templ->SetNamedPropertyHandler( |
| 11634 NULL, NULL, NULL, NULL, | 11635 InterceptorCallICFastApi, NULL, NULL, NULL, NULL, |
| 11635 v8::External::New(&interceptor_call_count)); | 11636 v8::External::New(CcTest::isolate(), &interceptor_call_count)); |
| 11636 LocalContext context; | 11637 LocalContext context; |
| 11637 v8::Handle<v8::Function> fun = fun_templ->GetFunction(); | 11638 v8::Handle<v8::Function> fun = fun_templ->GetFunction(); |
| 11638 GenerateSomeGarbage(); | 11639 GenerateSomeGarbage(); |
| 11639 context->Global()->Set(v8_str("o"), fun->NewInstance()); | 11640 context->Global()->Set(v8_str("o"), fun->NewInstance()); |
| 11640 CompileRun( | 11641 CompileRun( |
| 11641 "o.foo = 17;" | 11642 "o.foo = 17;" |
| 11642 "var receiver = {};" | 11643 "var receiver = {};" |
| 11643 "receiver.__proto__ = o;" | 11644 "receiver.__proto__ = o;" |
| 11644 "var result = 0;" | 11645 "var result = 0;" |
| 11645 "var saved_result = 0;" | 11646 "var saved_result = 0;" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 11661 v8::HandleScope scope(CcTest::isolate()); | 11662 v8::HandleScope scope(CcTest::isolate()); |
| 11662 v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New(); | 11663 v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New(); |
| 11663 v8::Handle<v8::FunctionTemplate> method_templ = | 11664 v8::Handle<v8::FunctionTemplate> method_templ = |
| 11664 v8::FunctionTemplate::New(FastApiCallback_SimpleSignature, | 11665 v8::FunctionTemplate::New(FastApiCallback_SimpleSignature, |
| 11665 v8_str("method_data"), | 11666 v8_str("method_data"), |
| 11666 v8::Signature::New(fun_templ)); | 11667 v8::Signature::New(fun_templ)); |
| 11667 v8::Handle<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate(); | 11668 v8::Handle<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate(); |
| 11668 proto_templ->Set(v8_str("method"), method_templ); | 11669 proto_templ->Set(v8_str("method"), method_templ); |
| 11669 fun_templ->SetHiddenPrototype(true); | 11670 fun_templ->SetHiddenPrototype(true); |
| 11670 v8::Handle<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate(); | 11671 v8::Handle<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate(); |
| 11671 templ->SetNamedPropertyHandler(InterceptorCallICFastApi, | 11672 templ->SetNamedPropertyHandler( |
| 11672 NULL, NULL, NULL, NULL, | 11673 InterceptorCallICFastApi, NULL, NULL, NULL, NULL, |
| 11673 v8::External::New(&interceptor_call_count)); | 11674 v8::External::New(CcTest::isolate(), &interceptor_call_count)); |
| 11674 LocalContext context; | 11675 LocalContext context; |
| 11675 v8::Handle<v8::Function> fun = fun_templ->GetFunction(); | 11676 v8::Handle<v8::Function> fun = fun_templ->GetFunction(); |
| 11676 GenerateSomeGarbage(); | 11677 GenerateSomeGarbage(); |
| 11677 context->Global()->Set(v8_str("o"), fun->NewInstance()); | 11678 context->Global()->Set(v8_str("o"), fun->NewInstance()); |
| 11678 CompileRun( | 11679 CompileRun( |
| 11679 "o.foo = 17;" | 11680 "o.foo = 17;" |
| 11680 "var receiver = {};" | 11681 "var receiver = {};" |
| 11681 "receiver.__proto__ = o;" | 11682 "receiver.__proto__ = o;" |
| 11682 "var result = 0;" | 11683 "var result = 0;" |
| 11683 "var saved_result = 0;" | 11684 "var saved_result = 0;" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 11699 v8::HandleScope scope(CcTest::isolate()); | 11700 v8::HandleScope scope(CcTest::isolate()); |
| 11700 v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New(); | 11701 v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New(); |
| 11701 v8::Handle<v8::FunctionTemplate> method_templ = | 11702 v8::Handle<v8::FunctionTemplate> method_templ = |
| 11702 v8::FunctionTemplate::New(FastApiCallback_SimpleSignature, | 11703 v8::FunctionTemplate::New(FastApiCallback_SimpleSignature, |
| 11703 v8_str("method_data"), | 11704 v8_str("method_data"), |
| 11704 v8::Signature::New(fun_templ)); | 11705 v8::Signature::New(fun_templ)); |
| 11705 v8::Handle<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate(); | 11706 v8::Handle<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate(); |
| 11706 proto_templ->Set(v8_str("method"), method_templ); | 11707 proto_templ->Set(v8_str("method"), method_templ); |
| 11707 fun_templ->SetHiddenPrototype(true); | 11708 fun_templ->SetHiddenPrototype(true); |
| 11708 v8::Handle<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate(); | 11709 v8::Handle<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate(); |
| 11709 templ->SetNamedPropertyHandler(InterceptorCallICFastApi, | 11710 templ->SetNamedPropertyHandler( |
| 11710 NULL, NULL, NULL, NULL, | 11711 InterceptorCallICFastApi, NULL, NULL, NULL, NULL, |
| 11711 v8::External::New(&interceptor_call_count)); | 11712 v8::External::New(CcTest::isolate(), &interceptor_call_count)); |
| 11712 LocalContext context; | 11713 LocalContext context; |
| 11713 v8::Handle<v8::Function> fun = fun_templ->GetFunction(); | 11714 v8::Handle<v8::Function> fun = fun_templ->GetFunction(); |
| 11714 GenerateSomeGarbage(); | 11715 GenerateSomeGarbage(); |
| 11715 context->Global()->Set(v8_str("o"), fun->NewInstance()); | 11716 context->Global()->Set(v8_str("o"), fun->NewInstance()); |
| 11716 v8::TryCatch try_catch; | 11717 v8::TryCatch try_catch; |
| 11717 CompileRun( | 11718 CompileRun( |
| 11718 "o.foo = 17;" | 11719 "o.foo = 17;" |
| 11719 "var receiver = {};" | 11720 "var receiver = {};" |
| 11720 "receiver.__proto__ = o;" | 11721 "receiver.__proto__ = o;" |
| 11721 "var result = 0;" | 11722 "var result = 0;" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 11740 v8::HandleScope scope(CcTest::isolate()); | 11741 v8::HandleScope scope(CcTest::isolate()); |
| 11741 v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New(); | 11742 v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New(); |
| 11742 v8::Handle<v8::FunctionTemplate> method_templ = | 11743 v8::Handle<v8::FunctionTemplate> method_templ = |
| 11743 v8::FunctionTemplate::New(FastApiCallback_SimpleSignature, | 11744 v8::FunctionTemplate::New(FastApiCallback_SimpleSignature, |
| 11744 v8_str("method_data"), | 11745 v8_str("method_data"), |
| 11745 v8::Signature::New(fun_templ)); | 11746 v8::Signature::New(fun_templ)); |
| 11746 v8::Handle<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate(); | 11747 v8::Handle<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate(); |
| 11747 proto_templ->Set(v8_str("method"), method_templ); | 11748 proto_templ->Set(v8_str("method"), method_templ); |
| 11748 fun_templ->SetHiddenPrototype(true); | 11749 fun_templ->SetHiddenPrototype(true); |
| 11749 v8::Handle<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate(); | 11750 v8::Handle<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate(); |
| 11750 templ->SetNamedPropertyHandler(InterceptorCallICFastApi, | 11751 templ->SetNamedPropertyHandler( |
| 11751 NULL, NULL, NULL, NULL, | 11752 InterceptorCallICFastApi, NULL, NULL, NULL, NULL, |
| 11752 v8::External::New(&interceptor_call_count)); | 11753 v8::External::New(CcTest::isolate(), &interceptor_call_count)); |
| 11753 LocalContext context; | 11754 LocalContext context; |
| 11754 v8::Handle<v8::Function> fun = fun_templ->GetFunction(); | 11755 v8::Handle<v8::Function> fun = fun_templ->GetFunction(); |
| 11755 GenerateSomeGarbage(); | 11756 GenerateSomeGarbage(); |
| 11756 context->Global()->Set(v8_str("o"), fun->NewInstance()); | 11757 context->Global()->Set(v8_str("o"), fun->NewInstance()); |
| 11757 v8::TryCatch try_catch; | 11758 v8::TryCatch try_catch; |
| 11758 CompileRun( | 11759 CompileRun( |
| 11759 "o.foo = 17;" | 11760 "o.foo = 17;" |
| 11760 "var receiver = {};" | 11761 "var receiver = {};" |
| 11761 "receiver.__proto__ = o;" | 11762 "receiver.__proto__ = o;" |
| 11762 "var result = 0;" | 11763 "var result = 0;" |
| (...skipping 8976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 20739 } | 20740 } |
| 20740 for (int i = 0; i < runs; i++) { | 20741 for (int i = 0; i < runs; i++) { |
| 20741 Local<String> expected; | 20742 Local<String> expected; |
| 20742 if (i != 0) { | 20743 if (i != 0) { |
| 20743 CHECK_EQ(v8_str("escape value"), values[i]); | 20744 CHECK_EQ(v8_str("escape value"), values[i]); |
| 20744 } else { | 20745 } else { |
| 20745 CHECK(values[i].IsEmpty()); | 20746 CHECK(values[i].IsEmpty()); |
| 20746 } | 20747 } |
| 20747 } | 20748 } |
| 20748 } | 20749 } |
| OLD | NEW |