| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 InitializeVM(); | 65 InitializeVM(); |
| 66 v8::HandleScope scope; | 66 v8::HandleScope scope; |
| 67 | 67 |
| 68 Assembler assm(NULL, 0); | 68 Assembler assm(NULL, 0); |
| 69 | 69 |
| 70 __ add(r0, r0, Operand(r1)); | 70 __ add(r0, r0, Operand(r1)); |
| 71 __ mov(pc, Operand(lr)); | 71 __ mov(pc, Operand(lr)); |
| 72 | 72 |
| 73 CodeDesc desc; | 73 CodeDesc desc; |
| 74 assm.GetCode(&desc); | 74 assm.GetCode(&desc); |
| 75 Object* code = Heap::CreateCode(desc, NULL, Code::ComputeFlags(Code::STUB)); | 75 Object* code = Heap::CreateCode(desc, |
| 76 NULL, |
| 77 Code::ComputeFlags(Code::STUB), |
| 78 Handle<Object>(Heap::undefined_value())); |
| 76 CHECK(code->IsCode()); | 79 CHECK(code->IsCode()); |
| 77 #ifdef DEBUG | 80 #ifdef DEBUG |
| 78 Code::cast(code)->Print(); | 81 Code::cast(code)->Print(); |
| 79 #endif | 82 #endif |
| 80 F2 f = FUNCTION_CAST<F2>(Code::cast(code)->entry()); | 83 F2 f = FUNCTION_CAST<F2>(Code::cast(code)->entry()); |
| 81 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 3, 4, 0, 0, 0)); | 84 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 3, 4, 0, 0, 0)); |
| 82 ::printf("f() = %d\n", res); | 85 ::printf("f() = %d\n", res); |
| 83 CHECK_EQ(7, res); | 86 CHECK_EQ(7, res); |
| 84 } | 87 } |
| 85 | 88 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 99 __ add(r0, r0, Operand(r1)); | 102 __ add(r0, r0, Operand(r1)); |
| 100 __ sub(r1, r1, Operand(1)); | 103 __ sub(r1, r1, Operand(1)); |
| 101 | 104 |
| 102 __ bind(&C); | 105 __ bind(&C); |
| 103 __ teq(r1, Operand(0)); | 106 __ teq(r1, Operand(0)); |
| 104 __ b(ne, &L); | 107 __ b(ne, &L); |
| 105 __ mov(pc, Operand(lr)); | 108 __ mov(pc, Operand(lr)); |
| 106 | 109 |
| 107 CodeDesc desc; | 110 CodeDesc desc; |
| 108 assm.GetCode(&desc); | 111 assm.GetCode(&desc); |
| 109 Object* code = Heap::CreateCode(desc, NULL, Code::ComputeFlags(Code::STUB)); | 112 Object* code = Heap::CreateCode(desc, |
| 113 NULL, |
| 114 Code::ComputeFlags(Code::STUB), |
| 115 Handle<Object>(Heap::undefined_value())); |
| 110 CHECK(code->IsCode()); | 116 CHECK(code->IsCode()); |
| 111 #ifdef DEBUG | 117 #ifdef DEBUG |
| 112 Code::cast(code)->Print(); | 118 Code::cast(code)->Print(); |
| 113 #endif | 119 #endif |
| 114 F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry()); | 120 F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry()); |
| 115 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 100, 0, 0, 0, 0)); | 121 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 100, 0, 0, 0, 0)); |
| 116 ::printf("f() = %d\n", res); | 122 ::printf("f() = %d\n", res); |
| 117 CHECK_EQ(5050, res); | 123 CHECK_EQ(5050, res); |
| 118 } | 124 } |
| 119 | 125 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 142 __ RecordComment("dead code, just testing relocations"); | 148 __ RecordComment("dead code, just testing relocations"); |
| 143 __ mov(r0, Operand(Factory::true_value())); | 149 __ mov(r0, Operand(Factory::true_value())); |
| 144 __ RecordComment("dead code, just testing immediate operands"); | 150 __ RecordComment("dead code, just testing immediate operands"); |
| 145 __ mov(r0, Operand(-1)); | 151 __ mov(r0, Operand(-1)); |
| 146 __ mov(r0, Operand(0xFF000000)); | 152 __ mov(r0, Operand(0xFF000000)); |
| 147 __ mov(r0, Operand(0xF0F0F0F0)); | 153 __ mov(r0, Operand(0xF0F0F0F0)); |
| 148 __ mov(r0, Operand(0xFFF0FFFF)); | 154 __ mov(r0, Operand(0xFFF0FFFF)); |
| 149 | 155 |
| 150 CodeDesc desc; | 156 CodeDesc desc; |
| 151 assm.GetCode(&desc); | 157 assm.GetCode(&desc); |
| 152 Object* code = Heap::CreateCode(desc, NULL, Code::ComputeFlags(Code::STUB)); | 158 Object* code = Heap::CreateCode(desc, |
| 159 NULL, |
| 160 Code::ComputeFlags(Code::STUB), |
| 161 Handle<Object>(Heap::undefined_value())); |
| 153 CHECK(code->IsCode()); | 162 CHECK(code->IsCode()); |
| 154 #ifdef DEBUG | 163 #ifdef DEBUG |
| 155 Code::cast(code)->Print(); | 164 Code::cast(code)->Print(); |
| 156 #endif | 165 #endif |
| 157 F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry()); | 166 F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry()); |
| 158 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)); |
| 159 ::printf("f() = %d\n", res); | 168 ::printf("f() = %d\n", res); |
| 160 CHECK_EQ(3628800, res); | 169 CHECK_EQ(3628800, res); |
| 161 } | 170 } |
| 162 | 171 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 187 __ mov(r2, Operand(r2, LSL, 2)); | 196 __ mov(r2, Operand(r2, LSL, 2)); |
| 188 __ strb(r2, MemOperand(r4, OFFSET_OF(T, c))); | 197 __ strb(r2, MemOperand(r4, OFFSET_OF(T, c))); |
| 189 __ ldrsh(r2, MemOperand(r4, OFFSET_OF(T, s))); | 198 __ ldrsh(r2, MemOperand(r4, OFFSET_OF(T, s))); |
| 190 __ add(r0, r2, Operand(r0)); | 199 __ add(r0, r2, Operand(r0)); |
| 191 __ mov(r2, Operand(r2, ASR, 3)); | 200 __ mov(r2, Operand(r2, ASR, 3)); |
| 192 __ strh(r2, MemOperand(r4, OFFSET_OF(T, s))); | 201 __ strh(r2, MemOperand(r4, OFFSET_OF(T, s))); |
| 193 __ ldm(ia, sp, r4.bit() | fp.bit() | sp.bit() | pc.bit()); | 202 __ ldm(ia, sp, r4.bit() | fp.bit() | sp.bit() | pc.bit()); |
| 194 | 203 |
| 195 CodeDesc desc; | 204 CodeDesc desc; |
| 196 assm.GetCode(&desc); | 205 assm.GetCode(&desc); |
| 197 Object* code = Heap::CreateCode(desc, NULL, Code::ComputeFlags(Code::STUB)); | 206 Object* code = Heap::CreateCode(desc, |
| 207 NULL, |
| 208 Code::ComputeFlags(Code::STUB), |
| 209 Handle<Object>(Heap::undefined_value())); |
| 198 CHECK(code->IsCode()); | 210 CHECK(code->IsCode()); |
| 199 #ifdef DEBUG | 211 #ifdef DEBUG |
| 200 Code::cast(code)->Print(); | 212 Code::cast(code)->Print(); |
| 201 #endif | 213 #endif |
| 202 F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry()); | 214 F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry()); |
| 203 t.i = 100000; | 215 t.i = 100000; |
| 204 t.c = 10; | 216 t.c = 10; |
| 205 t.s = 1000; | 217 t.s = 1000; |
| 206 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0)); | 218 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0)); |
| 207 ::printf("f() = %d\n", res); | 219 ::printf("f() = %d\n", res); |
| 208 CHECK_EQ(101010, res); | 220 CHECK_EQ(101010, res); |
| 209 CHECK_EQ(100000/2, t.i); | 221 CHECK_EQ(100000/2, t.i); |
| 210 CHECK_EQ(10*4, t.c); | 222 CHECK_EQ(10*4, t.c); |
| 211 CHECK_EQ(1000/8, t.s); | 223 CHECK_EQ(1000/8, t.s); |
| 212 } | 224 } |
| 213 | 225 |
| 214 | 226 |
| 215 #undef __ | 227 #undef __ |
| OLD | NEW |