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 21 matching lines...) Expand all Loading... |
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); |
39 | 39 |
40 CSignature0<int32_t> csig; | 40 CSignature0<int32_t> csig; |
41 CodeDesc desc; | 41 CodeDesc desc; |
42 assm.GetCode(&desc); | 42 assm.GetCode(isolate, &desc); |
43 Handle<Code> code = isolate->factory()->NewCode( | 43 Handle<Code> code = isolate->factory()->NewCode( |
44 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 44 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
45 USE(code); | 45 USE(code); |
46 | 46 |
47 CodeRunner<int32_t> runnable(isolate, code, &csig); | 47 CodeRunner<int32_t> runnable(isolate, code, &csig); |
48 int32_t ret_value = runnable.Call(); | 48 int32_t ret_value = runnable.Call(); |
49 CHECK_EQ(ret_value, imm); | 49 CHECK_EQ(ret_value, imm); |
50 | 50 |
51 #ifdef OBJECT_PRINT | 51 #ifdef OBJECT_PRINT |
52 OFStream os(stdout); | 52 OFStream os(stdout); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 __ cmp(eax, Immediate(reinterpret_cast<Address>(size), | 95 __ cmp(eax, Immediate(reinterpret_cast<Address>(size), |
96 RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); | 96 RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); |
97 __ j(not_equal, &fail); | 97 __ j(not_equal, &fail); |
98 __ ret(0); | 98 __ ret(0); |
99 __ bind(&fail); | 99 __ bind(&fail); |
100 __ mov(eax, 0xdeadbeef); | 100 __ mov(eax, 0xdeadbeef); |
101 __ ret(0); | 101 __ ret(0); |
102 | 102 |
103 CSignature0<int32_t> csig; | 103 CSignature0<int32_t> csig; |
104 CodeDesc desc; | 104 CodeDesc desc; |
105 assm.GetCode(&desc); | 105 assm.GetCode(isolate, &desc); |
106 Handle<Code> code = isolate->factory()->NewCode( | 106 Handle<Code> code = isolate->factory()->NewCode( |
107 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 107 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
108 USE(code); | 108 USE(code); |
109 | 109 |
110 CodeRunner<int32_t> runnable(isolate, code, &csig); | 110 CodeRunner<int32_t> runnable(isolate, code, &csig); |
111 int32_t ret_value = runnable.Call(); | 111 int32_t ret_value = runnable.Call(); |
112 CHECK_NE(ret_value, bit_cast<int32_t>(0xdeadbeef)); | 112 CHECK_NE(ret_value, bit_cast<int32_t>(0xdeadbeef)); |
113 | 113 |
114 #ifdef OBJECT_PRINT | 114 #ifdef OBJECT_PRINT |
115 OFStream os(stdout); | 115 OFStream os(stdout); |
(...skipping 17 matching lines...) Expand all Loading... |
133 CHECK_NE(ret_value, bit_cast<int32_t>(0xdeadbeef)); | 133 CHECK_NE(ret_value, bit_cast<int32_t>(0xdeadbeef)); |
134 | 134 |
135 #ifdef OBJECT_PRINT | 135 #ifdef OBJECT_PRINT |
136 code->Print(os); | 136 code->Print(os); |
137 begin = code->instruction_start(); | 137 begin = code->instruction_start(); |
138 end = begin + code->instruction_size(); | 138 end = begin + code->instruction_size(); |
139 disasm::Disassembler::Disassemble(stdout, begin, end); | 139 disasm::Disassembler::Disassemble(stdout, begin, end); |
140 #endif | 140 #endif |
141 } | 141 } |
142 #undef __ | 142 #undef __ |
OLD | NEW |