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" |
(...skipping 19 matching lines...) Expand all Loading... |
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 int64_t imm = 1234567; | 33 int64_t imm = 1234567; |
34 | 34 |
35 __ movq(rax, imm, RelocInfo::WASM_MEMORY_REFERENCE); | 35 __ movq(rax, imm, RelocInfo::WASM_MEMORY_REFERENCE); |
36 __ nop(); | 36 __ nop(); |
37 __ ret(0); | 37 __ ret(0); |
38 | 38 |
39 CodeDesc desc; | 39 CodeDesc desc; |
40 assm.GetCode(&desc); | 40 assm.GetCode(isolate, &desc); |
41 Handle<Code> code = isolate->factory()->NewCode( | 41 Handle<Code> code = isolate->factory()->NewCode( |
42 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 42 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
43 USE(code); | 43 USE(code); |
44 | 44 |
45 CSignature0<int64_t> csig; | 45 CSignature0<int64_t> csig; |
46 CodeRunner<int64_t> runnable(isolate, code, &csig); | 46 CodeRunner<int64_t> runnable(isolate, code, &csig); |
47 int64_t ret_value = runnable.Call(); | 47 int64_t ret_value = runnable.Call(); |
48 CHECK_EQ(ret_value, imm); | 48 CHECK_EQ(ret_value, imm); |
49 | 49 |
50 #ifdef OBJECT_PRINT | 50 #ifdef OBJECT_PRINT |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 89 |
90 __ movl(rax, Immediate(size, RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); | 90 __ movl(rax, Immediate(size, RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); |
91 __ cmpl(rax, Immediate(size, RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); | 91 __ cmpl(rax, Immediate(size, RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); |
92 __ j(not_equal, &fail); | 92 __ j(not_equal, &fail); |
93 __ ret(0); | 93 __ ret(0); |
94 __ bind(&fail); | 94 __ bind(&fail); |
95 __ movl(rax, Immediate(0xdeadbeef)); | 95 __ movl(rax, Immediate(0xdeadbeef)); |
96 __ ret(0); | 96 __ ret(0); |
97 | 97 |
98 CodeDesc desc; | 98 CodeDesc desc; |
99 assm.GetCode(&desc); | 99 assm.GetCode(isolate, &desc); |
100 Handle<Code> code = isolate->factory()->NewCode( | 100 Handle<Code> code = isolate->factory()->NewCode( |
101 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 101 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
102 USE(code); | 102 USE(code); |
103 | 103 |
104 CSignature0<int64_t> csig; | 104 CSignature0<int64_t> csig; |
105 CodeRunner<int64_t> runnable(isolate, code, &csig); | 105 CodeRunner<int64_t> runnable(isolate, code, &csig); |
106 int64_t ret_value = runnable.Call(); | 106 int64_t ret_value = runnable.Call(); |
107 CHECK_NE(ret_value, bit_cast<uint32_t>(0xdeadbeef)); | 107 CHECK_NE(ret_value, bit_cast<uint32_t>(0xdeadbeef)); |
108 | 108 |
109 #ifdef OBJECT_PRINT | 109 #ifdef OBJECT_PRINT |
(...skipping 17 matching lines...) Expand all Loading... |
127 CHECK_NE(ret_value, bit_cast<uint32_t>(0xdeadbeef)); | 127 CHECK_NE(ret_value, bit_cast<uint32_t>(0xdeadbeef)); |
128 | 128 |
129 #ifdef OBJECT_PRINT | 129 #ifdef OBJECT_PRINT |
130 code->Print(os); | 130 code->Print(os); |
131 begin = code->instruction_start(); | 131 begin = code->instruction_start(); |
132 end = begin + code->instruction_size(); | 132 end = begin + code->instruction_size(); |
133 disasm::Disassembler::Disassemble(stdout, begin, end); | 133 disasm::Disassembler::Disassemble(stdout, begin, end); |
134 #endif | 134 #endif |
135 } | 135 } |
136 #undef __ | 136 #undef __ |
OLD | NEW |