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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 "static foo%d([int i=1,int j=2,int k=3]){return i+j+k;}", i); | 46 "static foo%d([int i=1,int j=2,int k=3]){return i+j+k;}", i); |
47 written += OS::SNPrint((scriptChars + written), | 47 written += OS::SNPrint((scriptChars + written), |
48 (kScriptSize - written), | 48 (kScriptSize - written), |
49 "%s", | 49 "%s", |
50 buffer); | 50 buffer); |
51 } | 51 } |
52 OS::SNPrint((scriptChars + written), (kScriptSize - written), "}"); | 52 OS::SNPrint((scriptChars + written), (kScriptSize - written), "}"); |
53 source = String::New(scriptChars); | 53 source = String::New(scriptChars); |
54 script = Script::New(url, source, RawScript::kScriptTag); | 54 script = Script::New(url, source, RawScript::kScriptTag); |
55 EXPECT(CompilerTest::TestCompileScript(lib, script)); | 55 EXPECT(CompilerTest::TestCompileScript(lib, script)); |
56 String& ambiguity_error_msg = String::Handle(); | 56 clsA = lib.LookupClass(String::Handle(Symbols::New("A"))); |
57 clsA = lib.LookupClass(String::Handle(Symbols::New("A")), | |
58 &ambiguity_error_msg); | |
59 EXPECT(!clsA.IsNull()); | 57 EXPECT(!clsA.IsNull()); |
60 ClassFinalizer::FinalizePendingClasses(); | 58 ClassFinalizer::FinalizePendingClasses(); |
61 for (int i = 0; i < kNumFunctions; i++) { | 59 for (int i = 0; i < kNumFunctions; i++) { |
62 OS::SNPrint(buffer, 256, "foo%d", i); | 60 OS::SNPrint(buffer, 256, "foo%d", i); |
63 function_name = String::New(buffer); | 61 function_name = String::New(buffer); |
64 function = clsA.LookupStaticFunction(function_name); | 62 function = clsA.LookupStaticFunction(function_name); |
65 EXPECT(!function.IsNull()); | 63 EXPECT(!function.IsNull()); |
66 EXPECT(CompilerTest::TestCompileFunction(function)); | 64 EXPECT(CompilerTest::TestCompileFunction(function)); |
67 EXPECT(function.HasCode()); | 65 EXPECT(function.HasCode()); |
68 } | 66 } |
(...skipping 27 matching lines...) Expand all Loading... |
96 written += OS::SNPrint((scriptChars + written), | 94 written += OS::SNPrint((scriptChars + written), |
97 (kScriptSize - written), | 95 (kScriptSize - written), |
98 "%s", | 96 "%s", |
99 buffer); | 97 buffer); |
100 } | 98 } |
101 OS::SNPrint((scriptChars + written), (kScriptSize - written), "}"); | 99 OS::SNPrint((scriptChars + written), (kScriptSize - written), "}"); |
102 url = String::New("dart-test:FindCodeObject"); | 100 url = String::New("dart-test:FindCodeObject"); |
103 source = String::New(scriptChars); | 101 source = String::New(scriptChars); |
104 script = Script::New(url, source, RawScript::kScriptTag); | 102 script = Script::New(url, source, RawScript::kScriptTag); |
105 EXPECT(CompilerTest::TestCompileScript(lib, script)); | 103 EXPECT(CompilerTest::TestCompileScript(lib, script)); |
106 clsB = lib.LookupClass(String::Handle(Symbols::New("B")), | 104 clsB = lib.LookupClass(String::Handle(Symbols::New("B"))); |
107 &ambiguity_error_msg); | |
108 EXPECT(!clsB.IsNull()); | 105 EXPECT(!clsB.IsNull()); |
109 ClassFinalizer::FinalizePendingClasses(); | 106 ClassFinalizer::FinalizePendingClasses(); |
110 for (int i = 0; i < kNumFunctions; i++) { | 107 for (int i = 0; i < kNumFunctions; i++) { |
111 OS::SNPrint(buffer, 256, "moo%d", i); | 108 OS::SNPrint(buffer, 256, "moo%d", i); |
112 function_name = String::New(buffer); | 109 function_name = String::New(buffer); |
113 function = clsB.LookupStaticFunction(function_name); | 110 function = clsB.LookupStaticFunction(function_name); |
114 EXPECT(!function.IsNull()); | 111 EXPECT(!function.IsNull()); |
115 EXPECT(CompilerTest::TestCompileFunction(function)); | 112 EXPECT(CompilerTest::TestCompileFunction(function)); |
116 EXPECT(function.HasCode()); | 113 EXPECT(function.HasCode()); |
117 } | 114 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 #else | 151 #else |
155 EXPECT(code.Size() > PageSpace::kPageSize); | 152 EXPECT(code.Size() > PageSpace::kPageSize); |
156 EXPECT(Code::LookupCode(pc) == code.raw()); | 153 EXPECT(Code::LookupCode(pc) == code.raw()); |
157 EXPECT(code.Size() > (1 * MB)); | 154 EXPECT(code.Size() > (1 * MB)); |
158 pc = code.EntryPoint() + (1 * MB); | 155 pc = code.EntryPoint() + (1 * MB); |
159 EXPECT(Code::LookupCode(pc) == code.raw()); | 156 EXPECT(Code::LookupCode(pc) == code.raw()); |
160 #endif // defined(TARGET_ARCH_MIPS) | 157 #endif // defined(TARGET_ARCH_MIPS) |
161 } | 158 } |
162 | 159 |
163 } // namespace dart | 160 } // namespace dart |
OLD | NEW |