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

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

Issue 13474009: Implements optional parameter handling in MIPS vm. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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
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/symbols.h" 11 #include "vm/symbols.h"
12 #include "vm/unit_test.h" 12 #include "vm/unit_test.h"
13 13
14 namespace dart { 14 namespace dart {
15 15
16 // Compiler only implemented on IA32, X64, and ARM.
17 #if defined(TARGET_ARCH_IA32) || \
18 defined(TARGET_ARCH_X64) || \
19 defined(TARGET_ARCH_ARM)
20
21 TEST_CASE(FindCodeObject) { 16 TEST_CASE(FindCodeObject) {
22 #if defined(TARGET_ARCH_IA32) 17 #if defined(TARGET_ARCH_IA32)
23 const int kLoopCount = 50000; 18 const int kLoopCount = 50000;
24 #elif defined(TARGET_ARCH_X64) 19 #elif defined(TARGET_ARCH_X64)
25 const int kLoopCount = 25000; 20 const int kLoopCount = 25000;
21 #elif defined(TARGET_ARCH_MIPS)
22 const int kLoopCount = 1818;
regis 2013/04/03 21:12:39 I would add a TODO(zra): Increase this count once
zra 2013/04/03 21:41:00 Done.
26 #else 23 #else
27 const int kLoopCount = 20000; 24 const int kLoopCount = 20000;
28 #endif 25 #endif
29 const int kScriptSize = 512 * KB; 26 const int kScriptSize = 512 * KB;
30 const int kNumFunctions = 1024; 27 const int kNumFunctions = 1024;
31 char scriptChars[kScriptSize]; 28 char scriptChars[kScriptSize];
32 String& url = String::Handle(String::New("dart-test:FindCodeObject")); 29 String& url = String::Handle(String::New("dart-test:FindCodeObject"));
33 String& source = String::Handle(); 30 String& source = String::Handle();
34 Script& script = Script::Handle(); 31 Script& script = Script::Handle();
35 Library& lib = Library::Handle(); 32 Library& lib = Library::Handle();
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 EXPECT(Code::LookupCode(pc) == code.raw()); 139 EXPECT(Code::LookupCode(pc) == code.raw());
143 140
144 // Lookup the large function 141 // Lookup the large function
145 OS::SNPrint(buffer, 256, "moo%d", 0); 142 OS::SNPrint(buffer, 256, "moo%d", 0);
146 function_name = String::New(buffer); 143 function_name = String::New(buffer);
147 function = clsB.LookupStaticFunction(function_name); 144 function = clsB.LookupStaticFunction(function_name);
148 EXPECT(!function.IsNull()); 145 EXPECT(!function.IsNull());
149 code = function.CurrentCode(); 146 code = function.CurrentCode();
150 EXPECT(code.Size() > 16); 147 EXPECT(code.Size() > 16);
151 pc = code.EntryPoint() + 16; 148 pc = code.EntryPoint() + 16;
149 #if defined(TARGET_ARCH_MIPS)
150 // MIPS can only Branch +/- 128KB
151 EXPECT(code.Size() > (PageSpace::kPageSize / 2));
152 EXPECT(Code::LookupCode(pc) == code.raw());
153 pc = code.EntryPoint() + (PageSpace::kPageSize / 4);
154 EXPECT(Code::LookupCode(pc) == code.raw());
155 #else
152 EXPECT(code.Size() > PageSpace::kPageSize); 156 EXPECT(code.Size() > PageSpace::kPageSize);
153 EXPECT(Code::LookupCode(pc) == code.raw()); 157 EXPECT(Code::LookupCode(pc) == code.raw());
154 EXPECT(code.Size() > (1 * MB)); 158 EXPECT(code.Size() > (1 * MB));
155 pc = code.EntryPoint() + (1 * MB); 159 pc = code.EntryPoint() + (1 * MB);
156 EXPECT(Code::LookupCode(pc) == code.raw()); 160 EXPECT(Code::LookupCode(pc) == code.raw());
161 #endif // defined(TARGET_ARCH_MIPS)
157 } 162 }
158 163
159 #endif // TARGET_ARCH_IA32 || TARGET_ARCH_X64 || TARGET_ARCH_ARM
160
161 } // namespace dart 164 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698