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

Side by Side Diff: test/cctest/test-api.cc

Issue 159518: - Clamp double values as doubles to get a free NaN check and... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 4 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/objects.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-2008 the V8 project authors. All rights reserved. 1 // Copyright 2007-2008 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 7633 matching lines...) Expand 10 before | Expand all | Expand 10 after
7644 CHECK_EQ(2, result->Int32Value()); 7644 CHECK_EQ(2, result->Int32Value());
7645 CHECK_EQ(2, i::Smi::cast(jsobj->GetElement(6))->value()); 7645 CHECK_EQ(2, i::Smi::cast(jsobj->GetElement(6))->value());
7646 7646
7647 result = CompileRun("for (var i = 0; i < 8; i++) {" 7647 result = CompileRun("for (var i = 0; i < 8; i++) {"
7648 " pixels[5] = NaN;" 7648 " pixels[5] = NaN;"
7649 "}" 7649 "}"
7650 "pixels[5];"); 7650 "pixels[5];");
7651 CHECK_EQ(0, result->Int32Value()); 7651 CHECK_EQ(0, result->Int32Value());
7652 CHECK_EQ(0, i::Smi::cast(jsobj->GetElement(5))->value()); 7652 CHECK_EQ(0, i::Smi::cast(jsobj->GetElement(5))->value());
7653 7653
7654 result = CompileRun("for (var i = 0; i < 8; i++) {"
7655 " pixels[8] = Infinity;"
7656 "}"
7657 "pixels[8];");
7658 CHECK_EQ(255, result->Int32Value());
7659 CHECK_EQ(255, i::Smi::cast(jsobj->GetElement(8))->value());
7660
7661 result = CompileRun("for (var i = 0; i < 8; i++) {"
7662 " pixels[9] = -Infinity;"
7663 "}"
7664 "pixels[9];");
7665 CHECK_EQ(0, result->Int32Value());
7666 CHECK_EQ(0, i::Smi::cast(jsobj->GetElement(9))->value());
7667
7654 result = CompileRun("pixels[3] = 33;" 7668 result = CompileRun("pixels[3] = 33;"
7655 "delete pixels[3];" 7669 "delete pixels[3];"
7656 "pixels[3];"); 7670 "pixels[3];");
7657 CHECK_EQ(33, result->Int32Value()); 7671 CHECK_EQ(33, result->Int32Value());
7658 7672
7659 result = CompileRun("pixels[0] = 10; pixels[1] = 11;" 7673 result = CompileRun("pixels[0] = 10; pixels[1] = 11;"
7660 "pixels[2] = 12; pixels[3] = 13;" 7674 "pixels[2] = 12; pixels[3] = 13;"
7661 "pixels.__defineGetter__('2'," 7675 "pixels.__defineGetter__('2',"
7662 "function() { return 120; });" 7676 "function() { return 120; });"
7663 "pixels[2];"); 7677 "pixels[2];");
7664 CHECK_EQ(12, result->Int32Value()); 7678 CHECK_EQ(12, result->Int32Value());
7665 7679
7666 result = CompileRun("var js_array = new Array(40);" 7680 result = CompileRun("var js_array = new Array(40);"
7667 "js_array[0] = 77;" 7681 "js_array[0] = 77;"
7668 "js_array;"); 7682 "js_array;");
7669 CHECK_EQ(77, v8::Object::Cast(*result)->Get(v8_str("0"))->Int32Value()); 7683 CHECK_EQ(77, v8::Object::Cast(*result)->Get(v8_str("0"))->Int32Value());
7670 7684
7671 result = CompileRun("pixels[1] = 23;" 7685 result = CompileRun("pixels[1] = 23;"
7672 "pixels.__proto__ = [];" 7686 "pixels.__proto__ = [];"
7673 "js_array.__proto__ = pixels;" 7687 "js_array.__proto__ = pixels;"
7674 "js_array.concat(pixels);"); 7688 "js_array.concat(pixels);");
7675 CHECK_EQ(77, v8::Object::Cast(*result)->Get(v8_str("0"))->Int32Value()); 7689 CHECK_EQ(77, v8::Object::Cast(*result)->Get(v8_str("0"))->Int32Value());
7676 CHECK_EQ(23, v8::Object::Cast(*result)->Get(v8_str("1"))->Int32Value()); 7690 CHECK_EQ(23, v8::Object::Cast(*result)->Get(v8_str("1"))->Int32Value());
7677 7691
7678 free(pixel_data); 7692 free(pixel_data);
7679 } 7693 }
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698