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

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

Issue 6656001: Support external arrays in Crankshaft (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: final version Created 9 years, 9 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') | 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 2007-2009 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 11474 matching lines...) Expand 10 before | Expand all | Expand 10 after
11485 " (ext_array[5] == expected_results[i]);" 11485 " (ext_array[5] == expected_results[i]);"
11486 "}" 11486 "}"
11487 "all_passed;", 11487 "all_passed;",
11488 (is_unsigned ? 11488 (is_unsigned ?
11489 unsigned_data : 11489 unsigned_data :
11490 (is_pixel_data ? pixel_data : signed_data))); 11490 (is_pixel_data ? pixel_data : signed_data)));
11491 result = CompileRun(test_buf.start()); 11491 result = CompileRun(test_buf.start());
11492 CHECK_EQ(true, result->BooleanValue()); 11492 CHECK_EQ(true, result->BooleanValue());
11493 } 11493 }
11494 11494
11495 // Test crankshaft external array loads
11496 for (int i = 0; i < kElementCount; i++) {
11497 array->set(i, static_cast<ElementType>(i));
11498 }
11499 result = CompileRun("function ee_load_test_func(sum) {"
11500 " for (var i=0;i<40;++i)"
11501 " sum += ext_array[i];"
11502 " return sum;"
11503 "}"
11504 "sum=0;"
11505 "for (var i=0;i<10000;++i) {"
11506 " sum=ee_load_test_func(sum);"
11507 "}"
11508 "sum;");
11509 CHECK_EQ(7800000, result->Int32Value());
11510
11511 // Test crankshaft external array stores
11512 result = CompileRun("function ee_store_test_func(sum) {"
11513 " for (var i=0;i<40;++i)"
11514 " sum += ext_array[i] = i;"
11515 " return sum;"
11516 "}"
11517 "sum=0;"
11518 "for (var i=0;i<10000;++i) {"
11519 " sum=ee_store_test_func(sum);"
11520 "}"
11521 "sum;");
11522 CHECK_EQ(7800000, result->Int32Value());
11523
11524 // Test edge cases for crankshaft code.
11525 array->set(0, static_cast<ElementType>(0xFFFFFFFF));
11526 result = CompileRun("function ee_limit_test_func(i) {"
11527 " return ext_array[i];"
11528 " return sum;"
11529 "}"
11530 "sum=0;"
11531 "for (var i=0;i<1000000;++i) {"
11532 " sum=ee_limit_test_func(0);"
11533 "}"
11534 "sum;");
11535 if (array_type == v8::kExternalFloatArray) {
11536 CHECK_EQ(0, result->Int32Value());
11537 } else {
11538 CHECK_EQ(static_cast<int>(static_cast<ElementType>(0xFFFFFFFF)),
11539 result->Int32Value());
11540 }
11541
11495 result = CompileRun("ext_array[3] = 33;" 11542 result = CompileRun("ext_array[3] = 33;"
11496 "delete ext_array[3];" 11543 "delete ext_array[3];"
11497 "ext_array[3];"); 11544 "ext_array[3];");
11498 CHECK_EQ(33, result->Int32Value()); 11545 CHECK_EQ(33, result->Int32Value());
11499 11546
11500 result = CompileRun("ext_array[0] = 10; ext_array[1] = 11;" 11547 result = CompileRun("ext_array[0] = 10; ext_array[1] = 11;"
11501 "ext_array[2] = 12; ext_array[3] = 13;" 11548 "ext_array[2] = 12; ext_array[3] = 13;"
11502 "ext_array.__defineGetter__('2'," 11549 "ext_array.__defineGetter__('2',"
11503 "function() { return 120; });" 11550 "function() { return 120; });"
11504 "ext_array[2];"); 11551 "ext_array[2];");
(...skipping 2090 matching lines...) Expand 10 before | Expand all | Expand 10 after
13595 v8::Handle<v8::Function> define_property = 13642 v8::Handle<v8::Function> define_property =
13596 CompileRun("(function() {" 13643 CompileRun("(function() {"
13597 " Object.defineProperty(" 13644 " Object.defineProperty("
13598 " this," 13645 " this,"
13599 " 1," 13646 " 1,"
13600 " { configurable: true, enumerable: true, value: 3 });" 13647 " { configurable: true, enumerable: true, value: 3 });"
13601 "})").As<Function>(); 13648 "})").As<Function>();
13602 context->DetachGlobal(); 13649 context->DetachGlobal();
13603 define_property->Call(proxy, 0, NULL); 13650 define_property->Call(proxy, 0, NULL);
13604 } 13651 }
OLDNEW
« no previous file with comments | « src/x64/lithium-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698