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

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

Issue 10786003: Ensure objects emitted in code are allocated in old space. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: address review comments Created 8 years, 5 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
« no previous file with comments | « runtime/vm/parser.cc ('k') | runtime/vm/stub_code_x64_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 "vm/globals.h" 5 #include "vm/globals.h"
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
7 7
8 #include "vm/isolate.h" 8 #include "vm/isolate.h"
9 #include "vm/dart_entry.h" 9 #include "vm/dart_entry.h"
10 #include "vm/native_entry.h" 10 #include "vm/native_entry.h"
(...skipping 18 matching lines...) Expand all
29 return &function; 29 return &function;
30 } 30 }
31 31
32 // Test calls to stub code which calls into the runtime. 32 // Test calls to stub code which calls into the runtime.
33 static void GenerateCallToCallRuntimeStub(Assembler* assembler, 33 static void GenerateCallToCallRuntimeStub(Assembler* assembler,
34 int value1, int value2) { 34 int value1, int value2) {
35 const int argc = 2; 35 const int argc = 2;
36 const Smi& smi1 = Smi::ZoneHandle(Smi::New(value1)); 36 const Smi& smi1 = Smi::ZoneHandle(Smi::New(value1));
37 const Smi& smi2 = Smi::ZoneHandle(Smi::New(value2)); 37 const Smi& smi2 = Smi::ZoneHandle(Smi::New(value2));
38 const Object& result = Object::ZoneHandle(); 38 const Object& result = Object::ZoneHandle();
39 const Context& context = Context::ZoneHandle(Context::New(0)); 39 const Context& context = Context::ZoneHandle(Context::New(0, Heap::kOld));
40 ASSERT(context.isolate() == Isolate::Current()); 40 ASSERT(context.isolate() == Isolate::Current());
41 __ enter(Immediate(0)); 41 __ enter(Immediate(0));
42 __ LoadObject(CTX, context); 42 __ LoadObject(CTX, context);
43 __ PushObject(result); // Push Null object for return value. 43 __ PushObject(result); // Push Null object for return value.
44 __ PushObject(smi1); // Push argument 1 smi1. 44 __ PushObject(smi1); // Push argument 1 smi1.
45 __ PushObject(smi2); // Push argument 2 smi2. 45 __ PushObject(smi2); // Push argument 2 smi2.
46 ASSERT(kTestSmiSubRuntimeEntry.argument_count() == argc); 46 ASSERT(kTestSmiSubRuntimeEntry.argument_count() == argc);
47 __ CallRuntime(kTestSmiSubRuntimeEntry); // Call SmiSub runtime func. 47 __ CallRuntime(kTestSmiSubRuntimeEntry); // Call SmiSub runtime func.
48 __ AddImmediate(ESP, Immediate(argc * kWordSize)); 48 __ AddImmediate(ESP, Immediate(argc * kWordSize));
49 __ popl(EAX); // Pop return value from return slot. 49 __ popl(EAX); // Pop return value from return slot.
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 static void GenerateCallToCallNativeCFunctionStub(Assembler* assembler, 112 static void GenerateCallToCallNativeCFunctionStub(Assembler* assembler,
113 int value1, int value2) { 113 int value1, int value2) {
114 const int argc = 2; 114 const int argc = 2;
115 const Smi& smi1 = Smi::ZoneHandle(Smi::New(value1)); 115 const Smi& smi1 = Smi::ZoneHandle(Smi::New(value1));
116 const Smi& smi2 = Smi::ZoneHandle(Smi::New(value2)); 116 const Smi& smi2 = Smi::ZoneHandle(Smi::New(value2));
117 const Object& result = Object::ZoneHandle(); 117 const Object& result = Object::ZoneHandle();
118 const String& native_name = String::ZoneHandle(String::New("TestSmiSub")); 118 const String& native_name = String::ZoneHandle(String::New("TestSmiSub"));
119 Dart_NativeFunction native_function = 119 Dart_NativeFunction native_function =
120 NativeTestEntry_Lookup(native_name, argc); 120 NativeTestEntry_Lookup(native_name, argc);
121 ASSERT(native_function != NULL); 121 ASSERT(native_function != NULL);
122 const Context& context = Context::ZoneHandle(Context::New(0)); 122 const Context& context = Context::ZoneHandle(Context::New(0, Heap::kOld));
123 ASSERT(context.isolate() == Isolate::Current()); 123 ASSERT(context.isolate() == Isolate::Current());
124 __ enter(Immediate(0)); 124 __ enter(Immediate(0));
125 __ LoadObject(CTX, context); 125 __ LoadObject(CTX, context);
126 __ PushObject(smi1); // Push argument 1 smi1. 126 __ PushObject(smi1); // Push argument 1 smi1.
127 __ PushObject(smi2); // Push argument 2 smi2. 127 __ PushObject(smi2); // Push argument 2 smi2.
128 __ PushObject(result); // Push Null object for return value. 128 __ PushObject(result); // Push Null object for return value.
129 // Pass a pointer to the first argument in EAX. 129 // Pass a pointer to the first argument in EAX.
130 __ leal(EAX, Address(ESP, 2 * kWordSize)); 130 __ leal(EAX, Address(ESP, 2 * kWordSize));
131 __ movl(ECX, Immediate(reinterpret_cast<uword>(native_function))); 131 __ movl(ECX, Immediate(reinterpret_cast<uword>(native_function)));
132 __ movl(EDX, Immediate(argc)); 132 __ movl(EDX, Immediate(argc));
(...skipping 19 matching lines...) Expand all
152 GrowableArray<const Object*> arguments; 152 GrowableArray<const Object*> arguments;
153 const Array& kNoArgumentNames = Array::Handle(); 153 const Array& kNoArgumentNames = Array::Handle();
154 Smi& result = Smi::Handle(); 154 Smi& result = Smi::Handle();
155 result ^= DartEntry::InvokeStatic(function, arguments, kNoArgumentNames); 155 result ^= DartEntry::InvokeStatic(function, arguments, kNoArgumentNames);
156 EXPECT_EQ((value1 - value2), result.Value()); 156 EXPECT_EQ((value1 - value2), result.Value());
157 } 157 }
158 158
159 } // namespace dart 159 } // namespace dart
160 160
161 #endif // defined TARGET_ARCH_IA32 161 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/parser.cc ('k') | runtime/vm/stub_code_x64_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698