Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 52 } | 52 } |
| 53 } | 53 } |
| 54 | 54 |
| 55 | 55 |
| 56 #define __ assm. | 56 #define __ assm. |
| 57 | 57 |
| 58 TEST(0) { | 58 TEST(0) { |
| 59 InitializeVM(); | 59 InitializeVM(); |
| 60 v8::HandleScope scope; | 60 v8::HandleScope scope; |
| 61 | 61 |
| 62 Assembler assm(Isolate::Current(), NULL, 0); | 62 Isolate* isolate = Isolate::Current(); |
| 63 Assembler assm(isolate, NULL, 0); | |
| 63 | 64 |
| 64 __ add(r0, r0, Operand(r1)); | 65 __ add(r0, r0, Operand(r1)); |
| 65 __ mov(pc, Operand(lr)); | 66 __ mov(pc, Operand(lr)); |
| 66 | 67 |
| 67 CodeDesc desc; | 68 CodeDesc desc; |
| 68 assm.GetCode(&desc); | 69 assm.GetCode(&desc); |
| 69 Object* code = HEAP->CreateCode( | 70 Object* code = isolate->heap()->CreateCode( |
| 70 desc, | 71 desc, |
| 71 Code::ComputeFlags(Code::STUB), | 72 Code::ComputeFlags(Code::STUB), |
| 72 Handle<Object>(HEAP->undefined_value()))->ToObjectChecked(); | 73 Handle<Object>(isolate->heap()->undefined_value(), |
|
Michael Starzinger
2013/02/25 10:50:58
Just use "isolate->factory()->undefined_value()" h
Sven Panne
2013/02/25 14:44:43
Done.
| |
| 74 isolate))->ToObjectChecked(); | |
| 73 CHECK(code->IsCode()); | 75 CHECK(code->IsCode()); |
| 74 #ifdef DEBUG | 76 #ifdef DEBUG |
| 75 Code::cast(code)->Print(); | 77 Code::cast(code)->Print(); |
| 76 #endif | 78 #endif |
| 77 F2 f = FUNCTION_CAST<F2>(Code::cast(code)->entry()); | 79 F2 f = FUNCTION_CAST<F2>(Code::cast(code)->entry()); |
| 78 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)); |
| 79 ::printf("f() = %d\n", res); | 81 ::printf("f() = %d\n", res); |
| 80 CHECK_EQ(7, res); | 82 CHECK_EQ(7, res); |
| 81 } | 83 } |
| 82 | 84 |
| 83 | 85 |
| 84 TEST(1) { | 86 TEST(1) { |
| 85 InitializeVM(); | 87 InitializeVM(); |
| 86 v8::HandleScope scope; | 88 v8::HandleScope scope; |
| 87 | 89 |
| 88 Assembler assm(Isolate::Current(), NULL, 0); | 90 Isolate* isolate = Isolate::Current(); |
| 91 Assembler assm(isolate, NULL, 0); | |
| 89 Label L, C; | 92 Label L, C; |
| 90 | 93 |
| 91 __ mov(r1, Operand(r0)); | 94 __ mov(r1, Operand(r0)); |
| 92 __ mov(r0, Operand::Zero()); | 95 __ mov(r0, Operand::Zero()); |
| 93 __ b(&C); | 96 __ b(&C); |
| 94 | 97 |
| 95 __ bind(&L); | 98 __ bind(&L); |
| 96 __ add(r0, r0, Operand(r1)); | 99 __ add(r0, r0, Operand(r1)); |
| 97 __ sub(r1, r1, Operand(1)); | 100 __ sub(r1, r1, Operand(1)); |
| 98 | 101 |
| 99 __ bind(&C); | 102 __ bind(&C); |
| 100 __ teq(r1, Operand::Zero()); | 103 __ teq(r1, Operand::Zero()); |
| 101 __ b(ne, &L); | 104 __ b(ne, &L); |
| 102 __ mov(pc, Operand(lr)); | 105 __ mov(pc, Operand(lr)); |
| 103 | 106 |
| 104 CodeDesc desc; | 107 CodeDesc desc; |
| 105 assm.GetCode(&desc); | 108 assm.GetCode(&desc); |
| 106 Object* code = HEAP->CreateCode( | 109 Object* code = isolate->heap()->CreateCode( |
| 107 desc, | 110 desc, |
| 108 Code::ComputeFlags(Code::STUB), | 111 Code::ComputeFlags(Code::STUB), |
| 109 Handle<Object>(HEAP->undefined_value()))->ToObjectChecked(); | 112 Handle<Object>(isolate->heap()->undefined_value(), |
| 113 isolate))->ToObjectChecked(); | |
| 110 CHECK(code->IsCode()); | 114 CHECK(code->IsCode()); |
| 111 #ifdef DEBUG | 115 #ifdef DEBUG |
| 112 Code::cast(code)->Print(); | 116 Code::cast(code)->Print(); |
| 113 #endif | 117 #endif |
| 114 F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry()); | 118 F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry()); |
| 115 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 100, 0, 0, 0, 0)); | 119 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 100, 0, 0, 0, 0)); |
| 116 ::printf("f() = %d\n", res); | 120 ::printf("f() = %d\n", res); |
| 117 CHECK_EQ(5050, res); | 121 CHECK_EQ(5050, res); |
| 118 } | 122 } |
| 119 | 123 |
| 120 | 124 |
| 121 TEST(2) { | 125 TEST(2) { |
| 122 InitializeVM(); | 126 InitializeVM(); |
| 123 v8::HandleScope scope; | 127 v8::HandleScope scope; |
| 124 | 128 |
| 125 Assembler assm(Isolate::Current(), NULL, 0); | 129 Isolate* isolate = Isolate::Current(); |
| 130 Assembler assm(isolate, NULL, 0); | |
| 126 Label L, C; | 131 Label L, C; |
| 127 | 132 |
| 128 __ mov(r1, Operand(r0)); | 133 __ mov(r1, Operand(r0)); |
| 129 __ mov(r0, Operand(1)); | 134 __ mov(r0, Operand(1)); |
| 130 __ b(&C); | 135 __ b(&C); |
| 131 | 136 |
| 132 __ bind(&L); | 137 __ bind(&L); |
| 133 __ mul(r0, r1, r0); | 138 __ mul(r0, r1, r0); |
| 134 __ sub(r1, r1, Operand(1)); | 139 __ sub(r1, r1, Operand(1)); |
| 135 | 140 |
| 136 __ bind(&C); | 141 __ bind(&C); |
| 137 __ teq(r1, Operand::Zero()); | 142 __ teq(r1, Operand::Zero()); |
| 138 __ b(ne, &L); | 143 __ b(ne, &L); |
| 139 __ mov(pc, Operand(lr)); | 144 __ mov(pc, Operand(lr)); |
| 140 | 145 |
| 141 // some relocated stuff here, not executed | 146 // some relocated stuff here, not executed |
| 142 __ RecordComment("dead code, just testing relocations"); | 147 __ RecordComment("dead code, just testing relocations"); |
| 143 __ mov(r0, Operand(FACTORY->true_value())); | 148 __ mov(r0, Operand(FACTORY->true_value())); |
| 144 __ RecordComment("dead code, just testing immediate operands"); | 149 __ RecordComment("dead code, just testing immediate operands"); |
| 145 __ mov(r0, Operand(-1)); | 150 __ mov(r0, Operand(-1)); |
| 146 __ mov(r0, Operand(0xFF000000)); | 151 __ mov(r0, Operand(0xFF000000)); |
| 147 __ mov(r0, Operand(0xF0F0F0F0)); | 152 __ mov(r0, Operand(0xF0F0F0F0)); |
| 148 __ mov(r0, Operand(0xFFF0FFFF)); | 153 __ mov(r0, Operand(0xFFF0FFFF)); |
| 149 | 154 |
| 150 CodeDesc desc; | 155 CodeDesc desc; |
| 151 assm.GetCode(&desc); | 156 assm.GetCode(&desc); |
| 152 Object* code = HEAP->CreateCode( | 157 Object* code = isolate->heap()->CreateCode( |
| 153 desc, | 158 desc, |
| 154 Code::ComputeFlags(Code::STUB), | 159 Code::ComputeFlags(Code::STUB), |
| 155 Handle<Object>(HEAP->undefined_value()))->ToObjectChecked(); | 160 Handle<Object>(isolate->heap()->undefined_value(), |
| 161 isolate))->ToObjectChecked(); | |
| 156 CHECK(code->IsCode()); | 162 CHECK(code->IsCode()); |
| 157 #ifdef DEBUG | 163 #ifdef DEBUG |
| 158 Code::cast(code)->Print(); | 164 Code::cast(code)->Print(); |
| 159 #endif | 165 #endif |
| 160 F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry()); | 166 F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry()); |
| 161 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 10, 0, 0, 0, 0)); | 167 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 10, 0, 0, 0, 0)); |
| 162 ::printf("f() = %d\n", res); | 168 ::printf("f() = %d\n", res); |
| 163 CHECK_EQ(3628800, res); | 169 CHECK_EQ(3628800, res); |
| 164 } | 170 } |
| 165 | 171 |
| 166 | 172 |
| 167 TEST(3) { | 173 TEST(3) { |
| 168 InitializeVM(); | 174 InitializeVM(); |
| 169 v8::HandleScope scope; | 175 v8::HandleScope scope; |
| 170 | 176 |
| 171 typedef struct { | 177 typedef struct { |
| 172 int i; | 178 int i; |
| 173 char c; | 179 char c; |
| 174 int16_t s; | 180 int16_t s; |
| 175 } T; | 181 } T; |
| 176 T t; | 182 T t; |
| 177 | 183 |
| 178 Assembler assm(Isolate::Current(), NULL, 0); | 184 Isolate* isolate = Isolate::Current(); |
| 185 Assembler assm(isolate, NULL, 0); | |
| 179 Label L, C; | 186 Label L, C; |
| 180 | 187 |
| 181 __ mov(ip, Operand(sp)); | 188 __ mov(ip, Operand(sp)); |
| 182 __ stm(db_w, sp, r4.bit() | fp.bit() | lr.bit()); | 189 __ stm(db_w, sp, r4.bit() | fp.bit() | lr.bit()); |
| 183 __ sub(fp, ip, Operand(4)); | 190 __ sub(fp, ip, Operand(4)); |
| 184 __ mov(r4, Operand(r0)); | 191 __ mov(r4, Operand(r0)); |
| 185 __ ldr(r0, MemOperand(r4, OFFSET_OF(T, i))); | 192 __ ldr(r0, MemOperand(r4, OFFSET_OF(T, i))); |
| 186 __ mov(r2, Operand(r0, ASR, 1)); | 193 __ mov(r2, Operand(r0, ASR, 1)); |
| 187 __ str(r2, MemOperand(r4, OFFSET_OF(T, i))); | 194 __ str(r2, MemOperand(r4, OFFSET_OF(T, i))); |
| 188 __ ldrsb(r2, MemOperand(r4, OFFSET_OF(T, c))); | 195 __ ldrsb(r2, MemOperand(r4, OFFSET_OF(T, c))); |
| 189 __ add(r0, r2, Operand(r0)); | 196 __ add(r0, r2, Operand(r0)); |
| 190 __ mov(r2, Operand(r2, LSL, 2)); | 197 __ mov(r2, Operand(r2, LSL, 2)); |
| 191 __ strb(r2, MemOperand(r4, OFFSET_OF(T, c))); | 198 __ strb(r2, MemOperand(r4, OFFSET_OF(T, c))); |
| 192 __ ldrsh(r2, MemOperand(r4, OFFSET_OF(T, s))); | 199 __ ldrsh(r2, MemOperand(r4, OFFSET_OF(T, s))); |
| 193 __ add(r0, r2, Operand(r0)); | 200 __ add(r0, r2, Operand(r0)); |
| 194 __ mov(r2, Operand(r2, ASR, 3)); | 201 __ mov(r2, Operand(r2, ASR, 3)); |
| 195 __ strh(r2, MemOperand(r4, OFFSET_OF(T, s))); | 202 __ strh(r2, MemOperand(r4, OFFSET_OF(T, s))); |
| 196 __ ldm(ia_w, sp, r4.bit() | fp.bit() | pc.bit()); | 203 __ ldm(ia_w, sp, r4.bit() | fp.bit() | pc.bit()); |
| 197 | 204 |
| 198 CodeDesc desc; | 205 CodeDesc desc; |
| 199 assm.GetCode(&desc); | 206 assm.GetCode(&desc); |
| 200 Object* code = HEAP->CreateCode( | 207 Object* code = isolate->heap()->CreateCode( |
| 201 desc, | 208 desc, |
| 202 Code::ComputeFlags(Code::STUB), | 209 Code::ComputeFlags(Code::STUB), |
| 203 Handle<Object>(HEAP->undefined_value()))->ToObjectChecked(); | 210 Handle<Object>(isolate->heap()->undefined_value(), |
| 211 isolate))->ToObjectChecked(); | |
| 204 CHECK(code->IsCode()); | 212 CHECK(code->IsCode()); |
| 205 #ifdef DEBUG | 213 #ifdef DEBUG |
| 206 Code::cast(code)->Print(); | 214 Code::cast(code)->Print(); |
| 207 #endif | 215 #endif |
| 208 F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry()); | 216 F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry()); |
| 209 t.i = 100000; | 217 t.i = 100000; |
| 210 t.c = 10; | 218 t.c = 10; |
| 211 t.s = 1000; | 219 t.s = 1000; |
| 212 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0)); | 220 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0)); |
| 213 ::printf("f() = %d\n", res); | 221 ::printf("f() = %d\n", res); |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 235 int i; | 243 int i; |
| 236 double m; | 244 double m; |
| 237 double n; | 245 double n; |
| 238 float x; | 246 float x; |
| 239 float y; | 247 float y; |
| 240 } T; | 248 } T; |
| 241 T t; | 249 T t; |
| 242 | 250 |
| 243 // Create a function that accepts &t, and loads, manipulates, and stores | 251 // Create a function that accepts &t, and loads, manipulates, and stores |
| 244 // the doubles and floats. | 252 // the doubles and floats. |
| 245 Assembler assm(Isolate::Current(), NULL, 0); | 253 Isolate* isolate = Isolate::Current(); |
| 254 Assembler assm(isolate, NULL, 0); | |
| 246 Label L, C; | 255 Label L, C; |
| 247 | 256 |
| 248 | 257 |
| 249 if (CpuFeatures::IsSupported(VFP3)) { | 258 if (CpuFeatures::IsSupported(VFP3)) { |
| 250 CpuFeatures::Scope scope(VFP3); | 259 CpuFeatures::Scope scope(VFP3); |
| 251 | 260 |
| 252 __ mov(ip, Operand(sp)); | 261 __ mov(ip, Operand(sp)); |
| 253 __ stm(db_w, sp, r4.bit() | fp.bit() | lr.bit()); | 262 __ stm(db_w, sp, r4.bit() | fp.bit() | lr.bit()); |
| 254 __ sub(fp, ip, Operand(4)); | 263 __ sub(fp, ip, Operand(4)); |
| 255 | 264 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 307 __ vneg(d0, d1); | 316 __ vneg(d0, d1); |
| 308 __ vstr(d0, r4, OFFSET_OF(T, m)); | 317 __ vstr(d0, r4, OFFSET_OF(T, m)); |
| 309 __ vldr(d1, r4, OFFSET_OF(T, n)); | 318 __ vldr(d1, r4, OFFSET_OF(T, n)); |
| 310 __ vneg(d0, d1); | 319 __ vneg(d0, d1); |
| 311 __ vstr(d0, r4, OFFSET_OF(T, n)); | 320 __ vstr(d0, r4, OFFSET_OF(T, n)); |
| 312 | 321 |
| 313 __ ldm(ia_w, sp, r4.bit() | fp.bit() | pc.bit()); | 322 __ ldm(ia_w, sp, r4.bit() | fp.bit() | pc.bit()); |
| 314 | 323 |
| 315 CodeDesc desc; | 324 CodeDesc desc; |
| 316 assm.GetCode(&desc); | 325 assm.GetCode(&desc); |
| 317 Object* code = HEAP->CreateCode( | 326 Object* code = isolate->heap()->CreateCode( |
| 318 desc, | 327 desc, |
| 319 Code::ComputeFlags(Code::STUB), | 328 Code::ComputeFlags(Code::STUB), |
| 320 Handle<Object>(HEAP->undefined_value()))->ToObjectChecked(); | 329 Handle<Object>(isolate->heap()->undefined_value(), |
| 330 isolate))->ToObjectChecked(); | |
| 321 CHECK(code->IsCode()); | 331 CHECK(code->IsCode()); |
| 322 #ifdef DEBUG | 332 #ifdef DEBUG |
| 323 Code::cast(code)->Print(); | 333 Code::cast(code)->Print(); |
| 324 #endif | 334 #endif |
| 325 F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry()); | 335 F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry()); |
| 326 t.a = 1.5; | 336 t.a = 1.5; |
| 327 t.b = 2.75; | 337 t.b = 2.75; |
| 328 t.c = 17.17; | 338 t.c = 17.17; |
| 329 t.d = 0.0; | 339 t.d = 0.0; |
| 330 t.e = 0.0; | 340 t.e = 0.0; |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 353 CHECK_EQ(1.5, t.a); | 363 CHECK_EQ(1.5, t.a); |
| 354 } | 364 } |
| 355 } | 365 } |
| 356 | 366 |
| 357 | 367 |
| 358 TEST(5) { | 368 TEST(5) { |
| 359 // Test the ARMv7 bitfield instructions. | 369 // Test the ARMv7 bitfield instructions. |
| 360 InitializeVM(); | 370 InitializeVM(); |
| 361 v8::HandleScope scope; | 371 v8::HandleScope scope; |
| 362 | 372 |
| 363 Assembler assm(Isolate::Current(), NULL, 0); | 373 Isolate* isolate = Isolate::Current(); |
| 374 Assembler assm(isolate, NULL, 0); | |
| 364 | 375 |
| 365 if (CpuFeatures::IsSupported(ARMv7)) { | 376 if (CpuFeatures::IsSupported(ARMv7)) { |
| 366 CpuFeatures::Scope scope(ARMv7); | 377 CpuFeatures::Scope scope(ARMv7); |
| 367 // On entry, r0 = 0xAAAAAAAA = 0b10..10101010. | 378 // On entry, r0 = 0xAAAAAAAA = 0b10..10101010. |
| 368 __ ubfx(r0, r0, 1, 12); // 0b00..010101010101 = 0x555 | 379 __ ubfx(r0, r0, 1, 12); // 0b00..010101010101 = 0x555 |
| 369 __ sbfx(r0, r0, 0, 5); // 0b11..111111110101 = -11 | 380 __ sbfx(r0, r0, 0, 5); // 0b11..111111110101 = -11 |
| 370 __ bfc(r0, 1, 3); // 0b11..111111110001 = -15 | 381 __ bfc(r0, 1, 3); // 0b11..111111110001 = -15 |
| 371 __ mov(r1, Operand(7)); | 382 __ mov(r1, Operand(7)); |
| 372 __ bfi(r0, r1, 3, 3); // 0b11..111111111001 = -7 | 383 __ bfi(r0, r1, 3, 3); // 0b11..111111111001 = -7 |
| 373 __ mov(pc, Operand(lr)); | 384 __ mov(pc, Operand(lr)); |
| 374 | 385 |
| 375 CodeDesc desc; | 386 CodeDesc desc; |
| 376 assm.GetCode(&desc); | 387 assm.GetCode(&desc); |
| 377 Object* code = HEAP->CreateCode( | 388 Object* code = isolate->heap()->CreateCode( |
| 378 desc, | 389 desc, |
| 379 Code::ComputeFlags(Code::STUB), | 390 Code::ComputeFlags(Code::STUB), |
| 380 Handle<Object>(HEAP->undefined_value()))->ToObjectChecked(); | 391 Handle<Object>(isolate->heap()->undefined_value(), |
| 392 isolate))->ToObjectChecked(); | |
| 381 CHECK(code->IsCode()); | 393 CHECK(code->IsCode()); |
| 382 #ifdef DEBUG | 394 #ifdef DEBUG |
| 383 Code::cast(code)->Print(); | 395 Code::cast(code)->Print(); |
| 384 #endif | 396 #endif |
| 385 F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry()); | 397 F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry()); |
| 386 int res = reinterpret_cast<int>( | 398 int res = reinterpret_cast<int>( |
| 387 CALL_GENERATED_CODE(f, 0xAAAAAAAA, 0, 0, 0, 0)); | 399 CALL_GENERATED_CODE(f, 0xAAAAAAAA, 0, 0, 0, 0)); |
| 388 ::printf("f() = %d\n", res); | 400 ::printf("f() = %d\n", res); |
| 389 CHECK_EQ(-7, res); | 401 CHECK_EQ(-7, res); |
| 390 } | 402 } |
| 391 } | 403 } |
| 392 | 404 |
| 393 | 405 |
| 394 TEST(6) { | 406 TEST(6) { |
| 395 // Test saturating instructions. | 407 // Test saturating instructions. |
| 396 InitializeVM(); | 408 InitializeVM(); |
| 397 v8::HandleScope scope; | 409 v8::HandleScope scope; |
| 398 | 410 |
| 399 Assembler assm(Isolate::Current(), NULL, 0); | 411 Isolate* isolate = Isolate::Current(); |
| 412 Assembler assm(isolate, NULL, 0); | |
| 400 | 413 |
| 401 if (CpuFeatures::IsSupported(ARMv7)) { | 414 if (CpuFeatures::IsSupported(ARMv7)) { |
| 402 CpuFeatures::Scope scope(ARMv7); | 415 CpuFeatures::Scope scope(ARMv7); |
| 403 __ usat(r1, 8, Operand(r0)); // Sat 0xFFFF to 0-255 = 0xFF. | 416 __ usat(r1, 8, Operand(r0)); // Sat 0xFFFF to 0-255 = 0xFF. |
| 404 __ usat(r2, 12, Operand(r0, ASR, 9)); // Sat (0xFFFF>>9) to 0-4095 = 0x7F. | 417 __ usat(r2, 12, Operand(r0, ASR, 9)); // Sat (0xFFFF>>9) to 0-4095 = 0x7F. |
| 405 __ usat(r3, 1, Operand(r0, LSL, 16)); // Sat (0xFFFF<<16) to 0-1 = 0x0. | 418 __ usat(r3, 1, Operand(r0, LSL, 16)); // Sat (0xFFFF<<16) to 0-1 = 0x0. |
| 406 __ add(r0, r1, Operand(r2)); | 419 __ add(r0, r1, Operand(r2)); |
| 407 __ add(r0, r0, Operand(r3)); | 420 __ add(r0, r0, Operand(r3)); |
| 408 __ mov(pc, Operand(lr)); | 421 __ mov(pc, Operand(lr)); |
| 409 | 422 |
| 410 CodeDesc desc; | 423 CodeDesc desc; |
| 411 assm.GetCode(&desc); | 424 assm.GetCode(&desc); |
| 412 Object* code = HEAP->CreateCode( | 425 Object* code = isolate->heap()->CreateCode( |
| 413 desc, | 426 desc, |
| 414 Code::ComputeFlags(Code::STUB), | 427 Code::ComputeFlags(Code::STUB), |
| 415 Handle<Object>(HEAP->undefined_value()))->ToObjectChecked(); | 428 Handle<Object>(isolate->heap()->undefined_value(), |
| 429 isolate))->ToObjectChecked(); | |
| 416 CHECK(code->IsCode()); | 430 CHECK(code->IsCode()); |
| 417 #ifdef DEBUG | 431 #ifdef DEBUG |
| 418 Code::cast(code)->Print(); | 432 Code::cast(code)->Print(); |
| 419 #endif | 433 #endif |
| 420 F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry()); | 434 F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry()); |
| 421 int res = reinterpret_cast<int>( | 435 int res = reinterpret_cast<int>( |
| 422 CALL_GENERATED_CODE(f, 0xFFFF, 0, 0, 0, 0)); | 436 CALL_GENERATED_CODE(f, 0xFFFF, 0, 0, 0, 0)); |
| 423 ::printf("f() = %d\n", res); | 437 ::printf("f() = %d\n", res); |
| 424 CHECK_EQ(382, res); | 438 CHECK_EQ(382, res); |
| 425 } | 439 } |
| 426 } | 440 } |
| 427 | 441 |
| 428 | 442 |
| 429 enum VCVTTypes { | 443 enum VCVTTypes { |
| 430 s32_f64, | 444 s32_f64, |
| 431 u32_f64 | 445 u32_f64 |
| 432 }; | 446 }; |
| 433 | 447 |
| 434 static void TestRoundingMode(VCVTTypes types, | 448 static void TestRoundingMode(VCVTTypes types, |
| 435 VFPRoundingMode mode, | 449 VFPRoundingMode mode, |
| 436 double value, | 450 double value, |
| 437 int expected, | 451 int expected, |
| 438 bool expected_exception = false) { | 452 bool expected_exception = false) { |
| 439 InitializeVM(); | 453 InitializeVM(); |
| 440 v8::HandleScope scope; | 454 v8::HandleScope scope; |
| 441 | 455 |
| 442 Assembler assm(Isolate::Current(), NULL, 0); | 456 Isolate* isolate = Isolate::Current(); |
| 457 Assembler assm(isolate, NULL, 0); | |
| 443 | 458 |
| 444 if (CpuFeatures::IsSupported(VFP3)) { | 459 if (CpuFeatures::IsSupported(VFP3)) { |
| 445 CpuFeatures::Scope scope(VFP3); | 460 CpuFeatures::Scope scope(VFP3); |
| 446 | 461 |
| 447 Label wrong_exception; | 462 Label wrong_exception; |
| 448 | 463 |
| 449 __ vmrs(r1); | 464 __ vmrs(r1); |
| 450 // Set custom FPSCR. | 465 // Set custom FPSCR. |
| 451 __ bic(r2, r1, Operand(kVFPRoundingModeMask | kVFPExceptionMask)); | 466 __ bic(r2, r1, Operand(kVFPRoundingModeMask | kVFPExceptionMask)); |
| 452 __ orr(r2, r2, Operand(mode)); | 467 __ orr(r2, r2, Operand(mode)); |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 478 __ mov(pc, Operand(lr)); | 493 __ mov(pc, Operand(lr)); |
| 479 | 494 |
| 480 // The exception behaviour is not what we expected. | 495 // The exception behaviour is not what we expected. |
| 481 // Load a special value and return. | 496 // Load a special value and return. |
| 482 __ bind(&wrong_exception); | 497 __ bind(&wrong_exception); |
| 483 __ mov(r0, Operand(11223344)); | 498 __ mov(r0, Operand(11223344)); |
| 484 __ mov(pc, Operand(lr)); | 499 __ mov(pc, Operand(lr)); |
| 485 | 500 |
| 486 CodeDesc desc; | 501 CodeDesc desc; |
| 487 assm.GetCode(&desc); | 502 assm.GetCode(&desc); |
| 488 Object* code = HEAP->CreateCode( | 503 Object* code = isolate->heap()->CreateCode( |
| 489 desc, | 504 desc, |
| 490 Code::ComputeFlags(Code::STUB), | 505 Code::ComputeFlags(Code::STUB), |
| 491 Handle<Object>(HEAP->undefined_value()))->ToObjectChecked(); | 506 Handle<Object>(isolate->heap()->undefined_value(), |
| 507 isolate))->ToObjectChecked(); | |
| 492 CHECK(code->IsCode()); | 508 CHECK(code->IsCode()); |
| 493 #ifdef DEBUG | 509 #ifdef DEBUG |
| 494 Code::cast(code)->Print(); | 510 Code::cast(code)->Print(); |
| 495 #endif | 511 #endif |
| 496 F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry()); | 512 F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry()); |
| 497 int res = reinterpret_cast<int>( | 513 int res = reinterpret_cast<int>( |
| 498 CALL_GENERATED_CODE(f, 0, 0, 0, 0, 0)); | 514 CALL_GENERATED_CODE(f, 0, 0, 0, 0, 0)); |
| 499 ::printf("res = %d\n", res); | 515 ::printf("res = %d\n", res); |
| 500 CHECK_EQ(expected, res); | 516 CHECK_EQ(expected, res); |
| 501 } | 517 } |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 635 float d; | 651 float d; |
| 636 float e; | 652 float e; |
| 637 float f; | 653 float f; |
| 638 float g; | 654 float g; |
| 639 float h; | 655 float h; |
| 640 } F; | 656 } F; |
| 641 F f; | 657 F f; |
| 642 | 658 |
| 643 // Create a function that uses vldm/vstm to move some double and | 659 // Create a function that uses vldm/vstm to move some double and |
| 644 // single precision values around in memory. | 660 // single precision values around in memory. |
| 645 Assembler assm(Isolate::Current(), NULL, 0); | 661 Isolate* isolate = Isolate::Current(); |
| 662 Assembler assm(isolate, NULL, 0); | |
| 646 | 663 |
| 647 if (CpuFeatures::IsSupported(VFP2)) { | 664 if (CpuFeatures::IsSupported(VFP2)) { |
| 648 CpuFeatures::Scope scope(VFP2); | 665 CpuFeatures::Scope scope(VFP2); |
| 649 | 666 |
| 650 __ mov(ip, Operand(sp)); | 667 __ mov(ip, Operand(sp)); |
| 651 __ stm(db_w, sp, r4.bit() | fp.bit() | lr.bit()); | 668 __ stm(db_w, sp, r4.bit() | fp.bit() | lr.bit()); |
| 652 __ sub(fp, ip, Operand(4)); | 669 __ sub(fp, ip, Operand(4)); |
| 653 | 670 |
| 654 __ add(r4, r0, Operand(OFFSET_OF(D, a))); | 671 __ add(r4, r0, Operand(OFFSET_OF(D, a))); |
| 655 __ vldm(ia_w, r4, d0, d3); | 672 __ vldm(ia_w, r4, d0, d3); |
| 656 __ vldm(ia_w, r4, d4, d7); | 673 __ vldm(ia_w, r4, d4, d7); |
| 657 | 674 |
| 658 __ add(r4, r0, Operand(OFFSET_OF(D, a))); | 675 __ add(r4, r0, Operand(OFFSET_OF(D, a))); |
| 659 __ vstm(ia_w, r4, d6, d7); | 676 __ vstm(ia_w, r4, d6, d7); |
| 660 __ vstm(ia_w, r4, d0, d5); | 677 __ vstm(ia_w, r4, d0, d5); |
| 661 | 678 |
| 662 __ add(r4, r1, Operand(OFFSET_OF(F, a))); | 679 __ add(r4, r1, Operand(OFFSET_OF(F, a))); |
| 663 __ vldm(ia_w, r4, s0, s3); | 680 __ vldm(ia_w, r4, s0, s3); |
| 664 __ vldm(ia_w, r4, s4, s7); | 681 __ vldm(ia_w, r4, s4, s7); |
| 665 | 682 |
| 666 __ add(r4, r1, Operand(OFFSET_OF(F, a))); | 683 __ add(r4, r1, Operand(OFFSET_OF(F, a))); |
| 667 __ vstm(ia_w, r4, s6, s7); | 684 __ vstm(ia_w, r4, s6, s7); |
| 668 __ vstm(ia_w, r4, s0, s5); | 685 __ vstm(ia_w, r4, s0, s5); |
| 669 | 686 |
| 670 __ ldm(ia_w, sp, r4.bit() | fp.bit() | pc.bit()); | 687 __ ldm(ia_w, sp, r4.bit() | fp.bit() | pc.bit()); |
| 671 | 688 |
| 672 CodeDesc desc; | 689 CodeDesc desc; |
| 673 assm.GetCode(&desc); | 690 assm.GetCode(&desc); |
| 674 Object* code = HEAP->CreateCode( | 691 Object* code = isolate->heap()->CreateCode( |
| 675 desc, | 692 desc, |
| 676 Code::ComputeFlags(Code::STUB), | 693 Code::ComputeFlags(Code::STUB), |
| 677 Handle<Object>(HEAP->undefined_value()))->ToObjectChecked(); | 694 Handle<Object>(isolate->heap()->undefined_value(), |
| 695 isolate))->ToObjectChecked(); | |
| 678 CHECK(code->IsCode()); | 696 CHECK(code->IsCode()); |
| 679 #ifdef DEBUG | 697 #ifdef DEBUG |
| 680 Code::cast(code)->Print(); | 698 Code::cast(code)->Print(); |
| 681 #endif | 699 #endif |
| 682 F4 fn = FUNCTION_CAST<F4>(Code::cast(code)->entry()); | 700 F4 fn = FUNCTION_CAST<F4>(Code::cast(code)->entry()); |
| 683 d.a = 1.1; | 701 d.a = 1.1; |
| 684 d.b = 2.2; | 702 d.b = 2.2; |
| 685 d.c = 3.3; | 703 d.c = 3.3; |
| 686 d.d = 4.4; | 704 d.d = 4.4; |
| 687 d.e = 5.5; | 705 d.e = 5.5; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 746 float d; | 764 float d; |
| 747 float e; | 765 float e; |
| 748 float f; | 766 float f; |
| 749 float g; | 767 float g; |
| 750 float h; | 768 float h; |
| 751 } F; | 769 } F; |
| 752 F f; | 770 F f; |
| 753 | 771 |
| 754 // Create a function that uses vldm/vstm to move some double and | 772 // Create a function that uses vldm/vstm to move some double and |
| 755 // single precision values around in memory. | 773 // single precision values around in memory. |
| 756 Assembler assm(Isolate::Current(), NULL, 0); | 774 Isolate* isolate = Isolate::Current(); |
| 775 Assembler assm(isolate, NULL, 0); | |
| 757 | 776 |
| 758 if (CpuFeatures::IsSupported(VFP2)) { | 777 if (CpuFeatures::IsSupported(VFP2)) { |
| 759 CpuFeatures::Scope scope(VFP2); | 778 CpuFeatures::Scope scope(VFP2); |
| 760 | 779 |
| 761 __ mov(ip, Operand(sp)); | 780 __ mov(ip, Operand(sp)); |
| 762 __ stm(db_w, sp, r4.bit() | fp.bit() | lr.bit()); | 781 __ stm(db_w, sp, r4.bit() | fp.bit() | lr.bit()); |
| 763 __ sub(fp, ip, Operand(4)); | 782 __ sub(fp, ip, Operand(4)); |
| 764 | 783 |
| 765 __ add(r4, r0, Operand(OFFSET_OF(D, a))); | 784 __ add(r4, r0, Operand(OFFSET_OF(D, a))); |
| 766 __ vldm(ia, r4, d0, d3); | 785 __ vldm(ia, r4, d0, d3); |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 779 | 798 |
| 780 __ add(r4, r1, Operand(OFFSET_OF(F, a))); | 799 __ add(r4, r1, Operand(OFFSET_OF(F, a))); |
| 781 __ vstm(ia, r4, s6, s7); | 800 __ vstm(ia, r4, s6, s7); |
| 782 __ add(r4, r4, Operand(2 * 4)); | 801 __ add(r4, r4, Operand(2 * 4)); |
| 783 __ vstm(ia, r4, s0, s5); | 802 __ vstm(ia, r4, s0, s5); |
| 784 | 803 |
| 785 __ ldm(ia_w, sp, r4.bit() | fp.bit() | pc.bit()); | 804 __ ldm(ia_w, sp, r4.bit() | fp.bit() | pc.bit()); |
| 786 | 805 |
| 787 CodeDesc desc; | 806 CodeDesc desc; |
| 788 assm.GetCode(&desc); | 807 assm.GetCode(&desc); |
| 789 Object* code = HEAP->CreateCode( | 808 Object* code = isolate->heap()->CreateCode( |
| 790 desc, | 809 desc, |
| 791 Code::ComputeFlags(Code::STUB), | 810 Code::ComputeFlags(Code::STUB), |
| 792 Handle<Object>(HEAP->undefined_value()))->ToObjectChecked(); | 811 Handle<Object>(isolate->heap()->undefined_value(), |
| 812 isolate))->ToObjectChecked(); | |
| 793 CHECK(code->IsCode()); | 813 CHECK(code->IsCode()); |
| 794 #ifdef DEBUG | 814 #ifdef DEBUG |
| 795 Code::cast(code)->Print(); | 815 Code::cast(code)->Print(); |
| 796 #endif | 816 #endif |
| 797 F4 fn = FUNCTION_CAST<F4>(Code::cast(code)->entry()); | 817 F4 fn = FUNCTION_CAST<F4>(Code::cast(code)->entry()); |
| 798 d.a = 1.1; | 818 d.a = 1.1; |
| 799 d.b = 2.2; | 819 d.b = 2.2; |
| 800 d.c = 3.3; | 820 d.c = 3.3; |
| 801 d.d = 4.4; | 821 d.d = 4.4; |
| 802 d.e = 5.5; | 822 d.e = 5.5; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 861 float d; | 881 float d; |
| 862 float e; | 882 float e; |
| 863 float f; | 883 float f; |
| 864 float g; | 884 float g; |
| 865 float h; | 885 float h; |
| 866 } F; | 886 } F; |
| 867 F f; | 887 F f; |
| 868 | 888 |
| 869 // Create a function that uses vldm/vstm to move some double and | 889 // Create a function that uses vldm/vstm to move some double and |
| 870 // single precision values around in memory. | 890 // single precision values around in memory. |
| 871 Assembler assm(Isolate::Current(), NULL, 0); | 891 Isolate* isolate = Isolate::Current(); |
| 892 Assembler assm(isolate, NULL, 0); | |
| 872 | 893 |
| 873 if (CpuFeatures::IsSupported(VFP2)) { | 894 if (CpuFeatures::IsSupported(VFP2)) { |
| 874 CpuFeatures::Scope scope(VFP2); | 895 CpuFeatures::Scope scope(VFP2); |
| 875 | 896 |
| 876 __ mov(ip, Operand(sp)); | 897 __ mov(ip, Operand(sp)); |
| 877 __ stm(db_w, sp, r4.bit() | fp.bit() | lr.bit()); | 898 __ stm(db_w, sp, r4.bit() | fp.bit() | lr.bit()); |
| 878 __ sub(fp, ip, Operand(4)); | 899 __ sub(fp, ip, Operand(4)); |
| 879 | 900 |
| 880 __ add(r4, r0, Operand(OFFSET_OF(D, h) + 8)); | 901 __ add(r4, r0, Operand(OFFSET_OF(D, h) + 8)); |
| 881 __ vldm(db_w, r4, d4, d7); | 902 __ vldm(db_w, r4, d4, d7); |
| 882 __ vldm(db_w, r4, d0, d3); | 903 __ vldm(db_w, r4, d0, d3); |
| 883 | 904 |
| 884 __ add(r4, r0, Operand(OFFSET_OF(D, h) + 8)); | 905 __ add(r4, r0, Operand(OFFSET_OF(D, h) + 8)); |
| 885 __ vstm(db_w, r4, d0, d5); | 906 __ vstm(db_w, r4, d0, d5); |
| 886 __ vstm(db_w, r4, d6, d7); | 907 __ vstm(db_w, r4, d6, d7); |
| 887 | 908 |
| 888 __ add(r4, r1, Operand(OFFSET_OF(F, h) + 4)); | 909 __ add(r4, r1, Operand(OFFSET_OF(F, h) + 4)); |
| 889 __ vldm(db_w, r4, s4, s7); | 910 __ vldm(db_w, r4, s4, s7); |
| 890 __ vldm(db_w, r4, s0, s3); | 911 __ vldm(db_w, r4, s0, s3); |
| 891 | 912 |
| 892 __ add(r4, r1, Operand(OFFSET_OF(F, h) + 4)); | 913 __ add(r4, r1, Operand(OFFSET_OF(F, h) + 4)); |
| 893 __ vstm(db_w, r4, s0, s5); | 914 __ vstm(db_w, r4, s0, s5); |
| 894 __ vstm(db_w, r4, s6, s7); | 915 __ vstm(db_w, r4, s6, s7); |
| 895 | 916 |
| 896 __ ldm(ia_w, sp, r4.bit() | fp.bit() | pc.bit()); | 917 __ ldm(ia_w, sp, r4.bit() | fp.bit() | pc.bit()); |
| 897 | 918 |
| 898 CodeDesc desc; | 919 CodeDesc desc; |
| 899 assm.GetCode(&desc); | 920 assm.GetCode(&desc); |
| 900 Object* code = HEAP->CreateCode( | 921 Object* code = isolate->heap()->CreateCode( |
| 901 desc, | 922 desc, |
| 902 Code::ComputeFlags(Code::STUB), | 923 Code::ComputeFlags(Code::STUB), |
| 903 Handle<Object>(HEAP->undefined_value()))->ToObjectChecked(); | 924 Handle<Object>(isolate->heap()->undefined_value(), |
| 925 isolate))->ToObjectChecked(); | |
| 904 CHECK(code->IsCode()); | 926 CHECK(code->IsCode()); |
| 905 #ifdef DEBUG | 927 #ifdef DEBUG |
| 906 Code::cast(code)->Print(); | 928 Code::cast(code)->Print(); |
| 907 #endif | 929 #endif |
| 908 F4 fn = FUNCTION_CAST<F4>(Code::cast(code)->entry()); | 930 F4 fn = FUNCTION_CAST<F4>(Code::cast(code)->entry()); |
| 909 d.a = 1.1; | 931 d.a = 1.1; |
| 910 d.b = 2.2; | 932 d.b = 2.2; |
| 911 d.c = 3.3; | 933 d.c = 3.3; |
| 912 d.d = 4.4; | 934 d.d = 4.4; |
| 913 d.e = 5.5; | 935 d.e = 5.5; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 957 int32_t a; | 979 int32_t a; |
| 958 int32_t b; | 980 int32_t b; |
| 959 int32_t c; | 981 int32_t c; |
| 960 int32_t d; | 982 int32_t d; |
| 961 } I; | 983 } I; |
| 962 I i; | 984 I i; |
| 963 | 985 |
| 964 i.a = 0xabcd0001; | 986 i.a = 0xabcd0001; |
| 965 i.b = 0xabcd0000; | 987 i.b = 0xabcd0000; |
| 966 | 988 |
| 967 Assembler assm(Isolate::Current(), NULL, 0); | 989 Isolate* isolate = Isolate::Current(); |
| 990 Assembler assm(isolate, NULL, 0); | |
| 968 | 991 |
| 969 // Test HeapObject untagging. | 992 // Test HeapObject untagging. |
| 970 __ ldr(r1, MemOperand(r0, OFFSET_OF(I, a))); | 993 __ ldr(r1, MemOperand(r0, OFFSET_OF(I, a))); |
| 971 __ mov(r1, Operand(r1, ASR, 1), SetCC); | 994 __ mov(r1, Operand(r1, ASR, 1), SetCC); |
| 972 __ adc(r1, r1, Operand(r1), LeaveCC, cs); | 995 __ adc(r1, r1, Operand(r1), LeaveCC, cs); |
| 973 __ str(r1, MemOperand(r0, OFFSET_OF(I, a))); | 996 __ str(r1, MemOperand(r0, OFFSET_OF(I, a))); |
| 974 | 997 |
| 975 __ ldr(r2, MemOperand(r0, OFFSET_OF(I, b))); | 998 __ ldr(r2, MemOperand(r0, OFFSET_OF(I, b))); |
| 976 __ mov(r2, Operand(r2, ASR, 1), SetCC); | 999 __ mov(r2, Operand(r2, ASR, 1), SetCC); |
| 977 __ adc(r2, r2, Operand(r2), LeaveCC, cs); | 1000 __ adc(r2, r2, Operand(r2), LeaveCC, cs); |
| 978 __ str(r2, MemOperand(r0, OFFSET_OF(I, b))); | 1001 __ str(r2, MemOperand(r0, OFFSET_OF(I, b))); |
| 979 | 1002 |
| 980 // Test corner cases. | 1003 // Test corner cases. |
| 981 __ mov(r1, Operand(0xffffffff)); | 1004 __ mov(r1, Operand(0xffffffff)); |
| 982 __ mov(r2, Operand::Zero()); | 1005 __ mov(r2, Operand::Zero()); |
| 983 __ mov(r3, Operand(r1, ASR, 1), SetCC); // Set the carry. | 1006 __ mov(r3, Operand(r1, ASR, 1), SetCC); // Set the carry. |
| 984 __ adc(r3, r1, Operand(r2)); | 1007 __ adc(r3, r1, Operand(r2)); |
| 985 __ str(r3, MemOperand(r0, OFFSET_OF(I, c))); | 1008 __ str(r3, MemOperand(r0, OFFSET_OF(I, c))); |
| 986 | 1009 |
| 987 __ mov(r1, Operand(0xffffffff)); | 1010 __ mov(r1, Operand(0xffffffff)); |
| 988 __ mov(r2, Operand::Zero()); | 1011 __ mov(r2, Operand::Zero()); |
| 989 __ mov(r3, Operand(r2, ASR, 1), SetCC); // Unset the carry. | 1012 __ mov(r3, Operand(r2, ASR, 1), SetCC); // Unset the carry. |
| 990 __ adc(r3, r1, Operand(r2)); | 1013 __ adc(r3, r1, Operand(r2)); |
| 991 __ str(r3, MemOperand(r0, OFFSET_OF(I, d))); | 1014 __ str(r3, MemOperand(r0, OFFSET_OF(I, d))); |
| 992 | 1015 |
| 993 __ mov(pc, Operand(lr)); | 1016 __ mov(pc, Operand(lr)); |
| 994 | 1017 |
| 995 CodeDesc desc; | 1018 CodeDesc desc; |
| 996 assm.GetCode(&desc); | 1019 assm.GetCode(&desc); |
| 997 Object* code = HEAP->CreateCode( | 1020 Object* code = isolate->heap()->CreateCode( |
| 998 desc, | 1021 desc, |
| 999 Code::ComputeFlags(Code::STUB), | 1022 Code::ComputeFlags(Code::STUB), |
| 1000 Handle<Object>(HEAP->undefined_value()))->ToObjectChecked(); | 1023 Handle<Object>(isolate->heap()->undefined_value(), |
| 1024 isolate))->ToObjectChecked(); | |
| 1001 CHECK(code->IsCode()); | 1025 CHECK(code->IsCode()); |
| 1002 #ifdef DEBUG | 1026 #ifdef DEBUG |
| 1003 Code::cast(code)->Print(); | 1027 Code::cast(code)->Print(); |
| 1004 #endif | 1028 #endif |
| 1005 F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry()); | 1029 F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry()); |
| 1006 Object* dummy = CALL_GENERATED_CODE(f, &i, 0, 0, 0, 0); | 1030 Object* dummy = CALL_GENERATED_CODE(f, &i, 0, 0, 0, 0); |
| 1007 USE(dummy); | 1031 USE(dummy); |
| 1008 | 1032 |
| 1009 CHECK_EQ(0xabcd0001, i.a); | 1033 CHECK_EQ(0xabcd0001, i.a); |
| 1010 CHECK_EQ(static_cast<int32_t>(0xabcd0000) >> 1, i.b); | 1034 CHECK_EQ(static_cast<int32_t>(0xabcd0000) >> 1, i.b); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1044 double y; | 1068 double y; |
| 1045 double z; | 1069 double z; |
| 1046 double i; | 1070 double i; |
| 1047 double j; | 1071 double j; |
| 1048 double k; | 1072 double k; |
| 1049 } T; | 1073 } T; |
| 1050 T t; | 1074 T t; |
| 1051 | 1075 |
| 1052 // Create a function that accepts &t, and loads, manipulates, and stores | 1076 // Create a function that accepts &t, and loads, manipulates, and stores |
| 1053 // the doubles and floats. | 1077 // the doubles and floats. |
| 1054 Assembler assm(Isolate::Current(), NULL, 0); | 1078 Isolate* isolate = Isolate::Current(); |
| 1079 Assembler assm(isolate, NULL, 0); | |
| 1055 Label L, C; | 1080 Label L, C; |
| 1056 | 1081 |
| 1057 | 1082 |
| 1058 if (CpuFeatures::IsSupported(VFP3)) { | 1083 if (CpuFeatures::IsSupported(VFP3)) { |
| 1059 CpuFeatures::Scope scope(VFP3); | 1084 CpuFeatures::Scope scope(VFP3); |
| 1060 | 1085 |
| 1061 __ stm(db_w, sp, r4.bit() | lr.bit()); | 1086 __ stm(db_w, sp, r4.bit() | lr.bit()); |
| 1062 | 1087 |
| 1063 // Load a, b, c into d16, d17, d18. | 1088 // Load a, b, c into d16, d17, d18. |
| 1064 __ mov(r4, Operand(r0)); | 1089 __ mov(r4, Operand(r0)); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1108 __ mov(r2, Operand(1079146608)); | 1133 __ mov(r2, Operand(1079146608)); |
| 1109 __ vmov(d22, VmovIndexLo, r1); | 1134 __ vmov(d22, VmovIndexLo, r1); |
| 1110 __ vmov(d22, VmovIndexHi, r2); | 1135 __ vmov(d22, VmovIndexHi, r2); |
| 1111 __ add(r4, r0, Operand(OFFSET_OF(T, i))); | 1136 __ add(r4, r0, Operand(OFFSET_OF(T, i))); |
| 1112 __ vstm(ia_w, r4, d20, d22); | 1137 __ vstm(ia_w, r4, d20, d22); |
| 1113 | 1138 |
| 1114 __ ldm(ia_w, sp, r4.bit() | pc.bit()); | 1139 __ ldm(ia_w, sp, r4.bit() | pc.bit()); |
| 1115 | 1140 |
| 1116 CodeDesc desc; | 1141 CodeDesc desc; |
| 1117 assm.GetCode(&desc); | 1142 assm.GetCode(&desc); |
| 1118 Object* code = HEAP->CreateCode( | 1143 Object* code = isolate->heap()->CreateCode( |
| 1119 desc, | 1144 desc, |
| 1120 Code::ComputeFlags(Code::STUB), | 1145 Code::ComputeFlags(Code::STUB), |
| 1121 Handle<Object>(HEAP->undefined_value()))->ToObjectChecked(); | 1146 Handle<Object>(isolate->heap()->undefined_value(), |
| 1147 isolate))->ToObjectChecked(); | |
| 1122 CHECK(code->IsCode()); | 1148 CHECK(code->IsCode()); |
| 1123 #ifdef DEBUG | 1149 #ifdef DEBUG |
| 1124 Code::cast(code)->Print(); | 1150 Code::cast(code)->Print(); |
| 1125 #endif | 1151 #endif |
| 1126 F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry()); | 1152 F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry()); |
| 1127 t.a = 1.5; | 1153 t.a = 1.5; |
| 1128 t.b = 2.75; | 1154 t.b = 2.75; |
| 1129 t.c = 17.17; | 1155 t.c = 17.17; |
| 1130 t.x = 1.5; | 1156 t.x = 1.5; |
| 1131 t.y = 2.75; | 1157 t.y = 2.75; |
| 1132 t.z = 17.17; | 1158 t.z = 17.17; |
| 1133 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); | 1159 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); |
| 1134 USE(dummy); | 1160 USE(dummy); |
| 1135 CHECK_EQ(14.7610017472335499, t.a); | 1161 CHECK_EQ(14.7610017472335499, t.a); |
| 1136 CHECK_EQ(3.84200491244266251, t.b); | 1162 CHECK_EQ(3.84200491244266251, t.b); |
| 1137 CHECK_EQ(73.8818412254460241, t.c); | 1163 CHECK_EQ(73.8818412254460241, t.c); |
| 1138 CHECK_EQ(2.75, t.x); | 1164 CHECK_EQ(2.75, t.x); |
| 1139 CHECK_EQ(1.5, t.y); | 1165 CHECK_EQ(1.5, t.y); |
| 1140 CHECK_EQ(17.0, t.z); | 1166 CHECK_EQ(17.0, t.z); |
| 1141 CHECK_EQ(14.7610017472335499, t.i); | 1167 CHECK_EQ(14.7610017472335499, t.i); |
| 1142 CHECK_EQ(16.0, t.j); | 1168 CHECK_EQ(16.0, t.j); |
| 1143 CHECK_EQ(73.8818412254460241, t.k); | 1169 CHECK_EQ(73.8818412254460241, t.k); |
| 1144 } | 1170 } |
| 1145 } | 1171 } |
| 1146 | 1172 |
| 1147 #undef __ | 1173 #undef __ |
| OLD | NEW |