Index: test/cctest/test-api.cc |
=================================================================== |
--- test/cctest/test-api.cc (revision 6551) |
+++ test/cctest/test-api.cc (working copy) |
@@ -7345,6 +7345,35 @@ |
"garbage = undefined;"); |
} |
+v8::Handle<v8::Value> DirectApiCallback(const v8::Arguments& args) { |
+ static int count = 0; |
+ if (count++ % 3 == 0) { |
+ v8::V8::LowMemoryNotification(); // This should move the stub |
+ GenerateSomeGarbage(); // This should ensure the old stub memory is flushed |
+ } |
+ return v8::Handle<v8::Value>(); |
+} |
+ |
+ |
+THREADED_TEST(CallICFastApi_DirectCall_GCMoveStub) { |
+ v8::HandleScope scope; |
+ v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(); |
antonm
2011/02/02 13:56:28
looks like you shouldn't use this global any more.
Zaheer
2011/02/03 07:27:31
Done.
|
+ LocalContext context; |
+ v8::Handle<v8::ObjectTemplate> nativeobject_templ = v8::ObjectTemplate::New(); |
+ nativeobject_templ->Set("callback", |
+ v8::FunctionTemplate::New(DirectApiCallback)); |
+ v8::Local<v8::Object> nativeobject_obj = nativeobject_templ->NewInstance(); |
+ context->Global()->Set(v8_str("nativeobject"), nativeobject_obj); |
+ // call the api function multiple times to ensure direct call stub creation. |
+ CompileRun( |
+ "function f() { " |
+ " for (var i = 1; i <= 30; i++) { " |
+ " nativeobject.callback(); " |
+ " } " |
+ "} " |
+ "f();"); |
+} |
+ |
THREADED_TEST(InterceptorCallICFastApi_TrivialSignature) { |
int interceptor_call_count = 0; |
v8::HandleScope scope; |