| 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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 double c; | 235 double c; |
| 236 } T; | 236 } T; |
| 237 T t; | 237 T t; |
| 238 | 238 |
| 239 // Create a function that accepts &t, and loads, manipulates, and stores | 239 // Create a function that accepts &t, and loads, manipulates, and stores |
| 240 // the doubles t.a, t.b, and t.c. | 240 // the doubles t.a, t.b, and t.c. |
| 241 Assembler assm(NULL, 0); | 241 Assembler assm(NULL, 0); |
| 242 Label L, C; | 242 Label L, C; |
| 243 | 243 |
| 244 | 244 |
| 245 ASSERT(CpuFeatures::IsSupported(VFP3)); | |
| 246 if (CpuFeatures::IsSupported(VFP3)) { | 245 if (CpuFeatures::IsSupported(VFP3)) { |
| 247 CpuFeatures::Scope scope(VFP3); | 246 CpuFeatures::Scope scope(VFP3); |
| 248 | 247 |
| 249 __ mov(ip, Operand(sp)); | 248 __ mov(ip, Operand(sp)); |
| 250 __ stm(db_w, sp, r4.bit() | fp.bit() | lr.bit()); | 249 __ stm(db_w, sp, r4.bit() | fp.bit() | lr.bit()); |
| 251 __ sub(fp, ip, Operand(4)); | 250 __ sub(fp, ip, Operand(4)); |
| 252 | 251 |
| 253 __ mov(r4, Operand(r0)); | 252 __ mov(r4, Operand(r0)); |
| 254 __ vldr(d6, r4, OFFSET_OF(T, a)); | 253 __ vldr(d6, r4, OFFSET_OF(T, a)); |
| 255 __ vldr(d7, r4, OFFSET_OF(T, b)); | 254 __ vldr(d7, r4, OFFSET_OF(T, b)); |
| 256 __ vadd(d5, d6, d7); | 255 __ vadd(d5, d6, d7); |
| 257 __ vstr(d5, r4, OFFSET_OF(T, c)); | 256 __ vstr(d5, r4, OFFSET_OF(T, c)); |
| 258 | 257 |
| 259 __ vmov(r2, r3, d5); | 258 __ vmov(r2, r3, d5); |
| 260 __ vmov(d4, r2, r3); | 259 __ vmov(d4, r2, r3); |
| 261 __ vstr(d4, r4, OFFSET_OF(T, b)); | 260 __ vstr(d4, r4, OFFSET_OF(T, b)); |
| 262 | 261 |
| 263 __ ldm(ia_w, sp, r4.bit() | fp.bit() | pc.bit()); | 262 __ ldm(ia_w, sp, r4.bit() | fp.bit() | pc.bit()); |
| 263 |
| 264 CodeDesc desc; |
| 265 assm.GetCode(&desc); |
| 266 Object* code = Heap::CreateCode(desc, |
| 267 NULL, |
| 268 Code::ComputeFlags(Code::STUB), |
| 269 Handle<Object>(Heap::undefined_value())); |
| 270 CHECK(code->IsCode()); |
| 271 #ifdef DEBUG |
| 272 Code::cast(code)->Print(); |
| 273 #endif |
| 274 F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry()); |
| 275 t.a = 1.5; |
| 276 t.b = 2.75; |
| 277 t.c = 17.17; |
| 278 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); |
| 279 USE(dummy); |
| 280 CHECK_EQ(4.25, t.c); |
| 281 CHECK_EQ(4.25, t.b); |
| 282 CHECK_EQ(1.5, t.a); |
| 264 } | 283 } |
| 265 CodeDesc desc; | |
| 266 assm.GetCode(&desc); | |
| 267 Object* code = Heap::CreateCode(desc, | |
| 268 NULL, | |
| 269 Code::ComputeFlags(Code::STUB), | |
| 270 Handle<Object>(Heap::undefined_value())); | |
| 271 CHECK(code->IsCode()); | |
| 272 #ifdef DEBUG | |
| 273 Code::cast(code)->Print(); | |
| 274 #endif | |
| 275 F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry()); | |
| 276 t.a = 1.5; | |
| 277 t.b = 2.75; | |
| 278 t.c = 17.17; | |
| 279 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); | |
| 280 USE(dummy); | |
| 281 CHECK_EQ(4.25, t.c); | |
| 282 CHECK_EQ(4.25, t.b); | |
| 283 CHECK_EQ(1.5, t.a); | |
| 284 } | 284 } |
| 285 | 285 |
| 286 #undef __ | 286 #undef __ |
| OLD | NEW |