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

Side by Side Diff: vm/find_code_object_test.cc

Issue 10082017: Remove code index table. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « vm/disassembler_ia32.cc ('k') | vm/isolate.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"
11 #include "vm/unit_test.h" 11 #include "vm/unit_test.h"
12 12
13 namespace dart { 13 namespace dart {
14 14
15 // Compiler only implemented on IA32 and x64 now. 15 // Compiler only implemented on IA32 and x64 now.
16 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) 16 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64)
17 17
18 TEST_CASE(CodeIndexTable) { 18 TEST_CASE(FindCodeObject) {
19 #if defined(TARGET_ARCH_IA32) 19 #if defined(TARGET_ARCH_IA32)
20 const int kLoopCount = 50000; 20 const int kLoopCount = 50000;
21 #else 21 #else
22 const int kLoopCount = 25000; 22 const int kLoopCount = 25000;
23 #endif 23 #endif
24 const int kScriptSize = 512 * KB; 24 const int kScriptSize = 512 * KB;
25 const int kNumFunctions = 1024; 25 const int kNumFunctions = 1024;
26 char scriptChars[kScriptSize]; 26 char scriptChars[kScriptSize];
27 String& url = String::Handle(String::New("dart-test:CodeIndexTable")); 27 String& url = String::Handle(String::New("dart-test:FincCodeObject"));
srdjan 2012/04/13 20:47:01 Finc -> Find
28 String& source = String::Handle(); 28 String& source = String::Handle();
29 Script& script = Script::Handle(); 29 Script& script = Script::Handle();
30 Library& lib = Library::Handle(); 30 Library& lib = Library::Handle();
31 Class& clsA = Class::Handle(); 31 Class& clsA = Class::Handle();
32 Class& clsB = Class::Handle(); 32 Class& clsB = Class::Handle();
33 String& function_name = String::Handle(); 33 String& function_name = String::Handle();
34 Function& function = Function::Handle(); 34 Function& function = Function::Handle();
35 char buffer[256]; 35 char buffer[256];
36 36
37 // Get access to the code index table. 37 // Get access to the code index table.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 for (int i = 1; i < kNumFunctions; i++) { 92 for (int i = 1; i < kNumFunctions; i++) {
93 OS::SNPrint(buffer, 93 OS::SNPrint(buffer,
94 256, 94 256,
95 "static moo%d([int i=1,int j=2,int k=3]){return i+j+k;}", i); 95 "static moo%d([int i=1,int j=2,int k=3]){return i+j+k;}", i);
96 written += OS::SNPrint((scriptChars + written), 96 written += OS::SNPrint((scriptChars + written),
97 (kScriptSize - written), 97 (kScriptSize - written),
98 "%s", 98 "%s",
99 buffer); 99 buffer);
100 } 100 }
101 OS::SNPrint((scriptChars + written), (kScriptSize - written), "}"); 101 OS::SNPrint((scriptChars + written), (kScriptSize - written), "}");
102 url = String::New("dart-test:CodeIndexTable"); 102 url = String::New("dart-test:FindCodeObject");
103 source = String::New(scriptChars); 103 source = String::New(scriptChars);
104 script = Script::New(url, source, RawScript::kSource); 104 script = Script::New(url, source, RawScript::kSource);
105 EXPECT(CompilerTest::TestCompileScript(lib, script)); 105 EXPECT(CompilerTest::TestCompileScript(lib, script));
106 clsB = lib.LookupClass(String::Handle(String::NewSymbol("B"))); 106 clsB = lib.LookupClass(String::Handle(String::NewSymbol("B")));
107 EXPECT(!clsB.IsNull()); 107 EXPECT(!clsB.IsNull());
108 ClassFinalizer::FinalizePendingClasses(); 108 ClassFinalizer::FinalizePendingClasses();
109 for (int i = 0; i < kNumFunctions; i++) { 109 for (int i = 0; i < kNumFunctions; i++) {
110 OS::SNPrint(buffer, 256, "moo%d", i); 110 OS::SNPrint(buffer, 256, "moo%d", i);
111 function_name = String::New(buffer); 111 function_name = String::New(buffer);
112 function = clsB.LookupStaticFunction(function_name); 112 function = clsB.LookupStaticFunction(function_name);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 EXPECT(code.Size() > PageSpace::kPageSize); 147 EXPECT(code.Size() > PageSpace::kPageSize);
148 EXPECT(StackFrame::LookupCode(isolate, pc) == code.raw()); 148 EXPECT(StackFrame::LookupCode(isolate, pc) == code.raw());
149 EXPECT(code.Size() > (1 * MB)); 149 EXPECT(code.Size() > (1 * MB));
150 pc = code.EntryPoint() + (1 * MB); 150 pc = code.EntryPoint() + (1 * MB);
151 EXPECT(StackFrame::LookupCode(isolate, pc) == code.raw()); 151 EXPECT(StackFrame::LookupCode(isolate, pc) == code.raw());
152 } 152 }
153 153
154 #endif // TARGET_ARCH_IA32 || TARGET_ARCH_X64 154 #endif // TARGET_ARCH_IA32 || TARGET_ARCH_X64
155 155
156 } // namespace dart 156 } // namespace dart
OLDNEW
« no previous file with comments | « vm/disassembler_ia32.cc ('k') | vm/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698