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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/x64/stub-cache-x64.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2007-2009 the V8 project authors. All rights reserved. 1 // Copyright 2007-2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 10673 matching lines...) Expand 10 before | Expand all | Expand 10 after
10684 "for (var i = 0; i < 10; ++i) { pa_load(pixels); }" 10684 "for (var i = 0; i < 10; ++i) { pa_load(pixels); }"
10685 "sparse_array = new Object();" 10685 "sparse_array = new Object();"
10686 "for (var i = 0; i < 256; ++i) { sparse_array[i] = i; }" 10686 "for (var i = 0; i < 256; ++i) { sparse_array[i] = i; }"
10687 "sparse_array[1000000] = 3;" 10687 "sparse_array[1000000] = 3;"
10688 "for (var i = 0; i < 10; ++i) {" 10688 "for (var i = 0; i < 10; ++i) {"
10689 " result = pa_load(sparse_array);" 10689 " result = pa_load(sparse_array);"
10690 "}" 10690 "}"
10691 "result"); 10691 "result");
10692 CHECK_EQ(32640, result->Int32Value()); 10692 CHECK_EQ(32640, result->Int32Value());
10693 10693
10694 // Make sure that pixel array loads are optimized by crankshaft. 10694 // Make sure that pixel array store ICs clamp values correctly.
10695 result = CompileRun("function pa_store(p) {"
10696 " for (var j = 0; j < 256; j++) { p[j] = j * 2; }"
10697 "}"
10698 "pa_store(pixels);"
10699 "var sum = 0;"
10700 "for (var j = 0; j < 256; j++) { sum += pixels[j]; }"
10701 "sum");
10702 CHECK_EQ(48896, result->Int32Value());
10703
10704 // Make sure that pixel array stores correctly handle accesses outside
10705 // of the pixel array..
10706 result = CompileRun("function pa_store(p,start) {"
10707 " for (var j = 0; j < 256; j++) {"
10708 " p[j+start] = j * 2;"
10709 " }"
10710 "}"
10711 "pa_store(pixels,0);"
10712 "pa_store(pixels,-128);"
10713 "var sum = 0;"
10714 "for (var j = 0; j < 256; j++) { sum += pixels[j]; }"
10715 "sum");
10716 CHECK_EQ(65280, result->Int32Value());
10717
10718 // Make sure that the generic store stub correctly handle accesses outside
10719 // of the pixel array..
10720 result = CompileRun("function pa_store(p,start) {"
10721 " for (var j = 0; j < 256; j++) {"
10722 " p[j+start] = j * 2;"
10723 " }"
10724 "}"
10725 "pa_store(pixels,0);"
10726 "just_ints = new Object();"
10727 "for (var i = 0; i < 256; ++i) { just_ints[i] = i; }"
10728 "pa_store(just_ints, 0);"
10729 "pa_store(pixels,-128);"
10730 "var sum = 0;"
10731 "for (var j = 0; j < 256; j++) { sum += pixels[j]; }"
10732 "sum");
10733 CHECK_EQ(65280, result->Int32Value());
10734
10735 // Make sure that the generic keyed store stub clamps pixel array values
10736 // correctly.
10737 result = CompileRun("function pa_store(p) {"
10738 " for (var j = 0; j < 256; j++) { p[j] = j * 2; }"
10739 "}"
10740 "pa_store(pixels);"
10741 "just_ints = new Object();"
10742 "pa_store(just_ints);"
10743 "pa_store(pixels);"
10744 "var sum = 0;"
10745 "for (var j = 0; j < 256; j++) { sum += pixels[j]; }"
10746 "sum");
10747 CHECK_EQ(48896, result->Int32Value());
10748
10749 // Make sure that pixel array loads are optimized by crankshaft.
10695 result = CompileRun("function pa_load(p) {" 10750 result = CompileRun("function pa_load(p) {"
10696 " var sum = 0;" 10751 " var sum = 0;"
10697 " for (var i=0; i<256; ++i) {" 10752 " for (var i=0; i<256; ++i) {"
10698 " sum += p[i];" 10753 " sum += p[i];"
10699 " }" 10754 " }"
10700 " return sum; " 10755 " return sum; "
10701 "}" 10756 "}"
10702 "for (var i = 0; i < 256; ++i) { pixels[i] = i; }" 10757 "for (var i = 0; i < 256; ++i) { pixels[i] = i; }"
10703 "for (var i = 0; i < 10000; ++i) {" 10758 "for (var i = 0; i < 10000; ++i) {"
10704 " result = pa_load(pixels);" 10759 " result = pa_load(pixels);"
(...skipping 1924 matching lines...) Expand 10 before | Expand all | Expand 10 after
12629 v8::Handle<v8::Function> define_property = 12684 v8::Handle<v8::Function> define_property =
12630 CompileRun("(function() {" 12685 CompileRun("(function() {"
12631 " Object.defineProperty(" 12686 " Object.defineProperty("
12632 " this," 12687 " this,"
12633 " 1," 12688 " 1,"
12634 " { configurable: true, enumerable: true, value: 3 });" 12689 " { configurable: true, enumerable: true, value: 3 });"
12635 "})").As<Function>(); 12690 "})").As<Function>();
12636 context->DetachGlobal(); 12691 context->DetachGlobal();
12637 define_property->Call(proxy, 0, NULL); 12692 define_property->Call(proxy, 0, NULL);
12638 } 12693 }
OLDNEW
« 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