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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 int64_t res = | 67 int64_t res = |
68 reinterpret_cast<int64_t>(CALL_GENERATED_CODE(f, 0xab0, 0xc, 0, 0, 0)); | 68 reinterpret_cast<int64_t>(CALL_GENERATED_CODE(f, 0xab0, 0xc, 0, 0, 0)); |
69 ::printf("f() = %ld\n", res); | |
70 CHECK_EQ(0xabcL, res); | 69 CHECK_EQ(0xabcL, res); |
71 } | 70 } |
72 | 71 |
73 | 72 |
74 TEST(MIPS1) { | 73 TEST(MIPS1) { |
75 CcTest::InitializeVM(); | 74 CcTest::InitializeVM(); |
76 Isolate* isolate = CcTest::i_isolate(); | 75 Isolate* isolate = CcTest::i_isolate(); |
77 HandleScope scope(isolate); | 76 HandleScope scope(isolate); |
78 | 77 |
79 MacroAssembler assm(isolate, NULL, 0); | 78 MacroAssembler assm(isolate, NULL, 0); |
(...skipping 16 matching lines...) Expand all Loading... |
96 __ jr(ra); | 95 __ jr(ra); |
97 __ nop(); | 96 __ nop(); |
98 | 97 |
99 CodeDesc desc; | 98 CodeDesc desc; |
100 assm.GetCode(&desc); | 99 assm.GetCode(&desc); |
101 Handle<Code> code = isolate->factory()->NewCode( | 100 Handle<Code> code = isolate->factory()->NewCode( |
102 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 101 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
103 F1 f = FUNCTION_CAST<F1>(code->entry()); | 102 F1 f = FUNCTION_CAST<F1>(code->entry()); |
104 int64_t res = | 103 int64_t res = |
105 reinterpret_cast<int64_t>(CALL_GENERATED_CODE(f, 50, 0, 0, 0, 0)); | 104 reinterpret_cast<int64_t>(CALL_GENERATED_CODE(f, 50, 0, 0, 0, 0)); |
106 ::printf("f() = %ld\n", res); | |
107 CHECK_EQ(1275L, res); | 105 CHECK_EQ(1275L, res); |
108 } | 106 } |
109 | 107 |
110 | 108 |
111 TEST(MIPS2) { | 109 TEST(MIPS2) { |
112 CcTest::InitializeVM(); | 110 CcTest::InitializeVM(); |
113 Isolate* isolate = CcTest::i_isolate(); | 111 Isolate* isolate = CcTest::i_isolate(); |
114 HandleScope scope(isolate); | 112 HandleScope scope(isolate); |
115 | 113 |
116 MacroAssembler assm(isolate, NULL, 0); | 114 MacroAssembler assm(isolate, NULL, 0); |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 __ jr(ra); | 241 __ jr(ra); |
244 __ nop(); | 242 __ nop(); |
245 | 243 |
246 CodeDesc desc; | 244 CodeDesc desc; |
247 assm.GetCode(&desc); | 245 assm.GetCode(&desc); |
248 Handle<Code> code = isolate->factory()->NewCode( | 246 Handle<Code> code = isolate->factory()->NewCode( |
249 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 247 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
250 F2 f = FUNCTION_CAST<F2>(code->entry()); | 248 F2 f = FUNCTION_CAST<F2>(code->entry()); |
251 int64_t res = | 249 int64_t res = |
252 reinterpret_cast<int64_t>(CALL_GENERATED_CODE(f, 0xab0, 0xc, 0, 0, 0)); | 250 reinterpret_cast<int64_t>(CALL_GENERATED_CODE(f, 0xab0, 0xc, 0, 0, 0)); |
253 ::printf("f() = %ld\n", res); | |
254 | 251 |
255 CHECK_EQ(0x31415926L, res); | 252 CHECK_EQ(0x31415926L, res); |
256 } | 253 } |
257 | 254 |
258 | 255 |
259 TEST(MIPS3) { | 256 TEST(MIPS3) { |
260 // Test floating point instructions. | 257 // Test floating point instructions. |
261 CcTest::InitializeVM(); | 258 CcTest::InitializeVM(); |
262 Isolate* isolate = CcTest::i_isolate(); | 259 Isolate* isolate = CcTest::i_isolate(); |
263 HandleScope scope(isolate); | 260 HandleScope scope(isolate); |
(...skipping 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1380 // Signed data, 32 & 64. | 1377 // Signed data, 32 & 64. |
1381 CHECK_EQ(static_cast<int64_t>(0x33333333ffffbbccL), t.r3); | 1378 CHECK_EQ(static_cast<int64_t>(0x33333333ffffbbccL), t.r3); |
1382 CHECK_EQ(static_cast<int64_t>(0xffffffff0000bbccL), t.r4); | 1379 CHECK_EQ(static_cast<int64_t>(0xffffffff0000bbccL), t.r4); |
1383 | 1380 |
1384 // Signed data, 32 & 64. | 1381 // Signed data, 32 & 64. |
1385 CHECK_EQ(static_cast<int64_t>(0x55555555ffffffccL), t.r5); | 1382 CHECK_EQ(static_cast<int64_t>(0x55555555ffffffccL), t.r5); |
1386 CHECK_EQ(static_cast<int64_t>(0x000000003333bbccL), t.r6); | 1383 CHECK_EQ(static_cast<int64_t>(0x000000003333bbccL), t.r6); |
1387 } | 1384 } |
1388 | 1385 |
1389 #undef __ | 1386 #undef __ |
OLD | NEW |