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

Unified Diff: test/cctest/test-api.cc

Issue 6462029: Direct call accessor getter callbacks (arm implementation). (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 10 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 side-by-side diff with in-line comments
Download patch
« src/assembler.h ('K') | « src/assembler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-api.cc
===================================================================
--- test/cctest/test-api.cc (revision 6680)
+++ test/cctest/test-api.cc (working copy)
@@ -7525,6 +7525,7 @@
"garbage = undefined;");
}
+
v8::Handle<v8::Value> DirectApiCallback(const v8::Arguments& args) {
static int count = 0;
if (count++ % 3 == 0) {
@@ -7580,6 +7581,54 @@
}
+v8::Handle<v8::Value> DirectLoadCallback(Local<String> name,
+ const v8::AccessorInfo& info) {
+ if (++p_getter_count % 3 == 0) {
+ v8::V8::LowMemoryNotification();
antonm 2011/02/17 16:13:44 you can probably directly force GC as v8::internal
Zaheer 2011/02/21 10:25:35 Done.
+ 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"), DirectLoadCallback);
+ 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> ThrowingDirectLoadCallback(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"), ThrowingDirectLoadCallback);
+ 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);
antonm 2011/02/17 16:13:44 Thank you very much for the tests!
+}
+
+
THREADED_TEST(InterceptorCallICFastApi_TrivialSignature) {
int interceptor_call_count = 0;
v8::HandleScope scope;
« src/assembler.h ('K') | « src/assembler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698