| 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" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 | 126 |
| 127 // Now try and access these functions using the code index table. | 127 // Now try and access these functions using the code index table. |
| 128 Code& code = Code::Handle(); | 128 Code& code = Code::Handle(); |
| 129 uword pc; | 129 uword pc; |
| 130 OS::SNPrint(buffer, 256, "foo%d", 123); | 130 OS::SNPrint(buffer, 256, "foo%d", 123); |
| 131 function_name = String::New(buffer); | 131 function_name = String::New(buffer); |
| 132 function = clsA.LookupStaticFunction(function_name); | 132 function = clsA.LookupStaticFunction(function_name); |
| 133 EXPECT(!function.IsNull()); | 133 EXPECT(!function.IsNull()); |
| 134 code = function.CurrentCode(); | 134 code = function.CurrentCode(); |
| 135 EXPECT(code.Size() > 16); | 135 EXPECT(code.Size() > 16); |
| 136 pc = code.EntryPoint() + 16; | 136 pc = code.PayloadStart() + 16; |
| 137 EXPECT(Code::LookupCode(pc) == code.raw()); | 137 EXPECT(Code::LookupCode(pc) == code.raw()); |
| 138 | 138 |
| 139 OS::SNPrint(buffer, 256, "moo%d", 54); | 139 OS::SNPrint(buffer, 256, "moo%d", 54); |
| 140 function_name = String::New(buffer); | 140 function_name = String::New(buffer); |
| 141 function = clsB.LookupStaticFunction(function_name); | 141 function = clsB.LookupStaticFunction(function_name); |
| 142 EXPECT(!function.IsNull()); | 142 EXPECT(!function.IsNull()); |
| 143 code = function.CurrentCode(); | 143 code = function.CurrentCode(); |
| 144 EXPECT(code.Size() > 16); | 144 EXPECT(code.Size() > 16); |
| 145 pc = code.EntryPoint() + 16; | 145 pc = code.PayloadStart() + 16; |
| 146 EXPECT(Code::LookupCode(pc) == code.raw()); | 146 EXPECT(Code::LookupCode(pc) == code.raw()); |
| 147 | 147 |
| 148 // Lookup the large function | 148 // Lookup the large function |
| 149 OS::SNPrint(buffer, 256, "moo%d", 0); | 149 OS::SNPrint(buffer, 256, "moo%d", 0); |
| 150 function_name = String::New(buffer); | 150 function_name = String::New(buffer); |
| 151 function = clsB.LookupStaticFunction(function_name); | 151 function = clsB.LookupStaticFunction(function_name); |
| 152 EXPECT(!function.IsNull()); | 152 EXPECT(!function.IsNull()); |
| 153 code = function.CurrentCode(); | 153 code = function.CurrentCode(); |
| 154 EXPECT(code.Size() > 16); | 154 EXPECT(code.Size() > 16); |
| 155 pc = code.EntryPoint() + 16; | 155 pc = code.PayloadStart() + 16; |
| 156 EXPECT(code.Size() > (PageSpace::kPageSizeInWords << kWordSizeLog2)); | 156 EXPECT(code.Size() > (PageSpace::kPageSizeInWords << kWordSizeLog2)); |
| 157 EXPECT(Code::LookupCode(pc) == code.raw()); | 157 EXPECT(Code::LookupCode(pc) == code.raw()); |
| 158 EXPECT(code.Size() > (1 * MB)); | 158 EXPECT(code.Size() > (1 * MB)); |
| 159 pc = code.EntryPoint() + (1 * MB); | 159 pc = code.PayloadStart() + (1 * MB); |
| 160 EXPECT(Code::LookupCode(pc) == code.raw()); | 160 EXPECT(Code::LookupCode(pc) == code.raw()); |
| 161 } | 161 } |
| 162 | 162 |
| 163 } // namespace dart | 163 } // namespace dart |
| OLD | NEW |