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

Side by Side Diff: vm/find_code_object_test.cc

Issue 10375059: Use a reserved stack local variable to store the Code object so that it can be looked up easily whe… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 7 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"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 // Now try and access these functions using the code index table. 118 // Now try and access these functions using the code index table.
119 Code& code = Code::Handle(); 119 Code& code = Code::Handle();
120 uword pc; 120 uword pc;
121 OS::SNPrint(buffer, 256, "foo%d", 123); 121 OS::SNPrint(buffer, 256, "foo%d", 123);
122 function_name = String::New(buffer); 122 function_name = String::New(buffer);
123 function = clsA.LookupStaticFunction(function_name); 123 function = clsA.LookupStaticFunction(function_name);
124 EXPECT(!function.IsNull()); 124 EXPECT(!function.IsNull());
125 code = function.CurrentCode(); 125 code = function.CurrentCode();
126 EXPECT(code.Size() > 16); 126 EXPECT(code.Size() > 16);
127 pc = code.EntryPoint() + 16; 127 pc = code.EntryPoint() + 16;
128 EXPECT(StackFrame::LookupCode(isolate, pc) == code.raw()); 128 EXPECT(Code::LookupCode(pc) == code.raw());
129 129
130 OS::SNPrint(buffer, 256, "moo%d", 54); 130 OS::SNPrint(buffer, 256, "moo%d", 54);
131 function_name = String::New(buffer); 131 function_name = String::New(buffer);
132 function = clsB.LookupStaticFunction(function_name); 132 function = clsB.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.EntryPoint() + 16;
137 EXPECT(StackFrame::LookupCode(isolate, pc) == code.raw()); 137 EXPECT(Code::LookupCode(pc) == code.raw());
138 138
139 // Lookup the large function 139 // Lookup the large function
140 OS::SNPrint(buffer, 256, "moo%d", 0); 140 OS::SNPrint(buffer, 256, "moo%d", 0);
141 function_name = String::New(buffer); 141 function_name = String::New(buffer);
142 function = clsB.LookupStaticFunction(function_name); 142 function = clsB.LookupStaticFunction(function_name);
143 EXPECT(!function.IsNull()); 143 EXPECT(!function.IsNull());
144 code = function.CurrentCode(); 144 code = function.CurrentCode();
145 EXPECT(code.Size() > 16); 145 EXPECT(code.Size() > 16);
146 pc = code.EntryPoint() + 16; 146 pc = code.EntryPoint() + 16;
147 EXPECT(code.Size() > PageSpace::kPageSize); 147 EXPECT(code.Size() > PageSpace::kPageSize);
148 EXPECT(StackFrame::LookupCode(isolate, pc) == code.raw()); 148 EXPECT(Code::LookupCode(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(Code::LookupCode(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

Powered by Google App Engine
This is Rietveld 408576698