OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 InitializeVM(); | 62 InitializeVM(); |
63 v8::HandleScope scope; | 63 v8::HandleScope scope; |
64 | 64 |
65 Assembler assm(NULL, 0); | 65 Assembler assm(NULL, 0); |
66 | 66 |
67 __ add(r0, r0, Operand(r1)); | 67 __ add(r0, r0, Operand(r1)); |
68 __ mov(pc, Operand(lr)); | 68 __ mov(pc, Operand(lr)); |
69 | 69 |
70 CodeDesc desc; | 70 CodeDesc desc; |
71 assm.GetCode(&desc); | 71 assm.GetCode(&desc); |
72 Object* code = Heap::CreateCode(desc, | 72 Object* code = Heap::CreateCode( |
73 Code::ComputeFlags(Code::STUB), | 73 desc, |
74 Handle<Object>(Heap::undefined_value())); | 74 Code::ComputeFlags(Code::STUB), |
| 75 Handle<Object>(Heap::undefined_value()))->ToObjectChecked(); |
75 CHECK(code->IsCode()); | 76 CHECK(code->IsCode()); |
76 #ifdef DEBUG | 77 #ifdef DEBUG |
77 Code::cast(code)->Print(); | 78 Code::cast(code)->Print(); |
78 #endif | 79 #endif |
79 F2 f = FUNCTION_CAST<F2>(Code::cast(code)->entry()); | 80 F2 f = FUNCTION_CAST<F2>(Code::cast(code)->entry()); |
80 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 3, 4, 0, 0, 0)); | 81 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 3, 4, 0, 0, 0)); |
81 ::printf("f() = %d\n", res); | 82 ::printf("f() = %d\n", res); |
82 CHECK_EQ(7, res); | 83 CHECK_EQ(7, res); |
83 } | 84 } |
84 | 85 |
(...skipping 13 matching lines...) Expand all Loading... |
98 __ add(r0, r0, Operand(r1)); | 99 __ add(r0, r0, Operand(r1)); |
99 __ sub(r1, r1, Operand(1)); | 100 __ sub(r1, r1, Operand(1)); |
100 | 101 |
101 __ bind(&C); | 102 __ bind(&C); |
102 __ teq(r1, Operand(0, RelocInfo::NONE)); | 103 __ teq(r1, Operand(0, RelocInfo::NONE)); |
103 __ b(ne, &L); | 104 __ b(ne, &L); |
104 __ mov(pc, Operand(lr)); | 105 __ mov(pc, Operand(lr)); |
105 | 106 |
106 CodeDesc desc; | 107 CodeDesc desc; |
107 assm.GetCode(&desc); | 108 assm.GetCode(&desc); |
108 Object* code = Heap::CreateCode(desc, | 109 Object* code = Heap::CreateCode( |
109 Code::ComputeFlags(Code::STUB), | 110 desc, |
110 Handle<Object>(Heap::undefined_value())); | 111 Code::ComputeFlags(Code::STUB), |
| 112 Handle<Object>(Heap::undefined_value()))->ToObjectChecked(); |
111 CHECK(code->IsCode()); | 113 CHECK(code->IsCode()); |
112 #ifdef DEBUG | 114 #ifdef DEBUG |
113 Code::cast(code)->Print(); | 115 Code::cast(code)->Print(); |
114 #endif | 116 #endif |
115 F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry()); | 117 F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry()); |
116 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 100, 0, 0, 0, 0)); | 118 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 100, 0, 0, 0, 0)); |
117 ::printf("f() = %d\n", res); | 119 ::printf("f() = %d\n", res); |
118 CHECK_EQ(5050, res); | 120 CHECK_EQ(5050, res); |
119 } | 121 } |
120 | 122 |
(...skipping 22 matching lines...) Expand all Loading... |
143 __ RecordComment("dead code, just testing relocations"); | 145 __ RecordComment("dead code, just testing relocations"); |
144 __ mov(r0, Operand(Factory::true_value())); | 146 __ mov(r0, Operand(Factory::true_value())); |
145 __ RecordComment("dead code, just testing immediate operands"); | 147 __ RecordComment("dead code, just testing immediate operands"); |
146 __ mov(r0, Operand(-1)); | 148 __ mov(r0, Operand(-1)); |
147 __ mov(r0, Operand(0xFF000000)); | 149 __ mov(r0, Operand(0xFF000000)); |
148 __ mov(r0, Operand(0xF0F0F0F0)); | 150 __ mov(r0, Operand(0xF0F0F0F0)); |
149 __ mov(r0, Operand(0xFFF0FFFF)); | 151 __ mov(r0, Operand(0xFFF0FFFF)); |
150 | 152 |
151 CodeDesc desc; | 153 CodeDesc desc; |
152 assm.GetCode(&desc); | 154 assm.GetCode(&desc); |
153 Object* code = Heap::CreateCode(desc, | 155 Object* code = Heap::CreateCode( |
154 Code::ComputeFlags(Code::STUB), | 156 desc, |
155 Handle<Object>(Heap::undefined_value())); | 157 Code::ComputeFlags(Code::STUB), |
| 158 Handle<Object>(Heap::undefined_value()))->ToObjectChecked(); |
156 CHECK(code->IsCode()); | 159 CHECK(code->IsCode()); |
157 #ifdef DEBUG | 160 #ifdef DEBUG |
158 Code::cast(code)->Print(); | 161 Code::cast(code)->Print(); |
159 #endif | 162 #endif |
160 F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry()); | 163 F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry()); |
161 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 10, 0, 0, 0, 0)); | 164 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 10, 0, 0, 0, 0)); |
162 ::printf("f() = %d\n", res); | 165 ::printf("f() = %d\n", res); |
163 CHECK_EQ(3628800, res); | 166 CHECK_EQ(3628800, res); |
164 } | 167 } |
165 | 168 |
(...skipping 24 matching lines...) Expand all Loading... |
190 __ mov(r2, Operand(r2, LSL, 2)); | 193 __ mov(r2, Operand(r2, LSL, 2)); |
191 __ strb(r2, MemOperand(r4, OFFSET_OF(T, c))); | 194 __ strb(r2, MemOperand(r4, OFFSET_OF(T, c))); |
192 __ ldrsh(r2, MemOperand(r4, OFFSET_OF(T, s))); | 195 __ ldrsh(r2, MemOperand(r4, OFFSET_OF(T, s))); |
193 __ add(r0, r2, Operand(r0)); | 196 __ add(r0, r2, Operand(r0)); |
194 __ mov(r2, Operand(r2, ASR, 3)); | 197 __ mov(r2, Operand(r2, ASR, 3)); |
195 __ strh(r2, MemOperand(r4, OFFSET_OF(T, s))); | 198 __ strh(r2, MemOperand(r4, OFFSET_OF(T, s))); |
196 __ ldm(ia_w, sp, r4.bit() | fp.bit() | pc.bit()); | 199 __ ldm(ia_w, sp, r4.bit() | fp.bit() | pc.bit()); |
197 | 200 |
198 CodeDesc desc; | 201 CodeDesc desc; |
199 assm.GetCode(&desc); | 202 assm.GetCode(&desc); |
200 Object* code = Heap::CreateCode(desc, | 203 Object* code = Heap::CreateCode( |
201 Code::ComputeFlags(Code::STUB), | 204 desc, |
202 Handle<Object>(Heap::undefined_value())); | 205 Code::ComputeFlags(Code::STUB), |
| 206 Handle<Object>(Heap::undefined_value()))->ToObjectChecked(); |
203 CHECK(code->IsCode()); | 207 CHECK(code->IsCode()); |
204 #ifdef DEBUG | 208 #ifdef DEBUG |
205 Code::cast(code)->Print(); | 209 Code::cast(code)->Print(); |
206 #endif | 210 #endif |
207 F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry()); | 211 F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry()); |
208 t.i = 100000; | 212 t.i = 100000; |
209 t.c = 10; | 213 t.c = 10; |
210 t.s = 1000; | 214 t.s = 1000; |
211 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0)); | 215 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0)); |
212 ::printf("f() = %d\n", res); | 216 ::printf("f() = %d\n", res); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 | 287 |
284 // Convert from integer to floating point. | 288 // Convert from integer to floating point. |
285 __ mov(lr, Operand(42)); | 289 __ mov(lr, Operand(42)); |
286 __ vmov(s31, lr); | 290 __ vmov(s31, lr); |
287 __ vcvt_f64_s32(d4, s31); | 291 __ vcvt_f64_s32(d4, s31); |
288 __ vstr(d4, r4, OFFSET_OF(T, f)); | 292 __ vstr(d4, r4, OFFSET_OF(T, f)); |
289 __ ldm(ia_w, sp, r4.bit() | fp.bit() | pc.bit()); | 293 __ ldm(ia_w, sp, r4.bit() | fp.bit() | pc.bit()); |
290 | 294 |
291 CodeDesc desc; | 295 CodeDesc desc; |
292 assm.GetCode(&desc); | 296 assm.GetCode(&desc); |
293 Object* code = Heap::CreateCode(desc, | 297 Object* code = Heap::CreateCode( |
294 Code::ComputeFlags(Code::STUB), | 298 desc, |
295 Handle<Object>(Heap::undefined_value())); | 299 Code::ComputeFlags(Code::STUB), |
| 300 Handle<Object>(Heap::undefined_value()))->ToObjectChecked(); |
296 CHECK(code->IsCode()); | 301 CHECK(code->IsCode()); |
297 #ifdef DEBUG | 302 #ifdef DEBUG |
298 Code::cast(code)->Print(); | 303 Code::cast(code)->Print(); |
299 #endif | 304 #endif |
300 F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry()); | 305 F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry()); |
301 t.a = 1.5; | 306 t.a = 1.5; |
302 t.b = 2.75; | 307 t.b = 2.75; |
303 t.c = 17.17; | 308 t.c = 17.17; |
304 t.d = 0.0; | 309 t.d = 0.0; |
305 t.e = 0.0; | 310 t.e = 0.0; |
(...skipping 28 matching lines...) Expand all Loading... |
334 // On entry, r0 = 0xAAAAAAAA = 0b10..10101010. | 339 // On entry, r0 = 0xAAAAAAAA = 0b10..10101010. |
335 __ ubfx(r0, r0, 1, 12); // 0b00..010101010101 = 0x555 | 340 __ ubfx(r0, r0, 1, 12); // 0b00..010101010101 = 0x555 |
336 __ sbfx(r0, r0, 0, 5); // 0b11..111111110101 = -11 | 341 __ sbfx(r0, r0, 0, 5); // 0b11..111111110101 = -11 |
337 __ bfc(r0, 1, 3); // 0b11..111111110001 = -15 | 342 __ bfc(r0, 1, 3); // 0b11..111111110001 = -15 |
338 __ mov(r1, Operand(7)); | 343 __ mov(r1, Operand(7)); |
339 __ bfi(r0, r1, 3, 3); // 0b11..111111111001 = -7 | 344 __ bfi(r0, r1, 3, 3); // 0b11..111111111001 = -7 |
340 __ mov(pc, Operand(lr)); | 345 __ mov(pc, Operand(lr)); |
341 | 346 |
342 CodeDesc desc; | 347 CodeDesc desc; |
343 assm.GetCode(&desc); | 348 assm.GetCode(&desc); |
344 Object* code = Heap::CreateCode(desc, | 349 Object* code = Heap::CreateCode( |
345 Code::ComputeFlags(Code::STUB), | 350 desc, |
346 Handle<Object>(Heap::undefined_value())); | 351 Code::ComputeFlags(Code::STUB), |
| 352 Handle<Object>(Heap::undefined_value()))->ToObjectChecked(); |
347 CHECK(code->IsCode()); | 353 CHECK(code->IsCode()); |
348 #ifdef DEBUG | 354 #ifdef DEBUG |
349 Code::cast(code)->Print(); | 355 Code::cast(code)->Print(); |
350 #endif | 356 #endif |
351 F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry()); | 357 F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry()); |
352 int res = reinterpret_cast<int>( | 358 int res = reinterpret_cast<int>( |
353 CALL_GENERATED_CODE(f, 0xAAAAAAAA, 0, 0, 0, 0)); | 359 CALL_GENERATED_CODE(f, 0xAAAAAAAA, 0, 0, 0, 0)); |
354 ::printf("f() = %d\n", res); | 360 ::printf("f() = %d\n", res); |
355 CHECK_EQ(-7, res); | 361 CHECK_EQ(-7, res); |
356 } | 362 } |
(...skipping 11 matching lines...) Expand all Loading... |
368 CpuFeatures::Scope scope(ARMv7); | 374 CpuFeatures::Scope scope(ARMv7); |
369 __ usat(r1, 8, Operand(r0)); // Sat 0xFFFF to 0-255 = 0xFF. | 375 __ usat(r1, 8, Operand(r0)); // Sat 0xFFFF to 0-255 = 0xFF. |
370 __ usat(r2, 12, Operand(r0, ASR, 9)); // Sat (0xFFFF>>9) to 0-4095 = 0x7F. | 376 __ usat(r2, 12, Operand(r0, ASR, 9)); // Sat (0xFFFF>>9) to 0-4095 = 0x7F. |
371 __ usat(r3, 1, Operand(r0, LSL, 16)); // Sat (0xFFFF<<16) to 0-1 = 0x0. | 377 __ usat(r3, 1, Operand(r0, LSL, 16)); // Sat (0xFFFF<<16) to 0-1 = 0x0. |
372 __ add(r0, r1, Operand(r2)); | 378 __ add(r0, r1, Operand(r2)); |
373 __ add(r0, r0, Operand(r3)); | 379 __ add(r0, r0, Operand(r3)); |
374 __ mov(pc, Operand(lr)); | 380 __ mov(pc, Operand(lr)); |
375 | 381 |
376 CodeDesc desc; | 382 CodeDesc desc; |
377 assm.GetCode(&desc); | 383 assm.GetCode(&desc); |
378 Object* code = Heap::CreateCode(desc, | 384 Object* code = Heap::CreateCode( |
379 Code::ComputeFlags(Code::STUB), | 385 desc, |
380 Handle<Object>(Heap::undefined_value())); | 386 Code::ComputeFlags(Code::STUB), |
| 387 Handle<Object>(Heap::undefined_value()))->ToObjectChecked(); |
381 CHECK(code->IsCode()); | 388 CHECK(code->IsCode()); |
382 #ifdef DEBUG | 389 #ifdef DEBUG |
383 Code::cast(code)->Print(); | 390 Code::cast(code)->Print(); |
384 #endif | 391 #endif |
385 F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry()); | 392 F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry()); |
386 int res = reinterpret_cast<int>( | 393 int res = reinterpret_cast<int>( |
387 CALL_GENERATED_CODE(f, 0xFFFF, 0, 0, 0, 0)); | 394 CALL_GENERATED_CODE(f, 0xFFFF, 0, 0, 0, 0)); |
388 ::printf("f() = %d\n", res); | 395 ::printf("f() = %d\n", res); |
389 CHECK_EQ(382, res); | 396 CHECK_EQ(382, res); |
390 } | 397 } |
391 } | 398 } |
392 | 399 |
393 #undef __ | 400 #undef __ |
OLD | NEW |