Index: test/cctest/test-api.cc |
=================================================================== |
--- test/cctest/test-api.cc (revision 6858) |
+++ test/cctest/test-api.cc (working copy) |
@@ -7627,10 +7627,11 @@ |
"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 |
+ i::Heap::CollectAllGarbage(true); // This should move the stub |
GenerateSomeGarbage(); // This should ensure the old stub memory is flushed |
} |
return v8::Handle<v8::Value>(); |
@@ -7682,6 +7683,54 @@ |
} |
+v8::Handle<v8::Value> DirectGetterCallback(Local<String> name, |
+ const v8::AccessorInfo& info) { |
+ if (++p_getter_count % 3 == 0) { |
+ i::Heap::CollectAllGarbage(true); |
+ GenerateSomeGarbage(); |
+ } |
+ return v8::Handle<v8::Value>(); |
+} |
+ |
+ |
+THREADED_TEST(LoadICFastApi_DirectCall_GCMoveStub) { |
+ v8::HandleScope scope; |
+ LocalContext context; |
+ v8::Handle<v8::ObjectTemplate> obj = v8::ObjectTemplate::New(); |
+ obj->SetAccessor(v8_str("p1"), DirectGetterCallback); |
+ context->Global()->Set(v8_str("o1"), obj->NewInstance()); |
+ p_getter_count = 0; |
+ CompileRun( |
+ "function f() {" |
+ " for (var i = 0; i < 30; i++) o1.p1;" |
+ "}" |
+ "f();"); |
+ CHECK_EQ(30, p_getter_count); |
+} |
+ |
+ |
+v8::Handle<v8::Value> ThrowingDirectGetterCallback( |
+ Local<String> name, const v8::AccessorInfo& info) { |
+ return v8::ThrowException(v8_str("g")); |
+} |
+ |
+ |
+THREADED_TEST(LoadICFastApi_DirectCall_Throw) { |
+ v8::HandleScope scope; |
+ LocalContext context; |
+ v8::Handle<v8::ObjectTemplate> obj = v8::ObjectTemplate::New(); |
+ obj->SetAccessor(v8_str("p1"), ThrowingDirectGetterCallback); |
+ context->Global()->Set(v8_str("o1"), obj->NewInstance()); |
+ v8::Handle<Value> result = CompileRun( |
+ "var result = '';" |
+ "for (var i = 0; i < 5; i++) {" |
+ " try { o1.p1; } catch (e) { result += e; }" |
+ "}" |
+ "result;"); |
+ CHECK_EQ(v8_str("ggggg"), result); |
+} |
+ |
+ |
THREADED_TEST(InterceptorCallICFastApi_TrivialSignature) { |
int interceptor_call_count = 0; |
v8::HandleScope scope; |