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

Side by Side Diff: test/cctest/compiler/test-run-machops.cc

Issue 420033003: Fix 64-bit VS2010 build (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 | « test/cctest/compiler/test-node-algorithm.cc ('k') | test/cctest/compiler/test-scheduler.cc » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <limits> 5 #include <limits>
6 #include "src/v8.h" 6 #include "src/v8.h"
7 7
8 #include "test/cctest/cctest.h" 8 #include "test/cctest/cctest.h"
9 #include "test/cctest/compiler/codegen-tester.h" 9 #include "test/cctest/compiler/codegen-tester.h"
10 #include "test/cctest/compiler/value-helper.h" 10 #include "test/cctest/compiler/value-helper.h"
(...skipping 2482 matching lines...) Expand 10 before | Expand all | Expand 10 after
2493 2493
2494 2494
2495 template <typename CType> 2495 template <typename CType>
2496 static void RunLoadImmIndex(MachineRepresentation rep) { 2496 static void RunLoadImmIndex(MachineRepresentation rep) {
2497 const int kNumElems = 3; 2497 const int kNumElems = 3;
2498 CType buffer[kNumElems]; 2498 CType buffer[kNumElems];
2499 2499
2500 // initialize the buffer with raw data. 2500 // initialize the buffer with raw data.
2501 byte* raw = reinterpret_cast<byte*>(buffer); 2501 byte* raw = reinterpret_cast<byte*>(buffer);
2502 for (size_t i = 0; i < sizeof(buffer); i++) { 2502 for (size_t i = 0; i < sizeof(buffer); i++) {
2503 raw[i] = (i + sizeof(buffer)) ^ 0xAA; 2503 raw[i] = static_cast<byte>((i + sizeof(buffer)) ^ 0xAA);
2504 } 2504 }
2505 2505
2506 // Test with various large and small offsets. 2506 // Test with various large and small offsets.
2507 for (int offset = -1; offset <= 200000; offset *= -5) { 2507 for (int offset = -1; offset <= 200000; offset *= -5) {
2508 for (int i = 0; i < kNumElems; i++) { 2508 for (int i = 0; i < kNumElems; i++) {
2509 RawMachineAssemblerTester<CType> m; 2509 RawMachineAssemblerTester<CType> m;
2510 Node* base = m.PointerConstant(buffer - offset); 2510 Node* base = m.PointerConstant(buffer - offset);
2511 Node* index = m.Int32Constant((offset + i) * sizeof(buffer[0])); 2511 Node* index = m.Int32Constant((offset + i) * sizeof(buffer[0]));
2512 m.Return(m.Load(rep, base, index)); 2512 m.Return(m.Load(rep, base, index));
2513 2513
(...skipping 18 matching lines...) Expand all
2532 template <typename CType> 2532 template <typename CType>
2533 static void RunLoadStore(MachineRepresentation rep) { 2533 static void RunLoadStore(MachineRepresentation rep) {
2534 const int kNumElems = 4; 2534 const int kNumElems = 4;
2535 CType buffer[kNumElems]; 2535 CType buffer[kNumElems];
2536 2536
2537 for (int32_t x = 0; x < kNumElems; x++) { 2537 for (int32_t x = 0; x < kNumElems; x++) {
2538 int32_t y = kNumElems - x - 1; 2538 int32_t y = kNumElems - x - 1;
2539 // initialize the buffer with raw data. 2539 // initialize the buffer with raw data.
2540 byte* raw = reinterpret_cast<byte*>(buffer); 2540 byte* raw = reinterpret_cast<byte*>(buffer);
2541 for (size_t i = 0; i < sizeof(buffer); i++) { 2541 for (size_t i = 0; i < sizeof(buffer); i++) {
2542 raw[i] = (i + sizeof(buffer)) ^ 0xAA; 2542 raw[i] = static_cast<byte>((i + sizeof(buffer)) ^ 0xAA);
2543 } 2543 }
2544 2544
2545 RawMachineAssemblerTester<int32_t> m; 2545 RawMachineAssemblerTester<int32_t> m;
2546 int32_t OK = 0x29000 + x; 2546 int32_t OK = 0x29000 + x;
2547 Node* base = m.PointerConstant(buffer); 2547 Node* base = m.PointerConstant(buffer);
2548 Node* index0 = m.Int32Constant(x * sizeof(buffer[0])); 2548 Node* index0 = m.Int32Constant(x * sizeof(buffer[0]));
2549 Node* load = m.Load(rep, base, index0); 2549 Node* load = m.Load(rep, base, index0);
2550 Node* index1 = m.Int32Constant(y * sizeof(buffer[0])); 2550 Node* index1 = m.Int32Constant(y * sizeof(buffer[0]));
2551 m.Store(rep, base, index1, load); 2551 m.Store(rep, base, index1, load);
2552 m.Return(m.Int32Constant(OK)); 2552 m.Return(m.Int32Constant(OK));
(...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after
3696 } 3696 }
3697 m.Return(one); 3697 m.Return(one);
3698 m.Call(); 3698 m.Call();
3699 for (int i = 0; i < kInputSize; i++) { 3699 for (int i = 0; i < kInputSize; i++) {
3700 CHECK_EQ(outputs[i], i + 2); 3700 CHECK_EQ(outputs[i], i + 2);
3701 } 3701 }
3702 } 3702 }
3703 3703
3704 3704
3705 TEST(RunSpillConstantsAndParameters) { 3705 TEST(RunSpillConstantsAndParameters) {
3706 static const size_t kInputSize = 1000; 3706 static const int kInputSize = 1000;
3707 static const int32_t kBase = 987; 3707 static const int32_t kBase = 987;
3708 RawMachineAssemblerTester<int32_t> m(kMachineWord32, kMachineWord32); 3708 RawMachineAssemblerTester<int32_t> m(kMachineWord32, kMachineWord32);
3709 int32_t outputs[kInputSize]; 3709 int32_t outputs[kInputSize];
3710 Node* csts[kInputSize]; 3710 Node* csts[kInputSize];
3711 Node* accs[kInputSize]; 3711 Node* accs[kInputSize];
3712 Node* acc = m.Int32Constant(0); 3712 Node* acc = m.Int32Constant(0);
3713 for (size_t i = 0; i < kInputSize; i++) { 3713 for (int i = 0; i < kInputSize; i++) {
3714 csts[i] = m.Int32Constant(static_cast<int32_t>(kBase + i)); 3714 csts[i] = m.Int32Constant(static_cast<int32_t>(kBase + i));
3715 } 3715 }
3716 for (size_t i = 0; i < kInputSize; i++) { 3716 for (int i = 0; i < kInputSize; i++) {
3717 acc = m.Int32Add(acc, csts[i]); 3717 acc = m.Int32Add(acc, csts[i]);
3718 accs[i] = acc; 3718 accs[i] = acc;
3719 } 3719 }
3720 for (size_t i = 0; i < kInputSize; i++) { 3720 for (int i = 0; i < kInputSize; i++) {
3721 m.StoreToPointer(&outputs[i], kMachineWord32, accs[i]); 3721 m.StoreToPointer(&outputs[i], kMachineWord32, accs[i]);
3722 } 3722 }
3723 m.Return(m.Int32Add(acc, m.Int32Add(m.Parameter(0), m.Parameter(1)))); 3723 m.Return(m.Int32Add(acc, m.Int32Add(m.Parameter(0), m.Parameter(1))));
3724 FOR_INT32_INPUTS(i) { 3724 FOR_INT32_INPUTS(i) {
3725 FOR_INT32_INPUTS(j) { 3725 FOR_INT32_INPUTS(j) {
3726 int32_t expected = *i + *j; 3726 int32_t expected = *i + *j;
3727 for (size_t k = 0; k < kInputSize; k++) { 3727 for (int k = 0; k < kInputSize; k++) {
3728 expected += kBase + k; 3728 expected += kBase + k;
3729 } 3729 }
3730 CHECK_EQ(expected, m.Call(*i, *j)); 3730 CHECK_EQ(expected, m.Call(*i, *j));
3731 expected = 0; 3731 expected = 0;
3732 for (size_t k = 0; k < kInputSize; k++) { 3732 for (int k = 0; k < kInputSize; k++) {
3733 expected += kBase + k; 3733 expected += kBase + k;
3734 CHECK_EQ(expected, outputs[k]); 3734 CHECK_EQ(expected, outputs[k]);
3735 } 3735 }
3736 } 3736 }
3737 } 3737 }
3738 } 3738 }
3739 3739
3740 3740
3741 TEST(RunNewSpaceConstantsInPhi) { 3741 TEST(RunNewSpaceConstantsInPhi) {
3742 RawMachineAssemblerTester<Object*> m(kMachineWord32); 3742 RawMachineAssemblerTester<Object*> m(kMachineWord32);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
3789 m.Return(one); 3789 m.Return(one);
3790 m.Call(); 3790 m.Call();
3791 for (int i = 0; i < kInputSize; i++) { 3791 for (int i = 0; i < kInputSize; i++) {
3792 CHECK_EQ(outputs[i], i + 2); 3792 CHECK_EQ(outputs[i], i + 2);
3793 } 3793 }
3794 } 3794 }
3795 3795
3796 #endif // MACHINE_ASSEMBLER_SUPPORTS_CALL_C 3796 #endif // MACHINE_ASSEMBLER_SUPPORTS_CALL_C
3797 3797
3798 #endif 3798 #endif
OLDNEW
« no previous file with comments | « test/cctest/compiler/test-node-algorithm.cc ('k') | test/cctest/compiler/test-scheduler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698