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

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

Issue 363093004: Use Object::null_object() instead of Object::ZoneHandle() when a null object (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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/stub_code_arm_test.cc ('k') | runtime/vm/stub_code_mips_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 26 matching lines...) Expand all
37 return &function; 37 return &function;
38 } 38 }
39 39
40 40
41 // Test calls to stub code which calls into the runtime. 41 // Test calls to stub code which calls into the runtime.
42 static void GenerateCallToCallRuntimeStub(Assembler* assembler, 42 static void GenerateCallToCallRuntimeStub(Assembler* assembler,
43 int value1, int value2) { 43 int value1, int value2) {
44 const int argc = 2; 44 const int argc = 2;
45 const Smi& smi1 = Smi::ZoneHandle(Smi::New(value1)); 45 const Smi& smi1 = Smi::ZoneHandle(Smi::New(value1));
46 const Smi& smi2 = Smi::ZoneHandle(Smi::New(value2)); 46 const Smi& smi2 = Smi::ZoneHandle(Smi::New(value2));
47 const Object& result = Object::ZoneHandle();
48 const Context& context = Context::ZoneHandle(Context::New(0, Heap::kOld)); 47 const Context& context = Context::ZoneHandle(Context::New(0, Heap::kOld));
49 ASSERT(context.isolate() == Isolate::Current()); 48 ASSERT(context.isolate() == Isolate::Current());
50 __ enter(Immediate(0)); 49 __ enter(Immediate(0));
51 __ LoadObject(CTX, context); 50 __ LoadObject(CTX, context);
52 __ PushObject(result); // Push Null object for return value. 51 __ PushObject(Object::null_object()); // Push Null object for return value.
53 __ PushObject(smi1); // Push argument 1 smi1. 52 __ PushObject(smi1); // Push argument 1 smi1.
54 __ PushObject(smi2); // Push argument 2 smi2. 53 __ PushObject(smi2); // Push argument 2 smi2.
55 ASSERT(kTestSmiSubRuntimeEntry.argument_count() == argc); 54 ASSERT(kTestSmiSubRuntimeEntry.argument_count() == argc);
56 __ CallRuntime(kTestSmiSubRuntimeEntry, argc); // Call SmiSub runtime func. 55 __ CallRuntime(kTestSmiSubRuntimeEntry, argc); // Call SmiSub runtime func.
57 __ AddImmediate(ESP, Immediate(argc * kWordSize)); 56 __ AddImmediate(ESP, Immediate(argc * kWordSize));
58 __ popl(EAX); // Pop return value from return slot. 57 __ popl(EAX); // Pop return value from return slot.
59 __ leave(); 58 __ leave();
60 __ ret(); 59 __ ret();
61 } 60 }
62 61
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 *CreateFunction("Test_CallLeafRuntimeStubCode"), &_assembler_)); 107 *CreateFunction("Test_CallLeafRuntimeStubCode"), &_assembler_));
109 const Function& function = RegisterFakeFunction(kName, code); 108 const Function& function = RegisterFakeFunction(kName, code);
110 Smi& result = Smi::Handle(); 109 Smi& result = Smi::Handle();
111 result ^= DartEntry::InvokeFunction(function, Object::empty_array()); 110 result ^= DartEntry::InvokeFunction(function, Object::empty_array());
112 EXPECT_EQ((value1 + value2), result.Value()); 111 EXPECT_EQ((value1 + value2), result.Value());
113 } 112 }
114 113
115 } // namespace dart 114 } // namespace dart
116 115
117 #endif // defined TARGET_ARCH_IA32 116 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/stub_code_arm_test.cc ('k') | runtime/vm/stub_code_mips_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698