| 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 assm.GetCode(&desc); | 194 assm.GetCode(&desc); |
| 195 // Call the function from C++. | 195 // Call the function from C++. |
| 196 int result = FUNCTION_CAST<F2>(buffer)(3, 2); | 196 int result = FUNCTION_CAST<F2>(buffer)(3, 2); |
| 197 CHECK_EQ(0, result); | 197 CHECK_EQ(0, result); |
| 198 result = FUNCTION_CAST<F2>(buffer)(0x100000000l, 0x100000000l); | 198 result = FUNCTION_CAST<F2>(buffer)(0x100000000l, 0x100000000l); |
| 199 CHECK_EQ(1, result); | 199 CHECK_EQ(1, result); |
| 200 result = FUNCTION_CAST<F2>(buffer)(-0x100000000l, 0x100000000l); | 200 result = FUNCTION_CAST<F2>(buffer)(-0x100000000l, 0x100000000l); |
| 201 CHECK_EQ(-1, result); | 201 CHECK_EQ(-1, result); |
| 202 } | 202 } |
| 203 | 203 |
| 204 TEST(AssemblerX64testbwOperation) { | 204 TEST(AssemblerX64testbwqOperation) { |
| 205 CcTest::InitializeVM(); | 205 CcTest::InitializeVM(); |
| 206 v8::HandleScope scope(CcTest::isolate()); | 206 v8::HandleScope scope(CcTest::isolate()); |
| 207 // Allocate an executable page of memory. | 207 // Allocate an executable page of memory. |
| 208 size_t actual_size; | 208 size_t actual_size; |
| 209 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate( | 209 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate( |
| 210 Assembler::kMinimalBufferSize, &actual_size, true)); | 210 Assembler::kMinimalBufferSize, &actual_size, true)); |
| 211 CHECK(buffer); | 211 CHECK(buffer); |
| 212 Assembler assm(CcTest::i_isolate(), buffer, static_cast<int>(actual_size)); | 212 Assembler assm(CcTest::i_isolate(), buffer, static_cast<int>(actual_size)); |
| 213 | 213 |
| 214 __ pushq(rbx); | 214 __ pushq(rbx); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 __ j(zero, &bad); | 331 __ j(zero, &bad); |
| 332 __ testb(r12, r11); | 332 __ testb(r12, r11); |
| 333 __ j(zero, &bad); | 333 __ j(zero, &bad); |
| 334 __ testb(r11, r12); | 334 __ testb(r11, r12); |
| 335 __ j(zero, &bad); | 335 __ j(zero, &bad); |
| 336 __ testw(r12, r11); | 336 __ testw(r12, r11); |
| 337 __ j(zero, &bad); | 337 __ j(zero, &bad); |
| 338 __ testw(r11, r12); | 338 __ testw(r11, r12); |
| 339 __ j(zero, &bad); | 339 __ j(zero, &bad); |
| 340 | 340 |
| 341 // Test sign-extended imediate tests |
| 342 __ movq(r11, Immediate(2)); |
| 343 __ shlq(r11, Immediate(32)); |
| 344 __ testq(r11, Immediate(-1)); |
| 345 __ j(zero, &bad); |
| 346 |
| 341 // All tests passed | 347 // All tests passed |
| 342 __ movq(rax, Immediate(1)); | 348 __ movq(rax, Immediate(1)); |
| 343 __ jmp(&done); | 349 __ jmp(&done); |
| 344 | 350 |
| 345 __ bind(&bad); | 351 __ bind(&bad); |
| 346 __ movq(rax, Immediate(0)); | 352 __ movq(rax, Immediate(0)); |
| 347 __ bind(&done); | 353 __ bind(&done); |
| 348 | 354 |
| 349 __ popq(r15); | 355 __ popq(r15); |
| 350 __ popq(r14); | 356 __ popq(r14); |
| (...skipping 2156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2507 #ifdef OBJECT_PRINT | 2513 #ifdef OBJECT_PRINT |
| 2508 OFStream os(stdout); | 2514 OFStream os(stdout); |
| 2509 code->Print(os); | 2515 code->Print(os); |
| 2510 #endif | 2516 #endif |
| 2511 | 2517 |
| 2512 F9 f = FUNCTION_CAST<F9>(code->entry()); | 2518 F9 f = FUNCTION_CAST<F9>(code->entry()); |
| 2513 CHECK_EQ(-1.5, f(1.5, -1.5)); | 2519 CHECK_EQ(-1.5, f(1.5, -1.5)); |
| 2514 } | 2520 } |
| 2515 | 2521 |
| 2516 #undef __ | 2522 #undef __ |
| OLD | NEW |