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

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

Issue 14820028: Delay Class parsing until the class is actually used. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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
« runtime/vm/snapshot.cc ('K') | « runtime/vm/snapshot.cc ('k') | no next file » | 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 } 89 }
90 90
91 91
92 bool StubCode::InInvocationStub(uword pc) { 92 bool StubCode::InInvocationStub(uword pc) {
93 return ((pc >= InvokeDartCodeEntryPoint()) && 93 return ((pc >= InvokeDartCodeEntryPoint()) &&
94 (pc < (InvokeDartCodeEntryPoint() + InvokeDartCodeSize()))); 94 (pc < (InvokeDartCodeEntryPoint() + InvokeDartCodeSize())));
95 } 95 }
96 96
97 97
98 RawCode* StubCode::GetAllocationStubForClass(const Class& cls) { 98 RawCode* StubCode::GetAllocationStubForClass(const Class& cls) {
99 Code& stub = Code::Handle(cls.allocation_stub()); 99 Isolate* isolate = Isolate::Current();
100 const Error& error = Error::Handle(isolate, cls.EnsureIsParsed(isolate));
101 ASSERT(error.IsNull());
102 Code& stub = Code::Handle(isolate, cls.allocation_stub());
100 if (stub.IsNull()) { 103 if (stub.IsNull()) {
101 Assembler assembler; 104 Assembler assembler;
102 const char* name = cls.ToCString(); 105 const char* name = cls.ToCString();
103 StubCode::GenerateAllocationStubForClass(&assembler, cls); 106 StubCode::GenerateAllocationStubForClass(&assembler, cls);
104 stub ^= Code::FinalizeCode(name, &assembler); 107 stub ^= Code::FinalizeCode(name, &assembler);
105 cls.set_allocation_stub(stub); 108 cls.set_allocation_stub(stub);
106 if (FLAG_disassemble_stubs) { 109 if (FLAG_disassemble_stubs) {
107 OS::Print("Code for allocation stub '%s': {\n", name); 110 OS::Print("Code for allocation stub '%s': {\n", name);
108 Disassembler::Disassemble(stub.EntryPoint(), 111 Disassembler::Disassemble(stub.EntryPoint(),
109 stub.EntryPoint() + assembler.CodeSize()); 112 stub.EntryPoint() + assembler.CodeSize());
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 VM_STUB_CODE_LIST(STUB_CODE_TESTER); 160 VM_STUB_CODE_LIST(STUB_CODE_TESTER);
158 Isolate* isolate = Isolate::Current(); 161 Isolate* isolate = Isolate::Current();
159 if ((isolate != NULL) && (isolate->stub_code() != NULL)) { 162 if ((isolate != NULL) && (isolate->stub_code() != NULL)) {
160 STUB_CODE_LIST(STUB_CODE_TESTER); 163 STUB_CODE_LIST(STUB_CODE_TESTER);
161 } 164 }
162 #undef STUB_CODE_TESTER 165 #undef STUB_CODE_TESTER
163 return NULL; 166 return NULL;
164 } 167 }
165 168
166 } // namespace dart 169 } // namespace dart
OLDNEW
« runtime/vm/snapshot.cc ('K') | « runtime/vm/snapshot.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698