OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 while (beg < end) { | 59 while (beg < end) { |
60 if (*beg++ != 0) | 60 if (*beg++ != 0) |
61 return false; | 61 return false; |
62 } | 62 } |
63 return true; | 63 return true; |
64 } | 64 } |
65 | 65 |
66 | 66 |
67 TEST(CopyBytes) { | 67 TEST(CopyBytes) { |
68 CcTest::InitializeVM(); | 68 CcTest::InitializeVM(); |
69 Isolate* isolate = Isolate::Current(); | 69 Isolate* isolate = CcTest::i_isolate(); |
70 HandleScope handles(isolate); | 70 HandleScope handles(isolate); |
71 | 71 |
72 const int data_size = 1 * KB; | 72 const int data_size = 1 * KB; |
73 size_t act_size; | 73 size_t act_size; |
74 | 74 |
75 // Allocate two blocks to copy data between. | 75 // Allocate two blocks to copy data between. |
76 byte* src_buffer = | 76 byte* src_buffer = |
77 static_cast<byte*>(v8::base::OS::Allocate(data_size, &act_size, 0)); | 77 static_cast<byte*>(v8::base::OS::Allocate(data_size, &act_size, 0)); |
78 CHECK(src_buffer); | 78 CHECK(src_buffer); |
79 CHECK(act_size >= static_cast<size_t>(data_size)); | 79 CHECK(act_size >= static_cast<size_t>(data_size)); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 | 133 |
134 // Check that the source data hasn't been clobbered. | 134 // Check that the source data hasn't been clobbered. |
135 for (int i = 0; i < data_size; i++) { | 135 for (int i = 0; i < data_size; i++) { |
136 CHECK(src_buffer[i] == to_non_zero(i)); | 136 CHECK(src_buffer[i] == to_non_zero(i)); |
137 } | 137 } |
138 } | 138 } |
139 | 139 |
140 | 140 |
141 TEST(LoadConstants) { | 141 TEST(LoadConstants) { |
142 CcTest::InitializeVM(); | 142 CcTest::InitializeVM(); |
143 Isolate* isolate = Isolate::Current(); | 143 Isolate* isolate = CcTest::i_isolate(); |
144 HandleScope handles(isolate); | 144 HandleScope handles(isolate); |
145 | 145 |
146 int64_t refConstants[64]; | 146 int64_t refConstants[64]; |
147 int64_t result[64]; | 147 int64_t result[64]; |
148 | 148 |
149 int64_t mask = 1; | 149 int64_t mask = 1; |
150 for (int i = 0; i < 64; i++) { | 150 for (int i = 0; i < 64; i++) { |
151 refConstants[i] = ~(mask << i); | 151 refConstants[i] = ~(mask << i); |
152 } | 152 } |
153 | 153 |
(...skipping 21 matching lines...) Expand all Loading... |
175 0, 0); | 175 0, 0); |
176 // Check results. | 176 // Check results. |
177 for (int i = 0; i < 64; i++) { | 177 for (int i = 0; i < 64; i++) { |
178 CHECK(refConstants[i] == result[i]); | 178 CHECK(refConstants[i] == result[i]); |
179 } | 179 } |
180 } | 180 } |
181 | 181 |
182 | 182 |
183 TEST(LoadAddress) { | 183 TEST(LoadAddress) { |
184 CcTest::InitializeVM(); | 184 CcTest::InitializeVM(); |
185 Isolate* isolate = Isolate::Current(); | 185 Isolate* isolate = CcTest::i_isolate(); |
186 HandleScope handles(isolate); | 186 HandleScope handles(isolate); |
187 | 187 |
188 MacroAssembler assembler(isolate, NULL, 0); | 188 MacroAssembler assembler(isolate, NULL, 0); |
189 MacroAssembler* masm = &assembler; | 189 MacroAssembler* masm = &assembler; |
190 Label to_jump, skip; | 190 Label to_jump, skip; |
191 __ mov(a4, a0); | 191 __ mov(a4, a0); |
192 | 192 |
193 __ Branch(&skip); | 193 __ Branch(&skip); |
194 __ bind(&to_jump); | 194 __ bind(&to_jump); |
195 __ nop(); | 195 __ nop(); |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 F1 f = FUNCTION_CAST<F1>(code->entry()); | 299 F1 f = FUNCTION_CAST<F1>(code->entry()); |
300 for (int i = 0; i < kNumCases; ++i) { | 300 for (int i = 0; i < kNumCases; ++i) { |
301 int64_t res = reinterpret_cast<int64_t>( | 301 int64_t res = reinterpret_cast<int64_t>( |
302 CALL_GENERATED_CODE(isolate, f, i, 0, 0, 0, 0)); | 302 CALL_GENERATED_CODE(isolate, f, i, 0, 0, 0, 0)); |
303 ::printf("f(%d) = %" PRId64 "\n", i, res); | 303 ::printf("f(%d) = %" PRId64 "\n", i, res); |
304 CHECK_EQ(values[i], res); | 304 CHECK_EQ(values[i], res); |
305 } | 305 } |
306 } | 306 } |
307 | 307 |
308 #undef __ | 308 #undef __ |
OLD | NEW |