OLD | NEW |
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/pages.h" | 9 #include "vm/pages.h" |
10 #include "vm/stack_frame.h" | 10 #include "vm/stack_frame.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 (kScriptSize - written), | 51 (kScriptSize - written), |
52 "%s", | 52 "%s", |
53 buffer); | 53 buffer); |
54 } | 54 } |
55 OS::SNPrint((scriptChars + written), (kScriptSize - written), "}"); | 55 OS::SNPrint((scriptChars + written), (kScriptSize - written), "}"); |
56 source = String::New(scriptChars); | 56 source = String::New(scriptChars); |
57 script = Script::New(url, source, RawScript::kSourceTag); | 57 script = Script::New(url, source, RawScript::kSourceTag); |
58 EXPECT(CompilerTest::TestCompileScript(lib, script)); | 58 EXPECT(CompilerTest::TestCompileScript(lib, script)); |
59 clsA = lib.LookupClass(String::Handle(Symbols::New("A"))); | 59 clsA = lib.LookupClass(String::Handle(Symbols::New("A"))); |
60 EXPECT(!clsA.IsNull()); | 60 EXPECT(!clsA.IsNull()); |
61 ClassFinalizer::FinalizePendingClasses(); | 61 ClassFinalizer::FinalizeAllClasses(); |
62 for (int i = 0; i < kNumFunctions; i++) { | 62 for (int i = 0; i < kNumFunctions; i++) { |
63 OS::SNPrint(buffer, 256, "foo%d", i); | 63 OS::SNPrint(buffer, 256, "foo%d", i); |
64 function_name = String::New(buffer); | 64 function_name = String::New(buffer); |
65 function = clsA.LookupStaticFunction(function_name); | 65 function = clsA.LookupStaticFunction(function_name); |
66 EXPECT(!function.IsNull()); | 66 EXPECT(!function.IsNull()); |
67 EXPECT(CompilerTest::TestCompileFunction(function)); | 67 EXPECT(CompilerTest::TestCompileFunction(function)); |
68 EXPECT(function.HasCode()); | 68 EXPECT(function.HasCode()); |
69 } | 69 } |
70 | 70 |
71 // Now load up class B with 1024 functions. | 71 // Now load up class B with 1024 functions. |
(...skipping 27 matching lines...) Expand all Loading... |
99 "%s", | 99 "%s", |
100 buffer); | 100 buffer); |
101 } | 101 } |
102 OS::SNPrint((scriptChars + written), (kScriptSize - written), "}"); | 102 OS::SNPrint((scriptChars + written), (kScriptSize - written), "}"); |
103 url = String::New("dart-test:FindCodeObject"); | 103 url = String::New("dart-test:FindCodeObject"); |
104 source = String::New(scriptChars); | 104 source = String::New(scriptChars); |
105 script = Script::New(url, source, RawScript::kSourceTag); | 105 script = Script::New(url, source, RawScript::kSourceTag); |
106 EXPECT(CompilerTest::TestCompileScript(lib, script)); | 106 EXPECT(CompilerTest::TestCompileScript(lib, script)); |
107 clsB = lib.LookupClass(String::Handle(Symbols::New("B"))); | 107 clsB = lib.LookupClass(String::Handle(Symbols::New("B"))); |
108 EXPECT(!clsB.IsNull()); | 108 EXPECT(!clsB.IsNull()); |
109 ClassFinalizer::FinalizePendingClasses(); | 109 ClassFinalizer::FinalizeAllClasses(); |
110 for (int i = 0; i < kNumFunctions; i++) { | 110 for (int i = 0; i < kNumFunctions; i++) { |
111 OS::SNPrint(buffer, 256, "moo%d", i); | 111 OS::SNPrint(buffer, 256, "moo%d", i); |
112 function_name = String::New(buffer); | 112 function_name = String::New(buffer); |
113 function = clsB.LookupStaticFunction(function_name); | 113 function = clsB.LookupStaticFunction(function_name); |
114 EXPECT(!function.IsNull()); | 114 EXPECT(!function.IsNull()); |
115 EXPECT(CompilerTest::TestCompileFunction(function)); | 115 EXPECT(CompilerTest::TestCompileFunction(function)); |
116 EXPECT(function.HasCode()); | 116 EXPECT(function.HasCode()); |
117 } | 117 } |
118 | 118 |
119 // Now try and access these functions using the code index table. | 119 // Now try and access these functions using the code index table. |
(...skipping 28 matching lines...) Expand all Loading... |
148 EXPECT(code.Size() > PageSpace::kPageSize); | 148 EXPECT(code.Size() > PageSpace::kPageSize); |
149 EXPECT(Code::LookupCode(pc) == code.raw()); | 149 EXPECT(Code::LookupCode(pc) == code.raw()); |
150 EXPECT(code.Size() > (1 * MB)); | 150 EXPECT(code.Size() > (1 * MB)); |
151 pc = code.EntryPoint() + (1 * MB); | 151 pc = code.EntryPoint() + (1 * MB); |
152 EXPECT(Code::LookupCode(pc) == code.raw()); | 152 EXPECT(Code::LookupCode(pc) == code.raw()); |
153 } | 153 } |
154 | 154 |
155 #endif // TARGET_ARCH_IA32 || TARGET_ARCH_X64 | 155 #endif // TARGET_ARCH_IA32 || TARGET_ARCH_X64 |
156 | 156 |
157 } // namespace dart | 157 } // namespace dart |
OLD | NEW |