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

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

Issue 1870343002: - Refactor Symbol allocation to expect a thread parameter. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address review feedback. Created 4 years, 8 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
« no previous file with comments | « runtime/vm/exceptions.cc ('k') | runtime/vm/flag_list.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "static foo%d([int i=1,int j=2,int k=3]){return i+j+k;}", i); 48 "static foo%d([int i=1,int j=2,int k=3]){return i+j+k;}", i);
49 written += OS::SNPrint((scriptChars + written), 49 written += OS::SNPrint((scriptChars + written),
50 (kScriptSize - written), 50 (kScriptSize - written),
51 "%s", 51 "%s",
52 buffer); 52 buffer);
53 } 53 }
54 OS::SNPrint((scriptChars + written), (kScriptSize - written), "}"); 54 OS::SNPrint((scriptChars + written), (kScriptSize - written), "}");
55 source = String::New(scriptChars); 55 source = String::New(scriptChars);
56 script = Script::New(url, source, RawScript::kScriptTag); 56 script = Script::New(url, source, RawScript::kScriptTag);
57 EXPECT(CompilerTest::TestCompileScript(lib, script)); 57 EXPECT(CompilerTest::TestCompileScript(lib, script));
58 clsA = lib.LookupClass(String::Handle(Symbols::New("A"))); 58 clsA = lib.LookupClass(String::Handle(Symbols::New(thread, "A")));
59 EXPECT(!clsA.IsNull()); 59 EXPECT(!clsA.IsNull());
60 ClassFinalizer::ProcessPendingClasses(); 60 ClassFinalizer::ProcessPendingClasses();
61 for (int i = 0; i < kNumFunctions; i++) { 61 for (int i = 0; i < kNumFunctions; i++) {
62 OS::SNPrint(buffer, 256, "foo%d", i); 62 OS::SNPrint(buffer, 256, "foo%d", i);
63 function_name = String::New(buffer); 63 function_name = String::New(buffer);
64 function = clsA.LookupStaticFunction(function_name); 64 function = clsA.LookupStaticFunction(function_name);
65 EXPECT(!function.IsNull()); 65 EXPECT(!function.IsNull());
66 EXPECT(CompilerTest::TestCompileFunction(function)); 66 EXPECT(CompilerTest::TestCompileFunction(function));
67 const Code& code = Code::ZoneHandle(function.CurrentCode()); 67 const Code& code = Code::ZoneHandle(function.CurrentCode());
68 EXPECT(!code.IsNull()) 68 EXPECT(!code.IsNull())
(...skipping 29 matching lines...) Expand all
98 written += OS::SNPrint((scriptChars + written), 98 written += OS::SNPrint((scriptChars + written),
99 (kScriptSize - written), 99 (kScriptSize - written),
100 "%s", 100 "%s",
101 buffer); 101 buffer);
102 } 102 }
103 OS::SNPrint((scriptChars + written), (kScriptSize - written), "}"); 103 OS::SNPrint((scriptChars + written), (kScriptSize - written), "}");
104 url = String::New("dart-test:FindCodeObject"); 104 url = String::New("dart-test:FindCodeObject");
105 source = String::New(scriptChars); 105 source = String::New(scriptChars);
106 script = Script::New(url, source, RawScript::kScriptTag); 106 script = Script::New(url, source, RawScript::kScriptTag);
107 EXPECT(CompilerTest::TestCompileScript(lib, script)); 107 EXPECT(CompilerTest::TestCompileScript(lib, script));
108 clsB = lib.LookupClass(String::Handle(Symbols::New("B"))); 108 clsB = lib.LookupClass(String::Handle(Symbols::New(thread, "B")));
109 EXPECT(!clsB.IsNull()); 109 EXPECT(!clsB.IsNull());
110 ClassFinalizer::ProcessPendingClasses(); 110 ClassFinalizer::ProcessPendingClasses();
111 for (int i = 0; i < kNumFunctions; i++) { 111 for (int i = 0; i < kNumFunctions; i++) {
112 OS::SNPrint(buffer, 256, "moo%d", i); 112 OS::SNPrint(buffer, 256, "moo%d", i);
113 function_name = String::New(buffer); 113 function_name = String::New(buffer);
114 function = clsB.LookupStaticFunction(function_name); 114 function = clsB.LookupStaticFunction(function_name);
115 EXPECT(!function.IsNull()); 115 EXPECT(!function.IsNull());
116 EXPECT(CompilerTest::TestCompileFunction(function)); 116 EXPECT(CompilerTest::TestCompileFunction(function));
117 const Code& code = Code::ZoneHandle(function.CurrentCode()); 117 const Code& code = Code::ZoneHandle(function.CurrentCode());
118 EXPECT(!code.IsNull()); 118 EXPECT(!code.IsNull());
(...skipping 30 matching lines...) Expand all
149 EXPECT(code.Size() > 16); 149 EXPECT(code.Size() > 16);
150 pc = code.EntryPoint() + 16; 150 pc = code.EntryPoint() + 16;
151 EXPECT(code.Size() > (PageSpace::kPageSizeInWords << kWordSizeLog2)); 151 EXPECT(code.Size() > (PageSpace::kPageSizeInWords << kWordSizeLog2));
152 EXPECT(Code::LookupCode(pc) == code.raw()); 152 EXPECT(Code::LookupCode(pc) == code.raw());
153 EXPECT(code.Size() > (1 * MB)); 153 EXPECT(code.Size() > (1 * MB));
154 pc = code.EntryPoint() + (1 * MB); 154 pc = code.EntryPoint() + (1 * MB);
155 EXPECT(Code::LookupCode(pc) == code.raw()); 155 EXPECT(Code::LookupCode(pc) == code.raw());
156 } 156 }
157 157
158 } // namespace dart 158 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/exceptions.cc ('k') | runtime/vm/flag_list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698