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

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

Issue 294022: Add optimized ICs for new CanvasArray types. This is a follow-on CL to... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 2 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/ic-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
===================================================================
--- test/cctest/test-api.cc (revision 3112)
+++ test/cctest/test-api.cc (working copy)
@@ -8197,15 +8197,6 @@
CHECK_EQ(28, result->Int32Value());
// Check out-of-range loads.
- result = CompileRun("var caught_exception = false;"
- "try {"
- " ext_array[-1];"
- "} catch (e) {"
- " caught_exception = true;"
- "}"
- "caught_exception;");
- CHECK_EQ(true, result->BooleanValue());
-
i::OS::SNPrintF(test_buf,
"var caught_exception = false;"
"try {"
@@ -8219,15 +8210,6 @@
CHECK_EQ(true, result->BooleanValue());
// Check out-of-range stores.
- result = CompileRun("var caught_exception = false;"
- "try {"
- " ext_array[-1] = 1;"
- "} catch (e) {"
- " caught_exception = true;"
- "}"
- "caught_exception;");
- CHECK_EQ(true, result->BooleanValue());
-
i::OS::SNPrintF(test_buf,
"var caught_exception = false;"
"try {"
@@ -8240,9 +8222,6 @@
result = CompileRun(test_buf.start());
CHECK_EQ(true, result->BooleanValue());
- // TODO(kbr): check what happens during IC misses on the type of the object.
- // Re-assign array object halfway through a loop.
-
// Check other boundary conditions, values and operations.
result = CompileRun("for (var i = 0; i < 8; i++) {"
" ext_array[7] = undefined;"
@@ -8258,10 +8237,40 @@
CHECK_EQ(2, result->Int32Value());
CHECK_EQ(2, static_cast<int>(jsobj->GetElement(6)->Number()));
- // Result for storing NaNs and +/-Infinity isn't defined for these
- // types; they do not have the clamping behavior CanvasPixelArray
- // specifies.
+ if (array_type != v8::kExternalFloatArray) {
+ // Though the specification doesn't state it, be explicit about
+ // converting NaNs and +/-Infinity to zero.
+ result = CompileRun("for (var i = 0; i < 8; i++) {"
+ " ext_array[i] = 5;"
+ "}"
+ "for (var i = 0; i < 8; i++) {"
+ " ext_array[i] = NaN;"
+ "}"
+ "ext_array[5];");
+ CHECK_EQ(0, result->Int32Value());
+ CHECK_EQ(0, i::Smi::cast(jsobj->GetElement(5))->value());
+ result = CompileRun("for (var i = 0; i < 8; i++) {"
+ " ext_array[i] = 5;"
+ "}"
+ "for (var i = 0; i < 8; i++) {"
+ " ext_array[i] = Infinity;"
+ "}"
+ "ext_array[5];");
+ CHECK_EQ(0, result->Int32Value());
+ CHECK_EQ(0, i::Smi::cast(jsobj->GetElement(5))->value());
+
+ result = CompileRun("for (var i = 0; i < 8; i++) {"
+ " ext_array[i] = 5;"
+ "}"
+ "for (var i = 0; i < 8; i++) {"
+ " ext_array[i] = -Infinity;"
+ "}"
+ "ext_array[5];");
+ CHECK_EQ(0, result->Int32Value());
+ CHECK_EQ(0, i::Smi::cast(jsobj->GetElement(5))->value());
+ }
+
result = CompileRun("ext_array[3] = 33;"
"delete ext_array[3];"
"ext_array[3];");
« no previous file with comments | « src/x64/ic-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698