Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(193)

Side by Side Diff: runtime/vm/stub_code.cc

Issue 1192103004: VM: New calling convention for generated code. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: preserve CODE_REG in ARM Integer_shl intrinsic. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 Isolate* isolate = Isolate::Current(); 78 Isolate* isolate = Isolate::Current();
79 const Error& error = Error::Handle(isolate, cls.EnsureIsFinalized(isolate)); 79 const Error& error = Error::Handle(isolate, cls.EnsureIsFinalized(isolate));
80 ASSERT(error.IsNull()); 80 ASSERT(error.IsNull());
81 if (cls.id() == kArrayCid) { 81 if (cls.id() == kArrayCid) {
82 return AllocateArray_entry()->code(); 82 return AllocateArray_entry()->code();
83 } 83 }
84 Code& stub = Code::Handle(isolate, cls.allocation_stub()); 84 Code& stub = Code::Handle(isolate, cls.allocation_stub());
85 if (stub.IsNull()) { 85 if (stub.IsNull()) {
86 Assembler assembler; 86 Assembler assembler;
87 const char* name = cls.ToCString(); 87 const char* name = cls.ToCString();
88 uword patch_code_offset = 0; 88 StubCode::GenerateAllocationStubForClass(&assembler, cls);
89 uword entry_patch_offset = 0;
90 StubCode::GenerateAllocationStubForClass(
91 &assembler, cls, &entry_patch_offset, &patch_code_offset);
92 stub ^= Code::FinalizeCode(name, &assembler); 89 stub ^= Code::FinalizeCode(name, &assembler);
93 stub.set_owner(cls); 90 stub.set_owner(cls);
94 cls.set_allocation_stub(stub); 91 cls.set_allocation_stub(stub);
95 if (FLAG_disassemble_stubs) { 92 if (FLAG_disassemble_stubs) {
96 LogBlock lb; 93 LogBlock lb;
97 THR_Print("Code for allocation stub '%s': {\n", name); 94 THR_Print("Code for allocation stub '%s': {\n", name);
98 DisassembleToStdout formatter; 95 DisassembleToStdout formatter;
99 stub.Disassemble(&formatter); 96 stub.Disassemble(&formatter);
100 THR_Print("}\n"); 97 THR_Print("}\n");
101 const ObjectPool& object_pool = ObjectPool::Handle( 98 const ObjectPool& object_pool = ObjectPool::Handle(stub.object_pool());
102 Instructions::Handle(stub.instructions()).object_pool());
103 object_pool.DebugPrint(); 99 object_pool.DebugPrint();
104 } 100 }
105 stub.set_entry_patch_pc_offset(entry_patch_offset);
106 stub.set_patch_code_pc_offset(patch_code_offset);
107 } 101 }
108 return stub.raw(); 102 return stub.raw();
109 } 103 }
110 104
111 105
112 const StubEntry* StubCode::UnoptimizedStaticCallEntry( 106 const StubEntry* StubCode::UnoptimizedStaticCallEntry(
113 intptr_t num_args_tested) { 107 intptr_t num_args_tested) {
114 switch (num_args_tested) { 108 switch (num_args_tested) {
115 case 0: 109 case 0:
116 return ZeroArgsUnoptimizedStaticCall_entry(); 110 return ZeroArgsUnoptimizedStaticCall_entry();
(...skipping 12 matching lines...) Expand all
129 void (*GenerateStub)(Assembler* assembler)) { 123 void (*GenerateStub)(Assembler* assembler)) {
130 Assembler assembler; 124 Assembler assembler;
131 GenerateStub(&assembler); 125 GenerateStub(&assembler);
132 const Code& code = Code::Handle(Code::FinalizeCode(name, &assembler)); 126 const Code& code = Code::Handle(Code::FinalizeCode(name, &assembler));
133 if (FLAG_disassemble_stubs) { 127 if (FLAG_disassemble_stubs) {
134 LogBlock lb; 128 LogBlock lb;
135 THR_Print("Code for stub '%s': {\n", name); 129 THR_Print("Code for stub '%s': {\n", name);
136 DisassembleToStdout formatter; 130 DisassembleToStdout formatter;
137 code.Disassemble(&formatter); 131 code.Disassemble(&formatter);
138 THR_Print("}\n"); 132 THR_Print("}\n");
139 const ObjectPool& object_pool = ObjectPool::Handle( 133 const ObjectPool& object_pool = ObjectPool::Handle(code.object_pool());
140 Instructions::Handle(code.instructions()).object_pool());
141 object_pool.DebugPrint(); 134 object_pool.DebugPrint();
142 } 135 }
143 return code.raw(); 136 return code.raw();
144 } 137 }
145 138
146 139
147 const char* StubCode::NameOfStub(uword entry_point) { 140 const char* StubCode::NameOfStub(uword entry_point) {
148 #define VM_STUB_CODE_TESTER(name) \ 141 #define VM_STUB_CODE_TESTER(name) \
149 if ((name##_entry() != NULL) && \ 142 if ((name##_entry() != NULL) && \
150 (entry_point == name##_entry()->EntryPoint())) { \ 143 (entry_point == name##_entry()->EntryPoint())) { \
151 return ""#name; \ 144 return ""#name; \
152 } 145 }
153 VM_STUB_CODE_LIST(VM_STUB_CODE_TESTER); 146 VM_STUB_CODE_LIST(VM_STUB_CODE_TESTER);
154 #undef VM_STUB_CODE_TESTER 147 #undef VM_STUB_CODE_TESTER
155 return NULL; 148 return NULL;
156 } 149 }
157 150
158 } // namespace dart 151 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698