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

Side by Side Diff: runtime/vm/find_code_object_test.cc

Issue 19662003: Refactor resolution code in the vm to properly handle ambiguity errors. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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) 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
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 clsA = lib.LookupClass(String::Handle(Symbols::New("A")), NULL);
57 EXPECT(!clsA.IsNull()); 57 EXPECT(!clsA.IsNull());
58 ClassFinalizer::FinalizePendingClasses(); 58 ClassFinalizer::FinalizePendingClasses();
59 for (int i = 0; i < kNumFunctions; i++) { 59 for (int i = 0; i < kNumFunctions; i++) {
60 OS::SNPrint(buffer, 256, "foo%d", i); 60 OS::SNPrint(buffer, 256, "foo%d", i);
61 function_name = String::New(buffer); 61 function_name = String::New(buffer);
62 function = clsA.LookupStaticFunction(function_name); 62 function = clsA.LookupStaticFunction(function_name);
63 EXPECT(!function.IsNull()); 63 EXPECT(!function.IsNull());
64 EXPECT(CompilerTest::TestCompileFunction(function)); 64 EXPECT(CompilerTest::TestCompileFunction(function));
65 EXPECT(function.HasCode()); 65 EXPECT(function.HasCode());
66 } 66 }
(...skipping 27 matching lines...) Expand all
94 written += OS::SNPrint((scriptChars + written), 94 written += OS::SNPrint((scriptChars + written),
95 (kScriptSize - written), 95 (kScriptSize - written),
96 "%s", 96 "%s",
97 buffer); 97 buffer);
98 } 98 }
99 OS::SNPrint((scriptChars + written), (kScriptSize - written), "}"); 99 OS::SNPrint((scriptChars + written), (kScriptSize - written), "}");
100 url = String::New("dart-test:FindCodeObject"); 100 url = String::New("dart-test:FindCodeObject");
101 source = String::New(scriptChars); 101 source = String::New(scriptChars);
102 script = Script::New(url, source, RawScript::kScriptTag); 102 script = Script::New(url, source, RawScript::kScriptTag);
103 EXPECT(CompilerTest::TestCompileScript(lib, script)); 103 EXPECT(CompilerTest::TestCompileScript(lib, script));
104 clsB = lib.LookupClass(String::Handle(Symbols::New("B"))); 104 clsB = lib.LookupClass(String::Handle(Symbols::New("B")), NULL);
105 EXPECT(!clsB.IsNull()); 105 EXPECT(!clsB.IsNull());
siva 2013/07/22 22:21:46 Ditto comment about tests.
regis 2013/07/22 23:51:27 Done.
106 ClassFinalizer::FinalizePendingClasses(); 106 ClassFinalizer::FinalizePendingClasses();
107 for (int i = 0; i < kNumFunctions; i++) { 107 for (int i = 0; i < kNumFunctions; i++) {
108 OS::SNPrint(buffer, 256, "moo%d", i); 108 OS::SNPrint(buffer, 256, "moo%d", i);
109 function_name = String::New(buffer); 109 function_name = String::New(buffer);
110 function = clsB.LookupStaticFunction(function_name); 110 function = clsB.LookupStaticFunction(function_name);
111 EXPECT(!function.IsNull()); 111 EXPECT(!function.IsNull());
112 EXPECT(CompilerTest::TestCompileFunction(function)); 112 EXPECT(CompilerTest::TestCompileFunction(function));
113 EXPECT(function.HasCode()); 113 EXPECT(function.HasCode());
114 } 114 }
115 115
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 #else 151 #else
152 EXPECT(code.Size() > PageSpace::kPageSize); 152 EXPECT(code.Size() > PageSpace::kPageSize);
153 EXPECT(Code::LookupCode(pc) == code.raw()); 153 EXPECT(Code::LookupCode(pc) == code.raw());
154 EXPECT(code.Size() > (1 * MB)); 154 EXPECT(code.Size() > (1 * MB));
155 pc = code.EntryPoint() + (1 * MB); 155 pc = code.EntryPoint() + (1 * MB);
156 EXPECT(Code::LookupCode(pc) == code.raw()); 156 EXPECT(Code::LookupCode(pc) == code.raw());
157 #endif // defined(TARGET_ARCH_MIPS) 157 #endif // defined(TARGET_ARCH_MIPS)
158 } 158 }
159 159
160 } // namespace dart 160 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698