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

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

Issue 1270803003: VM: More abstract interface for generating stub calls. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « runtime/vm/stub_code.h ('k') | runtime/vm/stub_code_arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 55
56 void StubCode::Init(Isolate* isolate) { } 56 void StubCode::Init(Isolate* isolate) { }
57 57
58 58
59 void StubCode::VisitObjectPointers(ObjectPointerVisitor* visitor) { 59 void StubCode::VisitObjectPointers(ObjectPointerVisitor* visitor) {
60 } 60 }
61 61
62 62
63 bool StubCode::InInvocationStub(uword pc) { 63 bool StubCode::InInvocationStub(uword pc) {
64 uword entry = StubCode::InvokeDartCodeEntryPoint(); 64 uword entry = StubCode::InvokeDartCode_entry()->EntryPoint();
65 uword size = StubCode::InvokeDartCodeSize(); 65 uword size = StubCode::InvokeDartCodeSize();
66 return (pc >= entry) && (pc < (entry + size)); 66 return (pc >= entry) && (pc < (entry + size));
67 } 67 }
68 68
69 69
70 bool StubCode::InJumpToExceptionHandlerStub(uword pc) { 70 bool StubCode::InJumpToExceptionHandlerStub(uword pc) {
71 uword entry = StubCode::JumpToExceptionHandlerEntryPoint(); 71 uword entry = StubCode::JumpToExceptionHandler_entry()->EntryPoint();
72 uword size = StubCode::JumpToExceptionHandlerSize(); 72 uword size = StubCode::JumpToExceptionHandlerSize();
73 return (pc >= entry) && (pc < (entry + size)); 73 return (pc >= entry) && (pc < (entry + size));
74 } 74 }
75 75
76 76
77 RawCode* StubCode::GetAllocationStubForClass(const Class& cls) { 77 RawCode* StubCode::GetAllocationStubForClass(const Class& cls) {
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) {
(...skipping 20 matching lines...) Expand all
102 Instructions::Handle(stub.instructions()).object_pool()); 102 Instructions::Handle(stub.instructions()).object_pool());
103 object_pool.DebugPrint(); 103 object_pool.DebugPrint();
104 } 104 }
105 stub.set_entry_patch_pc_offset(entry_patch_offset); 105 stub.set_entry_patch_pc_offset(entry_patch_offset);
106 stub.set_patch_code_pc_offset(patch_code_offset); 106 stub.set_patch_code_pc_offset(patch_code_offset);
107 } 107 }
108 return stub.raw(); 108 return stub.raw();
109 } 109 }
110 110
111 111
112 uword StubCode::UnoptimizedStaticCallEntryPoint(intptr_t num_args_tested) { 112 const StubEntry* StubCode::UnoptimizedStaticCallEntry(
113 intptr_t num_args_tested) {
113 switch (num_args_tested) { 114 switch (num_args_tested) {
114 case 0: 115 case 0:
115 return ZeroArgsUnoptimizedStaticCallEntryPoint(); 116 return ZeroArgsUnoptimizedStaticCall_entry();
116 case 1: 117 case 1:
117 return OneArgUnoptimizedStaticCallEntryPoint(); 118 return OneArgUnoptimizedStaticCall_entry();
118 case 2: 119 case 2:
119 return TwoArgsUnoptimizedStaticCallEntryPoint(); 120 return TwoArgsUnoptimizedStaticCall_entry();
120 default: 121 default:
121 UNIMPLEMENTED(); 122 UNIMPLEMENTED();
122 return 0; 123 return NULL;
123 } 124 }
124 } 125 }
125 126
126 127
127 RawCode* StubCode::Generate(const char* name, 128 RawCode* StubCode::Generate(const char* name,
128 void (*GenerateStub)(Assembler* assembler)) { 129 void (*GenerateStub)(Assembler* assembler)) {
129 Assembler assembler; 130 Assembler assembler;
130 GenerateStub(&assembler); 131 GenerateStub(&assembler);
131 const Code& code = Code::Handle(Code::FinalizeCode(name, &assembler)); 132 const Code& code = Code::Handle(Code::FinalizeCode(name, &assembler));
132 if (FLAG_disassemble_stubs) { 133 if (FLAG_disassemble_stubs) {
133 LogBlock lb(Isolate::Current()); 134 LogBlock lb(Isolate::Current());
134 ISL_Print("Code for stub '%s': {\n", name); 135 ISL_Print("Code for stub '%s': {\n", name);
135 DisassembleToStdout formatter; 136 DisassembleToStdout formatter;
136 code.Disassemble(&formatter); 137 code.Disassemble(&formatter);
137 ISL_Print("}\n"); 138 ISL_Print("}\n");
138 const ObjectPool& object_pool = ObjectPool::Handle( 139 const ObjectPool& object_pool = ObjectPool::Handle(
139 Instructions::Handle(code.instructions()).object_pool()); 140 Instructions::Handle(code.instructions()).object_pool());
140 object_pool.DebugPrint(); 141 object_pool.DebugPrint();
141 } 142 }
142 return code.raw(); 143 return code.raw();
143 } 144 }
144 145
145 146
146 const char* StubCode::NameOfStub(uword entry_point) { 147 const char* StubCode::NameOfStub(uword entry_point) {
147 #define VM_STUB_CODE_TESTER(name) \ 148 #define VM_STUB_CODE_TESTER(name) \
148 if ((name##_entry() != NULL) && (entry_point == name##EntryPoint())) { \ 149 if ((name##_entry() != NULL) && \
150 (entry_point == name##_entry()->EntryPoint())) { \
149 return ""#name; \ 151 return ""#name; \
150 } 152 }
151 VM_STUB_CODE_LIST(VM_STUB_CODE_TESTER); 153 VM_STUB_CODE_LIST(VM_STUB_CODE_TESTER);
152 #undef VM_STUB_CODE_TESTER 154 #undef VM_STUB_CODE_TESTER
153 return NULL; 155 return NULL;
154 } 156 }
155 157
156 } // namespace dart 158 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/stub_code.h ('k') | runtime/vm/stub_code_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698