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

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

Issue 306483005: - Use isolate where it is appropriate. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 6 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/parser.cc ('K') | « runtime/vm/stub_code.h ('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 "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"
11 #include "vm/flags.h" 11 #include "vm/flags.h"
12 #include "vm/virtual_memory.h" 12 #include "vm/virtual_memory.h"
13 #include "vm/visitor.h" 13 #include "vm/visitor.h"
14 14
15 namespace dart { 15 namespace dart {
16 16
17 DEFINE_FLAG(bool, disassemble_stubs, false, "Disassemble generated stubs."); 17 DEFINE_FLAG(bool, disassemble_stubs, false, "Disassemble generated stubs.");
18 18
19 #define STUB_CODE_DECLARE(name) \ 19 #define STUB_CODE_DECLARE(name) \
20 StubEntry* StubCode::name##_entry_ = NULL; 20 StubEntry* StubCode::name##_entry_ = NULL;
21 VM_STUB_CODE_LIST(STUB_CODE_DECLARE); 21 VM_STUB_CODE_LIST(STUB_CODE_DECLARE);
22 #undef STUB_CODE_DECLARE 22 #undef STUB_CODE_DECLARE
23 23
24 24
25 StubEntry::StubEntry(const char* name, const Code& code) 25 StubEntry::StubEntry(const Code& code)
26 : code_(code.raw()), 26 : code_(code.raw()),
27 entry_point_(code.EntryPoint()), 27 entry_point_(code.EntryPoint()),
28 size_(code.Size()), 28 size_(code.Size()),
29 label_(name, code.EntryPoint()) { 29 label_(code.EntryPoint()) {
30 } 30 }
31 31
32 32
33 // Visit all object pointers. 33 // Visit all object pointers.
34 void StubEntry::VisitObjectPointers(ObjectPointerVisitor* visitor) { 34 void StubEntry::VisitObjectPointers(ObjectPointerVisitor* visitor) {
35 ASSERT(visitor != NULL); 35 ASSERT(visitor != NULL);
36 visitor->VisitPointer(reinterpret_cast<RawObject**>(&code_)); 36 visitor->VisitPointer(reinterpret_cast<RawObject**>(&code_));
37 } 37 }
38 38
39 39
40 StubCode::~StubCode() { 40 StubCode::~StubCode() {
41 #define STUB_CODE_DELETER(name) \ 41 #define STUB_CODE_DELETER(name) \
42 delete name##_entry_; 42 delete name##_entry_;
43 STUB_CODE_LIST(STUB_CODE_DELETER); 43 STUB_CODE_LIST(STUB_CODE_DELETER);
44 #undef STUB_CODE_DELETER 44 #undef STUB_CODE_DELETER
45 } 45 }
46 46
47 47
48 #define STUB_CODE_GENERATE(name) \ 48 #define STUB_CODE_GENERATE(name) \
49 code ^= Generate("_stub_"#name, StubCode::Generate##name##Stub); \ 49 code ^= Generate("_stub_"#name, StubCode::Generate##name##Stub); \
50 name##_entry_ = new StubEntry("_stub_"#name, code); 50 name##_entry_ = new StubEntry(code);
51 51
52 52
53 void StubCode::InitOnce() { 53 void StubCode::InitOnce() {
54 // Generate all the stubs. 54 // Generate all the stubs.
55 Code& code = Code::Handle(); 55 Code& code = Code::Handle();
56 VM_STUB_CODE_LIST(STUB_CODE_GENERATE); 56 VM_STUB_CODE_LIST(STUB_CODE_GENERATE);
57 } 57 }
58 58
59 59
60 void StubCode::GenerateFor(Isolate* init) { 60 void StubCode::GenerateFor(Isolate* init) {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 VM_STUB_CODE_LIST(STUB_CODE_TESTER); 143 VM_STUB_CODE_LIST(STUB_CODE_TESTER);
144 Isolate* isolate = Isolate::Current(); 144 Isolate* isolate = Isolate::Current();
145 if ((isolate != NULL) && (isolate->stub_code() != NULL)) { 145 if ((isolate != NULL) && (isolate->stub_code() != NULL)) {
146 STUB_CODE_LIST(STUB_CODE_TESTER); 146 STUB_CODE_LIST(STUB_CODE_TESTER);
147 } 147 }
148 #undef STUB_CODE_TESTER 148 #undef STUB_CODE_TESTER
149 return NULL; 149 return NULL;
150 } 150 }
151 151
152 } // namespace dart 152 } // namespace dart
OLDNEW
« runtime/vm/parser.cc ('K') | « runtime/vm/stub_code.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698