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

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

Issue 81333003: Do not eagerly finalize classes in CHA, instead regard unfinalized classes as ’non-existent’ an… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 1 month 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
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")));
57 EXPECT(!clsA.IsNull()); 57 EXPECT(!clsA.IsNull());
58 ClassFinalizer::FinalizePendingClasses(); 58 ClassFinalizer::FinalizeTypeHierarchy();
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 }
67 67
68 // Now load up class B with 1024 functions. 68 // Now load up class B with 1024 functions.
(...skipping 27 matching lines...) Expand all
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")));
105 EXPECT(!clsB.IsNull()); 105 EXPECT(!clsB.IsNull());
106 ClassFinalizer::FinalizePendingClasses(); 106 ClassFinalizer::FinalizeTypeHierarchy();
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
116 // Now try and access these functions using the code index table. 116 // Now try and access these functions using the code index table.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 #else 151 #else
152 EXPECT(code.Size() > (PageSpace::kPageSizeInWords << kWordSizeLog2)); 152 EXPECT(code.Size() > (PageSpace::kPageSizeInWords << kWordSizeLog2));
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