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

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

Issue 6478027: Implement specialized IC code stubs for pixel array stores. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: merge with latest 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
« no previous file with comments | « src/x64/stub-cache-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 b92185f52afa933c8402e2eace8cf3fcf680d224..e711dc871d7d2ae5eafe9046761b45e765763614 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -10691,7 +10691,62 @@ THREADED_TEST(PixelArray) {
"result");
CHECK_EQ(32640, result->Int32Value());
- // Make sure that pixel array loads are optimized by crankshaft.
+ // Make sure that pixel array store ICs clamp values correctly.
+ result = CompileRun("function pa_store(p) {"
+ " for (var j = 0; j < 256; j++) { p[j] = j * 2; }"
+ "}"
+ "pa_store(pixels);"
+ "var sum = 0;"
+ "for (var j = 0; j < 256; j++) { sum += pixels[j]; }"
+ "sum");
+ CHECK_EQ(48896, result->Int32Value());
+
+ // Make sure that pixel array stores correctly handle accesses outside
+ // of the pixel array..
+ result = CompileRun("function pa_store(p,start) {"
+ " for (var j = 0; j < 256; j++) {"
+ " p[j+start] = j * 2;"
+ " }"
+ "}"
+ "pa_store(pixels,0);"
+ "pa_store(pixels,-128);"
+ "var sum = 0;"
+ "for (var j = 0; j < 256; j++) { sum += pixels[j]; }"
+ "sum");
+ CHECK_EQ(65280, result->Int32Value());
+
+ // Make sure that the generic store stub correctly handle accesses outside
+ // of the pixel array..
+ result = CompileRun("function pa_store(p,start) {"
+ " for (var j = 0; j < 256; j++) {"
+ " p[j+start] = j * 2;"
+ " }"
+ "}"
+ "pa_store(pixels,0);"
+ "just_ints = new Object();"
+ "for (var i = 0; i < 256; ++i) { just_ints[i] = i; }"
+ "pa_store(just_ints, 0);"
+ "pa_store(pixels,-128);"
+ "var sum = 0;"
+ "for (var j = 0; j < 256; j++) { sum += pixels[j]; }"
+ "sum");
+ CHECK_EQ(65280, result->Int32Value());
+
+ // Make sure that the generic keyed store stub clamps pixel array values
+ // correctly.
+ result = CompileRun("function pa_store(p) {"
+ " for (var j = 0; j < 256; j++) { p[j] = j * 2; }"
+ "}"
+ "pa_store(pixels);"
+ "just_ints = new Object();"
+ "pa_store(just_ints);"
+ "pa_store(pixels);"
+ "var sum = 0;"
+ "for (var j = 0; j < 256; j++) { sum += pixels[j]; }"
+ "sum");
+ CHECK_EQ(48896, result->Int32Value());
+
+ // Make sure that pixel array loads are optimized by crankshaft.
result = CompileRun("function pa_load(p) {"
" var sum = 0;"
" for (var i=0; i<256; ++i) {"
« no previous file with comments | « src/x64/stub-cache-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698