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

Side by Side Diff: vm/runtime_entry_test.cc

Issue 10783035: Create frequently used symbols in the vm isolate (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 5 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
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/verifier.h" 9 #include "vm/verifier.h"
9 10
10 namespace dart { 11 namespace dart {
11 12
12 // Add function to a class and that class to the class dictionary so that 13 // Add function to a class and that class to the class dictionary so that
13 // frame walking can be used. 14 // frame walking can be used.
14 const Function& RegisterFakeFunction(const char* name, const Code& code) { 15 const Function& RegisterFakeFunction(const char* name, const Code& code) {
15 const String& function_name = String::ZoneHandle(String::NewSymbol(name)); 16 const String& function_name = String::ZoneHandle(Symbols::New(name));
16 const Function& function = Function::ZoneHandle( 17 const Function& function = Function::ZoneHandle(
17 Function::New(function_name, RawFunction::kFunction, true, false, 0)); 18 Function::New(function_name, RawFunction::kFunction, true, false, 0));
18 Class& cls = Class::ZoneHandle(); 19 Class& cls = Class::ZoneHandle();
19 const Script& script = Script::Handle(); 20 const Script& script = Script::Handle();
20 cls = Class::New(function_name, script, Scanner::kDummyTokenIndex); 21 cls = Class::New(function_name, script, Scanner::kDummyTokenIndex);
21 const Array& functions = Array::Handle(Array::New(1)); 22 const Array& functions = Array::Handle(Array::New(1));
22 functions.SetAt(0, function); 23 functions.SetAt(0, function);
23 cls.SetFunctions(functions); 24 cls.SetFunctions(functions);
24 Library& lib = Library::Handle(Library::CoreLibrary()); 25 Library& lib = Library::Handle(Library::CoreLibrary());
25 lib.AddClass(cls); 26 lib.AddClass(cls);
(...skipping 24 matching lines...) Expand all
50 RawObject* arg0, RawObject* arg1) { 51 RawObject* arg0, RawObject* arg1) {
51 // Ignoring overflow in the calculation below and using the internal 52 // Ignoring overflow in the calculation below and using the internal
52 // representation of Smi directly without using any handlized code. 53 // representation of Smi directly without using any handlized code.
53 intptr_t result = reinterpret_cast<intptr_t>(arg0) + 54 intptr_t result = reinterpret_cast<intptr_t>(arg0) +
54 reinterpret_cast<intptr_t>(arg1); 55 reinterpret_cast<intptr_t>(arg1);
55 return reinterpret_cast<RawObject*>(result); 56 return reinterpret_cast<RawObject*>(result);
56 } 57 }
57 END_LEAF_RUNTIME_ENTRY 58 END_LEAF_RUNTIME_ENTRY
58 59
59 } // namespace dart 60 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698