| OLD | NEW |
| 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 and x64 now. | 16 // Compiler only implemented on IA32, X64, and ARM. |
| 17 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) | 17 #if defined(TARGET_ARCH_IA32) || \ |
| 18 defined(TARGET_ARCH_X64) || \ |
| 19 defined(TARGET_ARCH_ARM) |
| 18 | 20 |
| 19 TEST_CASE(FindCodeObject) { | 21 TEST_CASE(FindCodeObject) { |
| 20 #if defined(TARGET_ARCH_IA32) | 22 #if defined(TARGET_ARCH_IA32) |
| 21 const int kLoopCount = 50000; | 23 const int kLoopCount = 50000; |
| 24 #elif defined(TARGET_ARCH_X64) |
| 25 const int kLoopCount = 25000; |
| 22 #else | 26 #else |
| 23 const int kLoopCount = 25000; | 27 const int kLoopCount = 20000; |
| 24 #endif | 28 #endif |
| 25 const int kScriptSize = 512 * KB; | 29 const int kScriptSize = 512 * KB; |
| 26 const int kNumFunctions = 1024; | 30 const int kNumFunctions = 1024; |
| 27 char scriptChars[kScriptSize]; | 31 char scriptChars[kScriptSize]; |
| 28 String& url = String::Handle(String::New("dart-test:FincCodeObject")); | 32 String& url = String::Handle(String::New("dart-test:FindCodeObject")); |
| 29 String& source = String::Handle(); | 33 String& source = String::Handle(); |
| 30 Script& script = Script::Handle(); | 34 Script& script = Script::Handle(); |
| 31 Library& lib = Library::Handle(); | 35 Library& lib = Library::Handle(); |
| 32 Class& clsA = Class::Handle(); | 36 Class& clsA = Class::Handle(); |
| 33 Class& clsB = Class::Handle(); | 37 Class& clsB = Class::Handle(); |
| 34 String& function_name = String::Handle(); | 38 String& function_name = String::Handle(); |
| 35 Function& function = Function::Handle(); | 39 Function& function = Function::Handle(); |
| 36 char buffer[256]; | 40 char buffer[256]; |
| 37 | 41 |
| 38 // Get access to the code index table. | 42 // Get access to the code index table. |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 code = function.CurrentCode(); | 149 code = function.CurrentCode(); |
| 146 EXPECT(code.Size() > 16); | 150 EXPECT(code.Size() > 16); |
| 147 pc = code.EntryPoint() + 16; | 151 pc = code.EntryPoint() + 16; |
| 148 EXPECT(code.Size() > PageSpace::kPageSize); | 152 EXPECT(code.Size() > PageSpace::kPageSize); |
| 149 EXPECT(Code::LookupCode(pc) == code.raw()); | 153 EXPECT(Code::LookupCode(pc) == code.raw()); |
| 150 EXPECT(code.Size() > (1 * MB)); | 154 EXPECT(code.Size() > (1 * MB)); |
| 151 pc = code.EntryPoint() + (1 * MB); | 155 pc = code.EntryPoint() + (1 * MB); |
| 152 EXPECT(Code::LookupCode(pc) == code.raw()); | 156 EXPECT(Code::LookupCode(pc) == code.raw()); |
| 153 } | 157 } |
| 154 | 158 |
| 155 #endif // TARGET_ARCH_IA32 || TARGET_ARCH_X64 | 159 #endif // TARGET_ARCH_IA32 || TARGET_ARCH_X64 || TARGET_ARCH_ARM |
| 156 | 160 |
| 157 } // namespace dart | 161 } // namespace dart |
| OLD | NEW |