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

Side by Side Diff: vm/compiler_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
« no previous file with comments | « vm/compiler.cc ('k') | vm/dart.cc » ('j') | vm/dart_api_impl.cc » ('J')
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 "platform/assert.h" 5 #include "platform/assert.h"
6 #include "vm/class_finalizer.h" 6 #include "vm/class_finalizer.h"
7 #include "vm/compiler.h" 7 #include "vm/compiler.h"
8 #include "vm/object.h" 8 #include "vm/object.h"
9 #include "vm/symbols.h"
9 #include "vm/unit_test.h" 10 #include "vm/unit_test.h"
10 11
11 namespace dart { 12 namespace dart {
12 13
13 // Compiler only implemented on IA32 and X64 now. 14 // Compiler only implemented on IA32 and X64 now.
14 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) 15 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64)
15 16
16 TEST_CASE(CompileScript) { 17 TEST_CASE(CompileScript) {
17 const char* kScriptChars = 18 const char* kScriptChars =
18 "class A {\n" 19 "class A {\n"
(...skipping 15 matching lines...) Expand all
34 " // A.foo();\n" 35 " // A.foo();\n"
35 " }\n" 36 " }\n"
36 "}\n"; 37 "}\n";
37 String& url = String::Handle(String::New("dart-test:CompileFunction")); 38 String& url = String::Handle(String::New("dart-test:CompileFunction"));
38 String& source = String::Handle(String::New(kScriptChars)); 39 String& source = String::Handle(String::New(kScriptChars));
39 Script& script = Script::Handle(Script::New(url, source, RawScript::kSource)); 40 Script& script = Script::Handle(Script::New(url, source, RawScript::kSource));
40 Library& lib = Library::Handle(Library::CoreLibrary()); 41 Library& lib = Library::Handle(Library::CoreLibrary());
41 EXPECT(CompilerTest::TestCompileScript(lib, script)); 42 EXPECT(CompilerTest::TestCompileScript(lib, script));
42 EXPECT(ClassFinalizer::FinalizePendingClasses()); 43 EXPECT(ClassFinalizer::FinalizePendingClasses());
43 Class& cls = Class::Handle( 44 Class& cls = Class::Handle(
44 lib.LookupClass(String::Handle(String::NewSymbol("A")))); 45 lib.LookupClass(String::Handle(Symbols::New("A"))));
45 EXPECT(!cls.IsNull()); 46 EXPECT(!cls.IsNull());
46 String& function_foo_name = String::Handle(String::New("foo")); 47 String& function_foo_name = String::Handle(String::New("foo"));
47 Function& function_foo = 48 Function& function_foo =
48 Function::Handle(cls.LookupStaticFunction(function_foo_name)); 49 Function::Handle(cls.LookupStaticFunction(function_foo_name));
49 EXPECT(!function_foo.IsNull()); 50 EXPECT(!function_foo.IsNull());
50 51
51 EXPECT(CompilerTest::TestCompileFunction(function_foo)); 52 EXPECT(CompilerTest::TestCompileFunction(function_foo));
52 EXPECT(function_foo.HasCode()); 53 EXPECT(function_foo.HasCode());
53 54
54 String& function_moo_name = String::Handle(String::New("moo")); 55 String& function_moo_name = String::Handle(String::New("moo"));
55 Function& function_moo = 56 Function& function_moo =
56 Function::Handle(cls.LookupStaticFunction(function_moo_name)); 57 Function::Handle(cls.LookupStaticFunction(function_moo_name));
57 EXPECT(!function_moo.IsNull()); 58 EXPECT(!function_moo.IsNull());
58 59
59 EXPECT(CompilerTest::TestCompileFunction(function_moo)); 60 EXPECT(CompilerTest::TestCompileFunction(function_moo));
60 EXPECT(function_moo.HasCode()); 61 EXPECT(function_moo.HasCode());
61 } 62 }
62 63
63 #endif // TARGET_ARCH_IA32 || TARGET_ARCH_X64 64 #endif // TARGET_ARCH_IA32 || TARGET_ARCH_X64
64 65
65 } // namespace dart 66 } // namespace dart
OLDNEW
« no previous file with comments | « vm/compiler.cc ('k') | vm/dart.cc » ('j') | vm/dart_api_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698