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

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

Issue 6656001: Support external arrays in Crankshaft (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: final version Created 9 years, 9 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
« no previous file with comments | « src/x64/lithium-x64.cc ('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
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index 2a4fe138908a514cafa82741082040c52ac87054..5293761cfdd84400ddcd8b3d40d80ecd786fcc80 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -11492,6 +11492,53 @@ static void ExternalArrayTestHelper(v8::ExternalArrayType array_type,
CHECK_EQ(true, result->BooleanValue());
}
+ // Test crankshaft external array loads
+ for (int i = 0; i < kElementCount; i++) {
+ array->set(i, static_cast<ElementType>(i));
+ }
+ result = CompileRun("function ee_load_test_func(sum) {"
+ " for (var i=0;i<40;++i)"
+ " sum += ext_array[i];"
+ " return sum;"
+ "}"
+ "sum=0;"
+ "for (var i=0;i<10000;++i) {"
+ " sum=ee_load_test_func(sum);"
+ "}"
+ "sum;");
+ CHECK_EQ(7800000, result->Int32Value());
+
+ // Test crankshaft external array stores
+ result = CompileRun("function ee_store_test_func(sum) {"
+ " for (var i=0;i<40;++i)"
+ " sum += ext_array[i] = i;"
+ " return sum;"
+ "}"
+ "sum=0;"
+ "for (var i=0;i<10000;++i) {"
+ " sum=ee_store_test_func(sum);"
+ "}"
+ "sum;");
+ CHECK_EQ(7800000, result->Int32Value());
+
+ // Test edge cases for crankshaft code.
+ array->set(0, static_cast<ElementType>(0xFFFFFFFF));
+ result = CompileRun("function ee_limit_test_func(i) {"
+ " return ext_array[i];"
+ " return sum;"
+ "}"
+ "sum=0;"
+ "for (var i=0;i<1000000;++i) {"
+ " sum=ee_limit_test_func(0);"
+ "}"
+ "sum;");
+ if (array_type == v8::kExternalFloatArray) {
+ CHECK_EQ(0, result->Int32Value());
+ } else {
+ CHECK_EQ(static_cast<int>(static_cast<ElementType>(0xFFFFFFFF)),
+ result->Int32Value());
+ }
+
result = CompileRun("ext_array[3] = 33;"
"delete ext_array[3];"
"ext_array[3];");
« no previous file with comments | « src/x64/lithium-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698