| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 __ addu(v0, a0, a1); | 58 __ addu(v0, a0, a1); |
| 59 __ jr(ra); | 59 __ jr(ra); |
| 60 __ nop(); | 60 __ nop(); |
| 61 | 61 |
| 62 CodeDesc desc; | 62 CodeDesc desc; |
| 63 assm.GetCode(&desc); | 63 assm.GetCode(&desc); |
| 64 Handle<Code> code = isolate->factory()->NewCode( | 64 Handle<Code> code = isolate->factory()->NewCode( |
| 65 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 65 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 66 F2 f = FUNCTION_CAST<F2>(code->entry()); | 66 F2 f = FUNCTION_CAST<F2>(code->entry()); |
| 67 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 0xab0, 0xc, 0, 0, 0)); | 67 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 0xab0, 0xc, 0, 0, 0)); |
| 68 ::printf("f() = %d\n", res); | |
| 69 CHECK_EQ(static_cast<int32_t>(0xabc), res); | 68 CHECK_EQ(static_cast<int32_t>(0xabc), res); |
| 70 } | 69 } |
| 71 | 70 |
| 72 | 71 |
| 73 TEST(MIPS1) { | 72 TEST(MIPS1) { |
| 74 CcTest::InitializeVM(); | 73 CcTest::InitializeVM(); |
| 75 Isolate* isolate = CcTest::i_isolate(); | 74 Isolate* isolate = CcTest::i_isolate(); |
| 76 HandleScope scope(isolate); | 75 HandleScope scope(isolate); |
| 77 | 76 |
| 78 MacroAssembler assm(isolate, NULL, 0); | 77 MacroAssembler assm(isolate, NULL, 0); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 94 | 93 |
| 95 __ jr(ra); | 94 __ jr(ra); |
| 96 __ nop(); | 95 __ nop(); |
| 97 | 96 |
| 98 CodeDesc desc; | 97 CodeDesc desc; |
| 99 assm.GetCode(&desc); | 98 assm.GetCode(&desc); |
| 100 Handle<Code> code = isolate->factory()->NewCode( | 99 Handle<Code> code = isolate->factory()->NewCode( |
| 101 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 100 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 102 F1 f = FUNCTION_CAST<F1>(code->entry()); | 101 F1 f = FUNCTION_CAST<F1>(code->entry()); |
| 103 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 50, 0, 0, 0, 0)); | 102 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 50, 0, 0, 0, 0)); |
| 104 ::printf("f() = %d\n", res); | |
| 105 CHECK_EQ(1275, res); | 103 CHECK_EQ(1275, res); |
| 106 } | 104 } |
| 107 | 105 |
| 108 | 106 |
| 109 TEST(MIPS2) { | 107 TEST(MIPS2) { |
| 110 CcTest::InitializeVM(); | 108 CcTest::InitializeVM(); |
| 111 Isolate* isolate = CcTest::i_isolate(); | 109 Isolate* isolate = CcTest::i_isolate(); |
| 112 HandleScope scope(isolate); | 110 HandleScope scope(isolate); |
| 113 | 111 |
| 114 MacroAssembler assm(isolate, NULL, 0); | 112 MacroAssembler assm(isolate, NULL, 0); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 __ bind(&exit); | 230 __ bind(&exit); |
| 233 __ jr(ra); | 231 __ jr(ra); |
| 234 __ nop(); | 232 __ nop(); |
| 235 | 233 |
| 236 CodeDesc desc; | 234 CodeDesc desc; |
| 237 assm.GetCode(&desc); | 235 assm.GetCode(&desc); |
| 238 Handle<Code> code = isolate->factory()->NewCode( | 236 Handle<Code> code = isolate->factory()->NewCode( |
| 239 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 237 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 240 F2 f = FUNCTION_CAST<F2>(code->entry()); | 238 F2 f = FUNCTION_CAST<F2>(code->entry()); |
| 241 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 0xab0, 0xc, 0, 0, 0)); | 239 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 0xab0, 0xc, 0, 0, 0)); |
| 242 ::printf("f() = %d\n", res); | |
| 243 CHECK_EQ(static_cast<int32_t>(0x31415926), res); | 240 CHECK_EQ(static_cast<int32_t>(0x31415926), res); |
| 244 } | 241 } |
| 245 | 242 |
| 246 | 243 |
| 247 TEST(MIPS3) { | 244 TEST(MIPS3) { |
| 248 // Test floating point instructions. | 245 // Test floating point instructions. |
| 249 CcTest::InitializeVM(); | 246 CcTest::InitializeVM(); |
| 250 Isolate* isolate = CcTest::i_isolate(); | 247 Isolate* isolate = CcTest::i_isolate(); |
| 251 HandleScope scope(isolate); | 248 HandleScope scope(isolate); |
| 252 | 249 |
| (...skipping 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1269 Label target; | 1266 Label target; |
| 1270 __ beq(v0, v1, &target); | 1267 __ beq(v0, v1, &target); |
| 1271 __ nop(); | 1268 __ nop(); |
| 1272 __ bne(v0, v1, &target); | 1269 __ bne(v0, v1, &target); |
| 1273 __ nop(); | 1270 __ nop(); |
| 1274 __ bind(&target); | 1271 __ bind(&target); |
| 1275 __ nop(); | 1272 __ nop(); |
| 1276 } | 1273 } |
| 1277 | 1274 |
| 1278 #undef __ | 1275 #undef __ |
| OLD | NEW |