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