| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(desc, |
| 73 NULL, | |
| 74 Code::ComputeFlags(Code::STUB), | 73 Code::ComputeFlags(Code::STUB), |
| 75 Handle<Object>(Heap::undefined_value())); | 74 Handle<Object>(Heap::undefined_value())); |
| 76 CHECK(code->IsCode()); | 75 CHECK(code->IsCode()); |
| 77 #ifdef DEBUG | 76 #ifdef DEBUG |
| 78 Code::cast(code)->Print(); | 77 Code::cast(code)->Print(); |
| 79 #endif | 78 #endif |
| 80 F2 f = FUNCTION_CAST<F2>(Code::cast(code)->entry()); | 79 F2 f = FUNCTION_CAST<F2>(Code::cast(code)->entry()); |
| 81 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 3, 4, 0, 0, 0)); | 80 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 3, 4, 0, 0, 0)); |
| 82 ::printf("f() = %d\n", res); | 81 ::printf("f() = %d\n", res); |
| 83 CHECK_EQ(7, res); | 82 CHECK_EQ(7, res); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 100 __ sub(r1, r1, Operand(1)); | 99 __ sub(r1, r1, Operand(1)); |
| 101 | 100 |
| 102 __ bind(&C); | 101 __ bind(&C); |
| 103 __ teq(r1, Operand(0)); | 102 __ teq(r1, Operand(0)); |
| 104 __ b(ne, &L); | 103 __ b(ne, &L); |
| 105 __ mov(pc, Operand(lr)); | 104 __ mov(pc, Operand(lr)); |
| 106 | 105 |
| 107 CodeDesc desc; | 106 CodeDesc desc; |
| 108 assm.GetCode(&desc); | 107 assm.GetCode(&desc); |
| 109 Object* code = Heap::CreateCode(desc, | 108 Object* code = Heap::CreateCode(desc, |
| 110 NULL, | |
| 111 Code::ComputeFlags(Code::STUB), | 109 Code::ComputeFlags(Code::STUB), |
| 112 Handle<Object>(Heap::undefined_value())); | 110 Handle<Object>(Heap::undefined_value())); |
| 113 CHECK(code->IsCode()); | 111 CHECK(code->IsCode()); |
| 114 #ifdef DEBUG | 112 #ifdef DEBUG |
| 115 Code::cast(code)->Print(); | 113 Code::cast(code)->Print(); |
| 116 #endif | 114 #endif |
| 117 F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry()); | 115 F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry()); |
| 118 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 100, 0, 0, 0, 0)); | 116 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 100, 0, 0, 0, 0)); |
| 119 ::printf("f() = %d\n", res); | 117 ::printf("f() = %d\n", res); |
| 120 CHECK_EQ(5050, res); | 118 CHECK_EQ(5050, res); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 146 __ mov(r0, Operand(Factory::true_value())); | 144 __ mov(r0, Operand(Factory::true_value())); |
| 147 __ RecordComment("dead code, just testing immediate operands"); | 145 __ RecordComment("dead code, just testing immediate operands"); |
| 148 __ mov(r0, Operand(-1)); | 146 __ mov(r0, Operand(-1)); |
| 149 __ mov(r0, Operand(0xFF000000)); | 147 __ mov(r0, Operand(0xFF000000)); |
| 150 __ mov(r0, Operand(0xF0F0F0F0)); | 148 __ mov(r0, Operand(0xF0F0F0F0)); |
| 151 __ mov(r0, Operand(0xFFF0FFFF)); | 149 __ mov(r0, Operand(0xFFF0FFFF)); |
| 152 | 150 |
| 153 CodeDesc desc; | 151 CodeDesc desc; |
| 154 assm.GetCode(&desc); | 152 assm.GetCode(&desc); |
| 155 Object* code = Heap::CreateCode(desc, | 153 Object* code = Heap::CreateCode(desc, |
| 156 NULL, | |
| 157 Code::ComputeFlags(Code::STUB), | 154 Code::ComputeFlags(Code::STUB), |
| 158 Handle<Object>(Heap::undefined_value())); | 155 Handle<Object>(Heap::undefined_value())); |
| 159 CHECK(code->IsCode()); | 156 CHECK(code->IsCode()); |
| 160 #ifdef DEBUG | 157 #ifdef DEBUG |
| 161 Code::cast(code)->Print(); | 158 Code::cast(code)->Print(); |
| 162 #endif | 159 #endif |
| 163 F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry()); | 160 F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry()); |
| 164 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 10, 0, 0, 0, 0)); | 161 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 10, 0, 0, 0, 0)); |
| 165 ::printf("f() = %d\n", res); | 162 ::printf("f() = %d\n", res); |
| 166 CHECK_EQ(3628800, res); | 163 CHECK_EQ(3628800, res); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 194 __ strb(r2, MemOperand(r4, OFFSET_OF(T, c))); | 191 __ strb(r2, MemOperand(r4, OFFSET_OF(T, c))); |
| 195 __ ldrsh(r2, MemOperand(r4, OFFSET_OF(T, s))); | 192 __ ldrsh(r2, MemOperand(r4, OFFSET_OF(T, s))); |
| 196 __ add(r0, r2, Operand(r0)); | 193 __ add(r0, r2, Operand(r0)); |
| 197 __ mov(r2, Operand(r2, ASR, 3)); | 194 __ mov(r2, Operand(r2, ASR, 3)); |
| 198 __ strh(r2, MemOperand(r4, OFFSET_OF(T, s))); | 195 __ strh(r2, MemOperand(r4, OFFSET_OF(T, s))); |
| 199 __ ldm(ia_w, sp, r4.bit() | fp.bit() | pc.bit()); | 196 __ ldm(ia_w, sp, r4.bit() | fp.bit() | pc.bit()); |
| 200 | 197 |
| 201 CodeDesc desc; | 198 CodeDesc desc; |
| 202 assm.GetCode(&desc); | 199 assm.GetCode(&desc); |
| 203 Object* code = Heap::CreateCode(desc, | 200 Object* code = Heap::CreateCode(desc, |
| 204 NULL, | |
| 205 Code::ComputeFlags(Code::STUB), | 201 Code::ComputeFlags(Code::STUB), |
| 206 Handle<Object>(Heap::undefined_value())); | 202 Handle<Object>(Heap::undefined_value())); |
| 207 CHECK(code->IsCode()); | 203 CHECK(code->IsCode()); |
| 208 #ifdef DEBUG | 204 #ifdef DEBUG |
| 209 Code::cast(code)->Print(); | 205 Code::cast(code)->Print(); |
| 210 #endif | 206 #endif |
| 211 F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry()); | 207 F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry()); |
| 212 t.i = 100000; | 208 t.i = 100000; |
| 213 t.c = 10; | 209 t.c = 10; |
| 214 t.s = 1000; | 210 t.s = 1000; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 | 250 |
| 255 __ vmov(r2, r3, d5); | 251 __ vmov(r2, r3, d5); |
| 256 __ vmov(d4, r2, r3); | 252 __ vmov(d4, r2, r3); |
| 257 __ vstr(d4, r4, OFFSET_OF(T, b)); | 253 __ vstr(d4, r4, OFFSET_OF(T, b)); |
| 258 | 254 |
| 259 __ ldm(ia_w, sp, r4.bit() | fp.bit() | pc.bit()); | 255 __ ldm(ia_w, sp, r4.bit() | fp.bit() | pc.bit()); |
| 260 | 256 |
| 261 CodeDesc desc; | 257 CodeDesc desc; |
| 262 assm.GetCode(&desc); | 258 assm.GetCode(&desc); |
| 263 Object* code = Heap::CreateCode(desc, | 259 Object* code = Heap::CreateCode(desc, |
| 264 NULL, | |
| 265 Code::ComputeFlags(Code::STUB), | 260 Code::ComputeFlags(Code::STUB), |
| 266 Handle<Object>(Heap::undefined_value())); | 261 Handle<Object>(Heap::undefined_value())); |
| 267 CHECK(code->IsCode()); | 262 CHECK(code->IsCode()); |
| 268 #ifdef DEBUG | 263 #ifdef DEBUG |
| 269 Code::cast(code)->Print(); | 264 Code::cast(code)->Print(); |
| 270 #endif | 265 #endif |
| 271 F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry()); | 266 F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry()); |
| 272 t.a = 1.5; | 267 t.a = 1.5; |
| 273 t.b = 2.75; | 268 t.b = 2.75; |
| 274 t.c = 17.17; | 269 t.c = 17.17; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 294 __ ubfx(r0, r0, 1, 12); // 0b00..010101010101 = 0x555 | 289 __ ubfx(r0, r0, 1, 12); // 0b00..010101010101 = 0x555 |
| 295 __ sbfx(r0, r0, 0, 5); // 0b11..111111110101 = -11 | 290 __ sbfx(r0, r0, 0, 5); // 0b11..111111110101 = -11 |
| 296 __ bfc(r0, 1, 3); // 0b11..111111110001 = -15 | 291 __ bfc(r0, 1, 3); // 0b11..111111110001 = -15 |
| 297 __ mov(r1, Operand(7)); | 292 __ mov(r1, Operand(7)); |
| 298 __ bfi(r0, r1, 3, 3); // 0b11..111111111001 = -7 | 293 __ bfi(r0, r1, 3, 3); // 0b11..111111111001 = -7 |
| 299 __ mov(pc, Operand(lr)); | 294 __ mov(pc, Operand(lr)); |
| 300 | 295 |
| 301 CodeDesc desc; | 296 CodeDesc desc; |
| 302 assm.GetCode(&desc); | 297 assm.GetCode(&desc); |
| 303 Object* code = Heap::CreateCode(desc, | 298 Object* code = Heap::CreateCode(desc, |
| 304 NULL, | |
| 305 Code::ComputeFlags(Code::STUB), | 299 Code::ComputeFlags(Code::STUB), |
| 306 Handle<Object>(Heap::undefined_value())); | 300 Handle<Object>(Heap::undefined_value())); |
| 307 CHECK(code->IsCode()); | 301 CHECK(code->IsCode()); |
| 308 #ifdef DEBUG | 302 #ifdef DEBUG |
| 309 Code::cast(code)->Print(); | 303 Code::cast(code)->Print(); |
| 310 #endif | 304 #endif |
| 311 F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry()); | 305 F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry()); |
| 312 int res = reinterpret_cast<int>( | 306 int res = reinterpret_cast<int>( |
| 313 CALL_GENERATED_CODE(f, 0xAAAAAAAA, 0, 0, 0, 0)); | 307 CALL_GENERATED_CODE(f, 0xAAAAAAAA, 0, 0, 0, 0)); |
| 314 ::printf("f() = %d\n", res); | 308 ::printf("f() = %d\n", res); |
| 315 CHECK_EQ(-7, res); | 309 CHECK_EQ(-7, res); |
| 316 } | 310 } |
| 317 } | 311 } |
| 318 | 312 |
| 319 #undef __ | 313 #undef __ |
| OLD | NEW |