OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <stdlib.h> | 5 #include <stdlib.h> |
6 | 6 |
7 #include "src/v8.h" | 7 #include "src/v8.h" |
8 | 8 |
9 #include "src/debug/debug.h" | 9 #include "src/debug/debug.h" |
10 #include "src/disasm.h" | 10 #include "src/disasm.h" |
11 #include "src/disassembler.h" | 11 #include "src/disassembler.h" |
12 #include "src/ic/ic.h" | 12 #include "src/ic/ic.h" |
13 #include "src/macro-assembler.h" | 13 #include "src/macro-assembler.h" |
14 #include "src/x87/frames-x87.h" | 14 #include "src/x87/frames-x87.h" |
15 #include "test/cctest/cctest.h" | 15 #include "test/cctest/cctest.h" |
16 #include "test/cctest/compiler/c-signature.h" | 16 #include "test/cctest/compiler/c-signature.h" |
17 #include "test/cctest/compiler/call-tester.h" | 17 #include "test/cctest/compiler/call-tester.h" |
18 | 18 |
19 using namespace v8::internal; | 19 using namespace v8::internal; |
20 using namespace v8::internal::compiler; | 20 using namespace v8::internal::compiler; |
21 | 21 |
22 #define __ assm. | 22 #define __ assm. |
23 | 23 |
24 static int32_t DummyStaticFunction(Object* result) { return 1; } | 24 static int32_t DummyStaticFunction(Object* result) { return 1; } |
25 | 25 |
26 TEST(WasmRelocationX87MemoryReference) { | 26 TEST(WasmRelocationX87MemoryReference) { |
27 Isolate* isolate = CcTest::i_isolate(); | 27 Isolate* isolate = CcTest::i_isolate(); |
28 Zone zone(isolate->allocator()); | 28 Zone zone(isolate->allocator(), ZONE_NAME); |
29 HandleScope scope(isolate); | 29 HandleScope scope(isolate); |
30 v8::internal::byte buffer[4096]; | 30 v8::internal::byte buffer[4096]; |
31 Assembler assm(isolate, buffer, sizeof buffer); | 31 Assembler assm(isolate, buffer, sizeof buffer); |
32 DummyStaticFunction(NULL); | 32 DummyStaticFunction(NULL); |
33 int32_t imm = 1234567; | 33 int32_t imm = 1234567; |
34 | 34 |
35 __ mov(eax, Immediate(reinterpret_cast<Address>(imm), | 35 __ mov(eax, Immediate(reinterpret_cast<Address>(imm), |
36 RelocInfo::WASM_MEMORY_REFERENCE)); | 36 RelocInfo::WASM_MEMORY_REFERENCE)); |
37 __ nop(); | 37 __ nop(); |
38 __ ret(0); | 38 __ ret(0); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 code->Print(os); | 80 code->Print(os); |
81 begin = code->instruction_start(); | 81 begin = code->instruction_start(); |
82 end = begin + code->instruction_size(); | 82 end = begin + code->instruction_size(); |
83 disasm::Disassembler::Disassemble(stdout, begin, end); | 83 disasm::Disassembler::Disassemble(stdout, begin, end); |
84 #endif | 84 #endif |
85 } | 85 } |
86 | 86 |
87 TEST(WasmRelocationX87MemorySizeReference) { | 87 TEST(WasmRelocationX87MemorySizeReference) { |
88 CcTest::InitializeVM(); | 88 CcTest::InitializeVM(); |
89 Isolate* isolate = CcTest::i_isolate(); | 89 Isolate* isolate = CcTest::i_isolate(); |
90 Zone zone(isolate->allocator()); | 90 Zone zone(isolate->allocator(), ZONE_NAME); |
91 HandleScope scope(isolate); | 91 HandleScope scope(isolate); |
92 v8::internal::byte buffer[4096]; | 92 v8::internal::byte buffer[4096]; |
93 Assembler assm(isolate, buffer, sizeof buffer); | 93 Assembler assm(isolate, buffer, sizeof buffer); |
94 DummyStaticFunction(NULL); | 94 DummyStaticFunction(NULL); |
95 int32_t size = 80; | 95 int32_t size = 80; |
96 Label fail; | 96 Label fail; |
97 | 97 |
98 __ mov(eax, Immediate(reinterpret_cast<Address>(size), | 98 __ mov(eax, Immediate(reinterpret_cast<Address>(size), |
99 RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); | 99 RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); |
100 __ cmp(eax, Immediate(reinterpret_cast<Address>(size), | 100 __ cmp(eax, Immediate(reinterpret_cast<Address>(size), |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 CHECK_NE(ret_value, 0xdeadbeef); | 141 CHECK_NE(ret_value, 0xdeadbeef); |
142 | 142 |
143 #ifdef OBJECT_PRINT | 143 #ifdef OBJECT_PRINT |
144 code->Print(os); | 144 code->Print(os); |
145 begin = code->instruction_start(); | 145 begin = code->instruction_start(); |
146 end = begin + code->instruction_size(); | 146 end = begin + code->instruction_size(); |
147 disasm::Disassembler::Disassemble(stdout, begin, end); | 147 disasm::Disassembler::Disassemble(stdout, begin, end); |
148 #endif | 148 #endif |
149 } | 149 } |
150 #undef __ | 150 #undef __ |
OLD | NEW |