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

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

Issue 1870343002: - Refactor Symbol allocation to expect a thread parameter. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address review feedback. Created 4 years, 8 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/resolver_test.cc ('k') | runtime/vm/scanner.h » ('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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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/runtime_entry.h" 5 #include "vm/runtime_entry.h"
6 6
7 #include "vm/object.h" 7 #include "vm/object.h"
8 #include "vm/symbols.h" 8 #include "vm/symbols.h"
9 #include "vm/verifier.h" 9 #include "vm/verifier.h"
10 10
11 namespace dart { 11 namespace dart {
12 12
13 13
14 // Add function to a class and that class to the class dictionary so that 14 // Add function to a class and that class to the class dictionary so that
15 // frame walking can be used. 15 // frame walking can be used.
16 const Function& RegisterFakeFunction(const char* name, const Code& code) { 16 const Function& RegisterFakeFunction(const char* name, const Code& code) {
17 const String& class_name = String::Handle(Symbols::New("ownerClass")); 17 Thread* thread = Thread::Current();
18 const String& class_name = String::Handle(Symbols::New(thread, "ownerClass"));
18 const Script& script = Script::Handle(); 19 const Script& script = Script::Handle();
19 const Class& owner_class = 20 const Class& owner_class =
20 Class::Handle(Class::New(class_name, script, 21 Class::Handle(Class::New(class_name, script,
21 TokenPosition::kNoSource)); 22 TokenPosition::kNoSource));
22 const String& function_name = String::ZoneHandle(Symbols::New(name)); 23 const String& function_name = String::ZoneHandle(Symbols::New(thread, name));
23 const Function& function = Function::ZoneHandle( 24 const Function& function = Function::ZoneHandle(
24 Function::New(function_name, 25 Function::New(function_name,
25 RawFunction::kRegularFunction, 26 RawFunction::kRegularFunction,
26 true, 27 true,
27 false, 28 false,
28 false, 29 false,
29 false, 30 false,
30 false, 31 false,
31 owner_class, 32 owner_class,
32 TokenPosition::kMinSource)); 33 TokenPosition::kMinSource));
33 const Array& functions = Array::Handle(Array::New(1)); 34 const Array& functions = Array::Handle(Array::New(1));
34 functions.SetAt(0, function); 35 functions.SetAt(0, function);
35 owner_class.SetFunctions(functions); 36 owner_class.SetFunctions(functions);
36 Library& lib = Library::Handle(Library::CoreLibrary()); 37 Library& lib = Library::Handle(Library::CoreLibrary());
37 lib.AddClass(owner_class); 38 lib.AddClass(owner_class);
38 function.AttachCode(code); 39 function.AttachCode(code);
39 return function; 40 return function;
40 } 41 }
41 42
42 } // namespace dart 43 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/resolver_test.cc ('k') | runtime/vm/scanner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698