| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/stub_code.h" | 5 #include "vm/stub_code.h" |
| 6 | 6 |
| 7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
| 8 #include "platform/globals.h" | 8 #include "platform/globals.h" |
| 9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
| 10 #include "vm/disassembler.h" | 10 #include "vm/disassembler.h" |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 StubCode::GeneratePatchableAllocateArrayStub( | 144 StubCode::GeneratePatchableAllocateArrayStub( |
| 145 &assembler, &entry_patch_offset, &patch_code_offset); | 145 &assembler, &entry_patch_offset, &patch_code_offset); |
| 146 } else { | 146 } else { |
| 147 StubCode::GenerateAllocationStubForClass( | 147 StubCode::GenerateAllocationStubForClass( |
| 148 &assembler, cls, &entry_patch_offset, &patch_code_offset); | 148 &assembler, cls, &entry_patch_offset, &patch_code_offset); |
| 149 } | 149 } |
| 150 stub ^= Code::FinalizeCode(name, &assembler); | 150 stub ^= Code::FinalizeCode(name, &assembler); |
| 151 stub.set_owner(cls); | 151 stub.set_owner(cls); |
| 152 cls.set_allocation_stub(stub); | 152 cls.set_allocation_stub(stub); |
| 153 if (FLAG_disassemble_stubs) { | 153 if (FLAG_disassemble_stubs) { |
| 154 LogBlock lb(Isolate::Current()); |
| 154 ISL_Print("Code for allocation stub '%s': {\n", name); | 155 ISL_Print("Code for allocation stub '%s': {\n", name); |
| 155 DisassembleToStdout formatter; | 156 DisassembleToStdout formatter; |
| 156 stub.Disassemble(&formatter); | 157 stub.Disassemble(&formatter); |
| 157 ISL_Print("}\n"); | 158 ISL_Print("}\n"); |
| 158 } | 159 } |
| 159 stub.set_entry_patch_pc_offset(entry_patch_offset); | 160 stub.set_entry_patch_pc_offset(entry_patch_offset); |
| 160 stub.set_patch_code_pc_offset(patch_code_offset); | 161 stub.set_patch_code_pc_offset(patch_code_offset); |
| 161 } | 162 } |
| 162 return stub.raw(); | 163 return stub.raw(); |
| 163 } | 164 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 177 } | 178 } |
| 178 } | 179 } |
| 179 | 180 |
| 180 | 181 |
| 181 RawCode* StubCode::Generate(const char* name, | 182 RawCode* StubCode::Generate(const char* name, |
| 182 void (*GenerateStub)(Assembler* assembler)) { | 183 void (*GenerateStub)(Assembler* assembler)) { |
| 183 Assembler assembler; | 184 Assembler assembler; |
| 184 GenerateStub(&assembler); | 185 GenerateStub(&assembler); |
| 185 const Code& code = Code::Handle(Code::FinalizeCode(name, &assembler)); | 186 const Code& code = Code::Handle(Code::FinalizeCode(name, &assembler)); |
| 186 if (FLAG_disassemble_stubs) { | 187 if (FLAG_disassemble_stubs) { |
| 188 LogBlock lb(Isolate::Current()); |
| 187 ISL_Print("Code for stub '%s': {\n", name); | 189 ISL_Print("Code for stub '%s': {\n", name); |
| 188 DisassembleToStdout formatter; | 190 DisassembleToStdout formatter; |
| 189 code.Disassemble(&formatter); | 191 code.Disassemble(&formatter); |
| 190 ISL_Print("}\n"); | 192 ISL_Print("}\n"); |
| 191 } | 193 } |
| 192 return code.raw(); | 194 return code.raw(); |
| 193 } | 195 } |
| 194 | 196 |
| 195 | 197 |
| 196 const char* StubCode::NameOfStub(uword entry_point) { | 198 const char* StubCode::NameOfStub(uword entry_point) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 208 Isolate* isolate = Isolate::Current(); | 210 Isolate* isolate = Isolate::Current(); |
| 209 if ((isolate != NULL) && (isolate->stub_code() != NULL)) { | 211 if ((isolate != NULL) && (isolate->stub_code() != NULL)) { |
| 210 STUB_CODE_LIST(STUB_CODE_TESTER); | 212 STUB_CODE_LIST(STUB_CODE_TESTER); |
| 211 } | 213 } |
| 212 #undef VM_STUB_CODE_TESTER | 214 #undef VM_STUB_CODE_TESTER |
| 213 #undef STUB_CODE_TESTER | 215 #undef STUB_CODE_TESTER |
| 214 return NULL; | 216 return NULL; |
| 215 } | 217 } |
| 216 | 218 |
| 217 } // namespace dart | 219 } // namespace dart |
| OLD | NEW |