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

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

Issue 6902112: Avoid using a register for constant external array indices. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: add arch-independent ExternalArrayTypeToShiftSize() function Created 9 years, 7 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/lithium-x64.cc ('k') | test/mjsunit/external-array.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 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
(...skipping 11892 matching lines...) Expand 10 before | Expand all | Expand 10 after
11903 " (ext_array[5] == expected_results[i]);" 11903 " (ext_array[5] == expected_results[i]);"
11904 "}" 11904 "}"
11905 "all_passed;", 11905 "all_passed;",
11906 (is_unsigned ? 11906 (is_unsigned ?
11907 unsigned_data : 11907 unsigned_data :
11908 (is_pixel_data ? pixel_data : signed_data))); 11908 (is_pixel_data ? pixel_data : signed_data)));
11909 result = CompileRun(test_buf.start()); 11909 result = CompileRun(test_buf.start());
11910 CHECK_EQ(true, result->BooleanValue()); 11910 CHECK_EQ(true, result->BooleanValue());
11911 } 11911 }
11912 11912
11913 // Test crankshaft external array loads
11914 for (int i = 0; i < kElementCount; i++) {
11915 array->set(i, static_cast<ElementType>(i));
11916 }
11917 result = CompileRun("function ee_load_test_func(sum) {"
11918 " for (var i = 0; i < 40; ++i)"
11919 " sum += ext_array[i];"
11920 " return sum;"
11921 "}"
11922 "sum=0;"
11923 "for (var i=0;i<10000;++i) {"
11924 " sum=ee_load_test_func(sum);"
11925 "}"
11926 "sum;");
11927 CHECK_EQ(7800000, result->Int32Value());
11928
11929 // Test crankshaft external array stores
11930 result = CompileRun("function ee_store_test_func(sum) {"
11931 " for (var i = 0; i < 40; ++i)"
11932 " sum += ext_array[i] = i;"
11933 " return sum;"
11934 "}"
11935 "sum=0;"
11936 "for (var i=0;i<10000;++i) {"
11937 " sum=ee_store_test_func(sum);"
11938 "}"
11939 "sum;");
11940 CHECK_EQ(7800000, result->Int32Value());
11941
11942 for (int i = 0; i < kElementCount; i++) { 11913 for (int i = 0; i < kElementCount; i++) {
11943 array->set(i, static_cast<ElementType>(i)); 11914 array->set(i, static_cast<ElementType>(i));
11944 } 11915 }
11945 // Test complex assignments 11916 // Test complex assignments
11946 result = CompileRun("function ee_op_test_complex_func(sum) {" 11917 result = CompileRun("function ee_op_test_complex_func(sum) {"
11947 " for (var i = 0; i < 40; ++i) {" 11918 " for (var i = 0; i < 40; ++i) {"
11948 " sum += (ext_array[i] += 1);" 11919 " sum += (ext_array[i] += 1);"
11949 " sum += (ext_array[i] -= 1);" 11920 " sum += (ext_array[i] -= 1);"
11950 " } " 11921 " } "
11951 " return sum;" 11922 " return sum;"
(...skipping 2449 matching lines...) Expand 10 before | Expand all | Expand 10 after
14401 THREADED_TEST(CallAPIFunctionOnNonObject) { 14372 THREADED_TEST(CallAPIFunctionOnNonObject) {
14402 v8::HandleScope scope; 14373 v8::HandleScope scope;
14403 LocalContext context; 14374 LocalContext context;
14404 Handle<FunctionTemplate> templ = v8::FunctionTemplate::New(NonObjectThis); 14375 Handle<FunctionTemplate> templ = v8::FunctionTemplate::New(NonObjectThis);
14405 Handle<Function> function = templ->GetFunction(); 14376 Handle<Function> function = templ->GetFunction();
14406 context->Global()->Set(v8_str("f"), function); 14377 context->Global()->Set(v8_str("f"), function);
14407 TryCatch try_catch; 14378 TryCatch try_catch;
14408 CompileRun("f.call(2)"); 14379 CompileRun("f.call(2)");
14409 CHECK(try_catch.HasCaught()); 14380 CHECK(try_catch.HasCaught());
14410 } 14381 }
OLDNEW
« no previous file with comments | « src/x64/lithium-x64.cc ('k') | test/mjsunit/external-array.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698