| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   70 // The AMD64 calling convention is used, with the first six arguments |   70 // The AMD64 calling convention is used, with the first six arguments | 
|   71 // in RDI, RSI, RDX, RCX, R8, and R9, and floating point arguments in |   71 // in RDI, RSI, RDX, RCX, R8, and R9, and floating point arguments in | 
|   72 // the XMM registers.  The return value is in RAX. |   72 // the XMM registers.  The return value is in RAX. | 
|   73 // This calling convention is used on Linux, with GCC, and on Mac OS, |   73 // This calling convention is used on Linux, with GCC, and on Mac OS, | 
|   74 // with GCC.  A different convention is used on 64-bit windows, |   74 // with GCC.  A different convention is used on 64-bit windows, | 
|   75 // where the first four integer arguments are passed in RCX, RDX, R8 and R9. |   75 // where the first four integer arguments are passed in RCX, RDX, R8 and R9. | 
|   76  |   76  | 
|   77 typedef int (*F0)(); |   77 typedef int (*F0)(); | 
|   78 typedef int (*F1)(int64_t x); |   78 typedef int (*F1)(int64_t x); | 
|   79 typedef int (*F2)(int64_t x, int64_t y); |   79 typedef int (*F2)(int64_t x, int64_t y); | 
 |   80 typedef int (*F3)(double x); | 
|   80  |   81  | 
|   81 #ifdef _WIN64 |   82 #ifdef _WIN64 | 
|   82 static const v8::internal::Register arg1 = rcx; |   83 static const v8::internal::Register arg1 = rcx; | 
|   83 static const v8::internal::Register arg2 = rdx; |   84 static const v8::internal::Register arg2 = rdx; | 
|   84 #else |   85 #else | 
|   85 static const v8::internal::Register arg1 = rdi; |   86 static const v8::internal::Register arg1 = rdi; | 
|   86 static const v8::internal::Register arg2 = rsi; |   87 static const v8::internal::Register arg2 = rsi; | 
|   87 #endif |   88 #endif | 
|   88  |   89  | 
|   89 #define __ assm. |   90 #define __ assm. | 
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  510   v8::Local<v8::Value> result = foo->Call(global_object, 1, args); |  511   v8::Local<v8::Value> result = foo->Call(global_object, 1, args); | 
|  511  |  512  | 
|  512   // The mask should be 0b1000. |  513   // The mask should be 0b1000. | 
|  513   CHECK_EQ(8, result->Int32Value()); |  514   CHECK_EQ(8, result->Int32Value()); | 
|  514 } |  515 } | 
|  515  |  516  | 
|  516 #undef ELEMENT_COUNT |  517 #undef ELEMENT_COUNT | 
|  517 #endif  // __GNUC__ |  518 #endif  // __GNUC__ | 
|  518  |  519  | 
|  519  |  520  | 
 |  521 TEST(AssemblerX64Extractps) { | 
 |  522   CcTest::InitializeVM(); | 
 |  523   if (!v8::internal::CpuFeatures::IsSupported(v8::internal::SSE4_1)) return; | 
 |  524  | 
 |  525   v8::HandleScope scope(CcTest::isolate()); | 
 |  526   v8::internal::byte buffer[256]; | 
 |  527   Isolate* isolate = CcTest::i_isolate(); | 
 |  528   Assembler assm(isolate, buffer, sizeof(buffer)); | 
 |  529   v8::internal::CpuFeatureScope fscope(&assm, v8::internal::SSE4_1); | 
 |  530   __ extractps(rax, xmm0, 0x1); | 
 |  531   __ ret(0); | 
 |  532  | 
 |  533   CodeDesc desc; | 
 |  534   assm.GetCode(&desc); | 
 |  535   Code* code = Code::cast(isolate->heap()->CreateCode( | 
 |  536       desc, | 
 |  537       Code::ComputeFlags(Code::STUB), | 
 |  538       v8::internal::Handle<Code>())->ToObjectChecked()); | 
 |  539   CHECK(code->IsCode()); | 
 |  540 #ifdef OBJECT_PRINT | 
 |  541   Code::cast(code)->Print(); | 
 |  542 #endif | 
 |  543  | 
 |  544   F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry()); | 
 |  545   CHECK_EQ(0x7FF80000, f(OS::nan_value())); | 
 |  546 } | 
 |  547  | 
 |  548  | 
|  520 #undef __ |  549 #undef __ | 
| OLD | NEW |