OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 | 166 |
167 CodeDesc desc; | 167 CodeDesc desc; |
168 assm.GetCode(&desc); | 168 assm.GetCode(&desc); |
169 // Call the function from C++. | 169 // Call the function from C++. |
170 int result = FUNCTION_CAST<F2>(buffer)(0x1002, 0x2002); | 170 int result = FUNCTION_CAST<F2>(buffer)(0x1002, 0x2002); |
171 CHECK_EQ(1, result); | 171 CHECK_EQ(1, result); |
172 result = FUNCTION_CAST<F2>(buffer)(0x1002, 0x2003); | 172 result = FUNCTION_CAST<F2>(buffer)(0x1002, 0x2003); |
173 CHECK_EQ(0, result); | 173 CHECK_EQ(0, result); |
174 } | 174 } |
175 | 175 |
| 176 TEST(Regression684407) { |
| 177 CcTest::InitializeVM(); |
| 178 // Allocate an executable page of memory. |
| 179 size_t actual_size; |
| 180 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate( |
| 181 Assembler::kMinimalBufferSize, &actual_size, true)); |
| 182 CHECK(buffer); |
| 183 Assembler assm(CcTest::i_isolate(), buffer, static_cast<int>(actual_size)); |
| 184 Address before = assm.pc(); |
| 185 __ cmpl(Operand(arg1, 0), |
| 186 Immediate(0, RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); |
| 187 Address after = assm.pc(); |
| 188 size_t instruction_size = static_cast<size_t>(after - before); |
| 189 // Check that the immediate is not encoded as uint8. |
| 190 CHECK_LT(sizeof(uint32_t), instruction_size); |
| 191 } |
176 | 192 |
177 TEST(AssemblerX64ImulOperation) { | 193 TEST(AssemblerX64ImulOperation) { |
178 CcTest::InitializeVM(); | 194 CcTest::InitializeVM(); |
179 // Allocate an executable page of memory. | 195 // Allocate an executable page of memory. |
180 size_t actual_size; | 196 size_t actual_size; |
181 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate( | 197 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate( |
182 Assembler::kMinimalBufferSize, &actual_size, true)); | 198 Assembler::kMinimalBufferSize, &actual_size, true)); |
183 CHECK(buffer); | 199 CHECK(buffer); |
184 Assembler assm(CcTest::i_isolate(), buffer, static_cast<int>(actual_size)); | 200 Assembler assm(CcTest::i_isolate(), buffer, static_cast<int>(actual_size)); |
185 | 201 |
(...skipping 2327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2513 #ifdef OBJECT_PRINT | 2529 #ifdef OBJECT_PRINT |
2514 OFStream os(stdout); | 2530 OFStream os(stdout); |
2515 code->Print(os); | 2531 code->Print(os); |
2516 #endif | 2532 #endif |
2517 | 2533 |
2518 F9 f = FUNCTION_CAST<F9>(code->entry()); | 2534 F9 f = FUNCTION_CAST<F9>(code->entry()); |
2519 CHECK_EQ(-1.5, f(1.5, -1.5)); | 2535 CHECK_EQ(-1.5, f(1.5, -1.5)); |
2520 } | 2536 } |
2521 | 2537 |
2522 #undef __ | 2538 #undef __ |
OLD | NEW |