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

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

Issue 178233003: Allocate instance closures similarly to regular closures, i.e. without a (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
« 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 "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/disassembler.h" 9 #include "vm/disassembler.h"
10 #include "vm/flags.h" 10 #include "vm/flags.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 OS::Print("Code for allocation stub '%s': {\n", name); 110 OS::Print("Code for allocation stub '%s': {\n", name);
111 Disassembler::Disassemble(stub.EntryPoint(), 111 Disassembler::Disassemble(stub.EntryPoint(),
112 stub.EntryPoint() + assembler.CodeSize()); 112 stub.EntryPoint() + assembler.CodeSize());
113 OS::Print("}\n"); 113 OS::Print("}\n");
114 } 114 }
115 } 115 }
116 return stub.raw(); 116 return stub.raw();
117 } 117 }
118 118
119 119
120 RawCode* StubCode::GetAllocationStubForClosure(const Function& func) {
121 Code& stub = Code::Handle(func.closure_allocation_stub());
122 if (stub.IsNull()) {
123 Assembler assembler;
124 const char* name = func.ToCString();
125 StubCode::GenerateAllocationStubForClosure(&assembler, func);
126 stub ^= Code::FinalizeCode(name, &assembler);
127 func.set_closure_allocation_stub(stub);
128 if (FLAG_disassemble_stubs) {
129 OS::Print("Code for closure allocation stub '%s': {\n", name);
130 Disassembler::Disassemble(stub.EntryPoint(),
131 stub.EntryPoint() + assembler.CodeSize());
132 OS::Print("}\n");
133 }
134 }
135 return stub.raw();
136 }
137
138
139 RawCode* StubCode::Generate(const char* name, 120 RawCode* StubCode::Generate(const char* name,
140 void (*GenerateStub)(Assembler* assembler)) { 121 void (*GenerateStub)(Assembler* assembler)) {
141 Assembler assembler; 122 Assembler assembler;
142 GenerateStub(&assembler); 123 GenerateStub(&assembler);
143 const Code& code = Code::Handle(Code::FinalizeCode(name, &assembler)); 124 const Code& code = Code::Handle(Code::FinalizeCode(name, &assembler));
144 if (FLAG_disassemble_stubs) { 125 if (FLAG_disassemble_stubs) {
145 OS::Print("Code for stub '%s': {\n", name); 126 OS::Print("Code for stub '%s': {\n", name);
146 Disassembler::Disassemble(code.EntryPoint(), 127 Disassembler::Disassemble(code.EntryPoint(),
147 code.EntryPoint() + assembler.CodeSize()); 128 code.EntryPoint() + assembler.CodeSize());
148 OS::Print("}\n"); 129 OS::Print("}\n");
(...skipping 11 matching lines...) Expand all
160 VM_STUB_CODE_LIST(STUB_CODE_TESTER); 141 VM_STUB_CODE_LIST(STUB_CODE_TESTER);
161 Isolate* isolate = Isolate::Current(); 142 Isolate* isolate = Isolate::Current();
162 if ((isolate != NULL) && (isolate->stub_code() != NULL)) { 143 if ((isolate != NULL) && (isolate->stub_code() != NULL)) {
163 STUB_CODE_LIST(STUB_CODE_TESTER); 144 STUB_CODE_LIST(STUB_CODE_TESTER);
164 } 145 }
165 #undef STUB_CODE_TESTER 146 #undef STUB_CODE_TESTER
166 return NULL; 147 return NULL;
167 } 148 }
168 149
169 } // namespace dart 150 } // 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