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

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

Issue 6805005: Fix opmitized external array access for compound assignments (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: final version Created 9 years, 8 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/type-info.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 2011 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
11 // with the distribution. 11 // with the distribution.
(...skipping 11476 matching lines...) Expand 10 before | Expand all | Expand 10 after
11488 (is_pixel_data ? pixel_data : signed_data))); 11488 (is_pixel_data ? pixel_data : signed_data)));
11489 result = CompileRun(test_buf.start()); 11489 result = CompileRun(test_buf.start());
11490 CHECK_EQ(true, result->BooleanValue()); 11490 CHECK_EQ(true, result->BooleanValue());
11491 } 11491 }
11492 11492
11493 // Test crankshaft external array loads 11493 // Test crankshaft external array loads
11494 for (int i = 0; i < kElementCount; i++) { 11494 for (int i = 0; i < kElementCount; i++) {
11495 array->set(i, static_cast<ElementType>(i)); 11495 array->set(i, static_cast<ElementType>(i));
11496 } 11496 }
11497 result = CompileRun("function ee_load_test_func(sum) {" 11497 result = CompileRun("function ee_load_test_func(sum) {"
11498 " for (var i=0;i<40;++i)" 11498 " for (var i = 0; i < 40; ++i)"
11499 " sum += ext_array[i];" 11499 " sum += ext_array[i];"
11500 " return sum;" 11500 " return sum;"
11501 "}" 11501 "}"
11502 "sum=0;" 11502 "sum=0;"
11503 "for (var i=0;i<10000;++i) {" 11503 "for (var i=0;i<10000;++i) {"
11504 " sum=ee_load_test_func(sum);" 11504 " sum=ee_load_test_func(sum);"
11505 "}" 11505 "}"
11506 "sum;"); 11506 "sum;");
11507 CHECK_EQ(7800000, result->Int32Value()); 11507 CHECK_EQ(7800000, result->Int32Value());
11508 11508
11509 // Test crankshaft external array stores 11509 // Test crankshaft external array stores
11510 result = CompileRun("function ee_store_test_func(sum) {" 11510 result = CompileRun("function ee_store_test_func(sum) {"
11511 " for (var i=0;i<40;++i)" 11511 " for (var i = 0; i < 40; ++i)"
11512 " sum += ext_array[i] = i;" 11512 " sum += ext_array[i] = i;"
11513 " return sum;" 11513 " return sum;"
11514 "}" 11514 "}"
11515 "sum=0;" 11515 "sum=0;"
11516 "for (var i=0;i<10000;++i) {" 11516 "for (var i=0;i<10000;++i) {"
11517 " sum=ee_store_test_func(sum);" 11517 " sum=ee_store_test_func(sum);"
11518 "}" 11518 "}"
11519 "sum;"); 11519 "sum;");
11520 CHECK_EQ(7800000, result->Int32Value()); 11520 CHECK_EQ(7800000, result->Int32Value());
11521 11521
11522 for (int i = 0; i < kElementCount; i++) {
11523 array->set(i, static_cast<ElementType>(i));
11524 }
11525 // Test complex assignments
11526 result = CompileRun("function ee_op_test_complex_func(sum) {"
11527 " for (var i = 0; i < 40; ++i) {"
11528 " sum += (ext_array[i] += 1);"
11529 " sum += (ext_array[i] -= 1);"
11530 " } "
11531 " return sum;"
11532 "}"
11533 "sum=0;"
11534 "for (var i=0;i<10000;++i) {"
11535 " sum=ee_op_test_complex_func(sum);"
11536 "}"
11537 "sum;");
11538 CHECK_EQ(16000000, result->Int32Value());
11539
11540 // Test count operations
11541 result = CompileRun("function ee_op_test_count_func(sum) {"
11542 " for (var i = 0; i < 40; ++i) {"
11543 " sum += (++ext_array[i]);"
11544 " sum += (--ext_array[i]);"
11545 " } "
11546 " return sum;"
11547 "}"
11548 "sum=0;"
11549 "for (var i=0;i<10000;++i) {"
11550 " sum=ee_op_test_count_func(sum);"
11551 "}"
11552 "sum;");
11553 CHECK_EQ(16000000, result->Int32Value());
11554
11522 result = CompileRun("ext_array[3] = 33;" 11555 result = CompileRun("ext_array[3] = 33;"
11523 "delete ext_array[3];" 11556 "delete ext_array[3];"
11524 "ext_array[3];"); 11557 "ext_array[3];");
11525 CHECK_EQ(33, result->Int32Value()); 11558 CHECK_EQ(33, result->Int32Value());
11526 11559
11527 result = CompileRun("ext_array[0] = 10; ext_array[1] = 11;" 11560 result = CompileRun("ext_array[0] = 10; ext_array[1] = 11;"
11528 "ext_array[2] = 12; ext_array[3] = 13;" 11561 "ext_array[2] = 12; ext_array[3] = 13;"
11529 "ext_array.__defineGetter__('2'," 11562 "ext_array.__defineGetter__('2',"
11530 "function() { return 120; });" 11563 "function() { return 120; });"
11531 "ext_array[2];"); 11564 "ext_array[2];");
(...skipping 2189 matching lines...) Expand 10 before | Expand all | Expand 10 after
13721 CHECK(func2->CreationContext() == context2); 13754 CHECK(func2->CreationContext() == context2);
13722 CheckContextId(func2, 2); 13755 CheckContextId(func2, 2);
13723 CHECK(instance2->CreationContext() == context2); 13756 CHECK(instance2->CreationContext() == context2);
13724 CheckContextId(instance2, 2); 13757 CheckContextId(instance2, 2);
13725 } 13758 }
13726 13759
13727 context1.Dispose(); 13760 context1.Dispose();
13728 context2.Dispose(); 13761 context2.Dispose();
13729 context3.Dispose(); 13762 context3.Dispose();
13730 } 13763 }
OLDNEW
« no previous file with comments | « src/type-info.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698