| 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 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) | 16 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) |
| 17 static const int kScriptSize = 512 * KB; | 17 static const int kScriptSize = 512 * KB; |
| 18 static const int kLoopCount = 50000; | 18 static const int kLoopCount = 50000; |
| 19 #elif defined(TARGET_ARCH_DBC) | 19 #elif defined(TARGET_ARCH_DBC) |
| 20 static const int kScriptSize = 1 * MB; | 20 static const int kScriptSize = 1 * MB; |
| 21 static const int kLoopCount = 60000; | 21 static const int kLoopCount = 60000; |
| 22 #else | 22 #else |
| 23 static const int kScriptSize = 512 * KB; | 23 static const int kScriptSize = 512 * KB; |
| 24 static const int kLoopCount = 25000; | 24 static const int kLoopCount = 25000; |
| 25 #endif | 25 #endif |
| 26 static char scriptChars[kScriptSize]; | 26 static char scriptChars[kScriptSize]; |
| 27 | 27 |
| 28 VM_TEST_CASE(FindCodeObject) { | 28 ISOLATE_UNIT_TEST_CASE(FindCodeObject) { |
| 29 const int kNumFunctions = 1024; | 29 const int kNumFunctions = 1024; |
| 30 | 30 |
| 31 // Get access to the code index table. | 31 // Get access to the code index table. |
| 32 Isolate* isolate = Isolate::Current(); | 32 Isolate* isolate = Isolate::Current(); |
| 33 ASSERT(isolate != NULL); | 33 ASSERT(isolate != NULL); |
| 34 | 34 |
| 35 StackZone zone(thread); | 35 StackZone zone(thread); |
| 36 String& url = String::Handle(String::New("dart-test:FindCodeObject")); | 36 String& url = String::Handle(String::New("dart-test:FindCodeObject")); |
| 37 String& source = String::Handle(); | 37 String& source = String::Handle(); |
| 38 Script& script = Script::Handle(); | 38 Script& script = Script::Handle(); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 EXPECT(code.Size() > 16); | 142 EXPECT(code.Size() > 16); |
| 143 pc = code.PayloadStart() + 16; | 143 pc = code.PayloadStart() + 16; |
| 144 EXPECT(code.Size() > (PageSpace::kPageSizeInWords << kWordSizeLog2)); | 144 EXPECT(code.Size() > (PageSpace::kPageSizeInWords << kWordSizeLog2)); |
| 145 EXPECT(Code::LookupCode(pc) == code.raw()); | 145 EXPECT(Code::LookupCode(pc) == code.raw()); |
| 146 EXPECT(code.Size() > (1 * MB)); | 146 EXPECT(code.Size() > (1 * MB)); |
| 147 pc = code.PayloadStart() + (1 * MB); | 147 pc = code.PayloadStart() + (1 * MB); |
| 148 EXPECT(Code::LookupCode(pc) == code.raw()); | 148 EXPECT(Code::LookupCode(pc) == code.raw()); |
| 149 } | 149 } |
| 150 | 150 |
| 151 } // namespace dart | 151 } // namespace dart |
| OLD | NEW |