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 28 matching lines...) Expand all Loading... |
39 | 39 |
40 using namespace v8::base; | 40 using namespace v8::base; |
41 using namespace v8::internal; | 41 using namespace v8::internal; |
42 | 42 |
43 | 43 |
44 // Define these function prototypes to match JSEntryFunction in execution.cc. | 44 // Define these function prototypes to match JSEntryFunction in execution.cc. |
45 typedef Object* (*F1)(int x, int p1, int p2, int p3, int p4); | 45 typedef Object* (*F1)(int x, int p1, int p2, int p3, int p4); |
46 typedef Object* (*F2)(int x, int y, int p2, int p3, int p4); | 46 typedef Object* (*F2)(int x, int y, int p2, int p3, int p4); |
47 typedef Object* (*F3)(void* p0, int p1, int p2, int p3, int p4); | 47 typedef Object* (*F3)(void* p0, int p1, int p2, int p3, int p4); |
48 typedef Object* (*F4)(void* p0, void* p1, int p2, int p3, int p4); | 48 typedef Object* (*F4)(void* p0, void* p1, int p2, int p3, int p4); |
49 | 49 typedef Object* (*F5)(uint32_t p0, void* p1, void* p2, int p3, int p4); |
50 | 50 |
51 #define __ assm. | 51 #define __ assm. |
52 | 52 |
53 TEST(0) { | 53 TEST(0) { |
54 CcTest::InitializeVM(); | 54 CcTest::InitializeVM(); |
55 Isolate* isolate = CcTest::i_isolate(); | 55 Isolate* isolate = CcTest::i_isolate(); |
56 HandleScope scope(isolate); | 56 HandleScope scope(isolate); |
57 | 57 |
58 Assembler assm(isolate, NULL, 0); | 58 Assembler assm(isolate, NULL, 0); |
59 | 59 |
(...skipping 1872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1932 assm.GetCode(&desc); | 1932 assm.GetCode(&desc); |
1933 Handle<Code> code = isolate->factory()->NewCode( | 1933 Handle<Code> code = isolate->factory()->NewCode( |
1934 desc, Code::ComputeFlags(Code::STUB), code_object); | 1934 desc, Code::ComputeFlags(Code::STUB), code_object); |
1935 F1 f = FUNCTION_CAST<F1>(code->entry()); | 1935 F1 f = FUNCTION_CAST<F1>(code->entry()); |
1936 int res = | 1936 int res = |
1937 reinterpret_cast<int>(CALL_GENERATED_CODE(isolate, f, 21, 0, 0, 0, 0)); | 1937 reinterpret_cast<int>(CALL_GENERATED_CODE(isolate, f, 21, 0, 0, 0, 0)); |
1938 ::printf("f() = %d\n", res); | 1938 ::printf("f() = %d\n", res); |
1939 CHECK_EQ(42, res); | 1939 CHECK_EQ(42, res); |
1940 } | 1940 } |
1941 | 1941 |
| 1942 TEST(msr_mrs) { |
| 1943 // Test msr and mrs. |
| 1944 CcTest::InitializeVM(); |
| 1945 Isolate* isolate = CcTest::i_isolate(); |
| 1946 HandleScope scope(isolate); |
| 1947 |
| 1948 Assembler assm(isolate, NULL, 0); |
| 1949 |
| 1950 // Create a helper function: |
| 1951 // void TestMsrMrs(uint32_t nzcv, |
| 1952 // uint32_t * result_conditionals, |
| 1953 // uint32_t * result_mrs); |
| 1954 __ msr(CPSR_f, Operand(r0)); |
| 1955 |
| 1956 // Test that the condition flags have taken effect. |
| 1957 __ mov(r3, Operand(0)); |
| 1958 __ orr(r3, r3, Operand(1 << 31), LeaveCC, mi); // N |
| 1959 __ orr(r3, r3, Operand(1 << 30), LeaveCC, eq); // Z |
| 1960 __ orr(r3, r3, Operand(1 << 29), LeaveCC, cs); // C |
| 1961 __ orr(r3, r3, Operand(1 << 28), LeaveCC, vs); // V |
| 1962 __ str(r3, MemOperand(r1)); |
| 1963 |
| 1964 // Also check mrs, ignoring everything other than the flags. |
| 1965 __ mrs(r3, CPSR); |
| 1966 __ and_(r3, r3, Operand(kSpecialCondition)); |
| 1967 __ str(r3, MemOperand(r2)); |
| 1968 |
| 1969 __ bx(lr); |
| 1970 |
| 1971 CodeDesc desc; |
| 1972 assm.GetCode(&desc); |
| 1973 Handle<Code> code = isolate->factory()->NewCode( |
| 1974 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 1975 #ifdef DEBUG |
| 1976 OFStream os(stdout); |
| 1977 code->Print(os); |
| 1978 #endif |
| 1979 F5 f = FUNCTION_CAST<F5>(code->entry()); |
| 1980 Object* dummy = nullptr; |
| 1981 USE(dummy); |
| 1982 |
| 1983 #define CHECK_MSR_MRS(n, z, c, v) \ |
| 1984 do { \ |
| 1985 uint32_t nzcv = (n << 31) | (z << 30) | (c << 29) | (v << 28); \ |
| 1986 uint32_t result_conditionals = -1; \ |
| 1987 uint32_t result_mrs = -1; \ |
| 1988 dummy = CALL_GENERATED_CODE(isolate, f, nzcv, &result_conditionals, \ |
| 1989 &result_mrs, 0, 0); \ |
| 1990 CHECK_EQ(nzcv, result_conditionals); \ |
| 1991 CHECK_EQ(nzcv, result_mrs); \ |
| 1992 } while (0); |
| 1993 |
| 1994 // N Z C V |
| 1995 CHECK_MSR_MRS(0, 0, 0, 0); |
| 1996 CHECK_MSR_MRS(0, 0, 0, 1); |
| 1997 CHECK_MSR_MRS(0, 0, 1, 0); |
| 1998 CHECK_MSR_MRS(0, 0, 1, 1); |
| 1999 CHECK_MSR_MRS(0, 1, 0, 0); |
| 2000 CHECK_MSR_MRS(0, 1, 0, 1); |
| 2001 CHECK_MSR_MRS(0, 1, 1, 0); |
| 2002 CHECK_MSR_MRS(0, 1, 1, 1); |
| 2003 CHECK_MSR_MRS(1, 0, 0, 0); |
| 2004 CHECK_MSR_MRS(1, 0, 0, 1); |
| 2005 CHECK_MSR_MRS(1, 0, 1, 0); |
| 2006 CHECK_MSR_MRS(1, 0, 1, 1); |
| 2007 CHECK_MSR_MRS(1, 1, 0, 0); |
| 2008 CHECK_MSR_MRS(1, 1, 0, 1); |
| 2009 CHECK_MSR_MRS(1, 1, 1, 0); |
| 2010 CHECK_MSR_MRS(1, 1, 1, 1); |
| 2011 |
| 2012 #undef CHECK_MSR_MRS |
| 2013 } |
1942 | 2014 |
1943 TEST(ARMv8_float32_vrintX) { | 2015 TEST(ARMv8_float32_vrintX) { |
1944 // Test the vrintX floating point instructions. | 2016 // Test the vrintX floating point instructions. |
1945 CcTest::InitializeVM(); | 2017 CcTest::InitializeVM(); |
1946 Isolate* isolate = CcTest::i_isolate(); | 2018 Isolate* isolate = CcTest::i_isolate(); |
1947 HandleScope scope(isolate); | 2019 HandleScope scope(isolate); |
1948 | 2020 |
1949 typedef struct { | 2021 typedef struct { |
1950 float input; | 2022 float input; |
1951 float ar; | 2023 float ar; |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2201 HandleScope scope(isolate); | 2273 HandleScope scope(isolate); |
2202 | 2274 |
2203 Assembler assm(isolate, NULL, 0); | 2275 Assembler assm(isolate, NULL, 0); |
2204 __ mov(r0, Operand(isolate->factory()->infinity_value())); | 2276 __ mov(r0, Operand(isolate->factory()->infinity_value())); |
2205 __ BlockConstPoolFor(1019); | 2277 __ BlockConstPoolFor(1019); |
2206 for (int i = 0; i < 1019; ++i) __ nop(); | 2278 for (int i = 0; i < 1019; ++i) __ nop(); |
2207 __ vldr(d0, MemOperand(r0, 0)); | 2279 __ vldr(d0, MemOperand(r0, 0)); |
2208 } | 2280 } |
2209 | 2281 |
2210 #undef __ | 2282 #undef __ |
OLD | NEW |