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

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

Issue 159537: Merge r2564 to branches/1.2:... (Closed) Base URL: http://v8.googlecode.com/svn/branches/1.2/
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/version.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 7216 matching lines...) Expand 10 before | Expand all | Expand 10 after
7227 CHECK_EQ(2, result->Int32Value()); 7227 CHECK_EQ(2, result->Int32Value());
7228 CHECK_EQ(2, i::Smi::cast(jsobj->GetElement(6))->value()); 7228 CHECK_EQ(2, i::Smi::cast(jsobj->GetElement(6))->value());
7229 7229
7230 result = CompileRun("for (var i = 0; i < 8; i++) {" 7230 result = CompileRun("for (var i = 0; i < 8; i++) {"
7231 " pixels[5] = NaN;" 7231 " pixels[5] = NaN;"
7232 "}" 7232 "}"
7233 "pixels[5];"); 7233 "pixels[5];");
7234 CHECK_EQ(0, result->Int32Value()); 7234 CHECK_EQ(0, result->Int32Value());
7235 CHECK_EQ(0, i::Smi::cast(jsobj->GetElement(5))->value()); 7235 CHECK_EQ(0, i::Smi::cast(jsobj->GetElement(5))->value());
7236 7236
7237 result = CompileRun("for (var i = 0; i < 8; i++) {"
7238 " pixels[8] = Infinity;"
7239 "}"
7240 "pixels[8];");
7241 CHECK_EQ(255, result->Int32Value());
7242 CHECK_EQ(255, i::Smi::cast(jsobj->GetElement(8))->value());
7243
7244 result = CompileRun("for (var i = 0; i < 8; i++) {"
7245 " pixels[9] = -Infinity;"
7246 "}"
7247 "pixels[9];");
7248 CHECK_EQ(0, result->Int32Value());
7249 CHECK_EQ(0, i::Smi::cast(jsobj->GetElement(9))->value());
7250
7237 result = CompileRun("pixels[3] = 33;" 7251 result = CompileRun("pixels[3] = 33;"
7238 "delete pixels[3];" 7252 "delete pixels[3];"
7239 "pixels[3];"); 7253 "pixels[3];");
7240 CHECK_EQ(33, result->Int32Value()); 7254 CHECK_EQ(33, result->Int32Value());
7241 7255
7242 result = CompileRun("pixels[0] = 10; pixels[1] = 11;" 7256 result = CompileRun("pixels[0] = 10; pixels[1] = 11;"
7243 "pixels[2] = 12; pixels[3] = 13;" 7257 "pixels[2] = 12; pixels[3] = 13;"
7244 "pixels.__defineGetter__('2'," 7258 "pixels.__defineGetter__('2',"
7245 "function() { return 120; });" 7259 "function() { return 120; });"
7246 "pixels[2];"); 7260 "pixels[2];");
7247 CHECK_EQ(12, result->Int32Value()); 7261 CHECK_EQ(12, result->Int32Value());
7248 7262
7249 result = CompileRun("var js_array = new Array(40);" 7263 result = CompileRun("var js_array = new Array(40);"
7250 "js_array[0] = 77;" 7264 "js_array[0] = 77;"
7251 "js_array;"); 7265 "js_array;");
7252 CHECK_EQ(77, v8::Object::Cast(*result)->Get(v8_str("0"))->Int32Value()); 7266 CHECK_EQ(77, v8::Object::Cast(*result)->Get(v8_str("0"))->Int32Value());
7253 7267
7254 result = CompileRun("pixels[1] = 23;" 7268 result = CompileRun("pixels[1] = 23;"
7255 "pixels.__proto__ = [];" 7269 "pixels.__proto__ = [];"
7256 "js_array.__proto__ = pixels;" 7270 "js_array.__proto__ = pixels;"
7257 "js_array.concat(pixels);"); 7271 "js_array.concat(pixels);");
7258 CHECK_EQ(77, v8::Object::Cast(*result)->Get(v8_str("0"))->Int32Value()); 7272 CHECK_EQ(77, v8::Object::Cast(*result)->Get(v8_str("0"))->Int32Value());
7259 CHECK_EQ(23, v8::Object::Cast(*result)->Get(v8_str("1"))->Int32Value()); 7273 CHECK_EQ(23, v8::Object::Cast(*result)->Get(v8_str("1"))->Int32Value());
7260 7274
7261 free(pixel_data); 7275 free(pixel_data);
7262 } 7276 }
OLDNEW
« no previous file with comments | « src/version.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698