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

Side by Side Diff: vm/stub_code_ia32_test.cc

Issue 11648006: Create read only handles for empty_array and sentinel objects (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years 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 | « vm/snapshot.cc ('k') | 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 extern const Function& RegisterFakeFunction(const char* name, 63 extern const Function& RegisterFakeFunction(const char* name,
64 const Code& code); 64 const Code& code);
65 const int value1 = 10; 65 const int value1 = 10;
66 const int value2 = 20; 66 const int value2 = 20;
67 const char* kName = "Test_CallRuntimeStubCode"; 67 const char* kName = "Test_CallRuntimeStubCode";
68 Assembler _assembler_; 68 Assembler _assembler_;
69 GenerateCallToCallRuntimeStub(&_assembler_, value1, value2); 69 GenerateCallToCallRuntimeStub(&_assembler_, value1, value2);
70 const Code& code = Code::Handle(Code::FinalizeCode( 70 const Code& code = Code::Handle(Code::FinalizeCode(
71 *CreateFunction("Test_CallRuntimeStubCode"), &_assembler_)); 71 *CreateFunction("Test_CallRuntimeStubCode"), &_assembler_));
72 const Function& function = RegisterFakeFunction(kName, code); 72 const Function& function = RegisterFakeFunction(kName, code);
73 const Array& args = Array::Handle(Object::empty_array());
74 Smi& result = Smi::Handle(); 73 Smi& result = Smi::Handle();
75 result ^= DartEntry::InvokeStatic(function, args); 74 result ^= DartEntry::InvokeStatic(function, Object::empty_array());
76 EXPECT_EQ((value1 - value2), result.Value()); 75 EXPECT_EQ((value1 - value2), result.Value());
77 } 76 }
78 77
79 78
80 // Test calls to stub code which calls into a leaf runtime entry. 79 // Test calls to stub code which calls into a leaf runtime entry.
81 static void GenerateCallToCallLeafRuntimeStub(Assembler* assembler, 80 static void GenerateCallToCallLeafRuntimeStub(Assembler* assembler,
82 int value1, 81 int value1,
83 int value2) { 82 int value2) {
84 const Smi& smi1 = Smi::ZoneHandle(Smi::New(value1)); 83 const Smi& smi1 = Smi::ZoneHandle(Smi::New(value1));
85 const Smi& smi2 = Smi::ZoneHandle(Smi::New(value2)); 84 const Smi& smi2 = Smi::ZoneHandle(Smi::New(value2));
(...skipping 13 matching lines...) Expand all
99 extern const Function& RegisterFakeFunction(const char* name, 98 extern const Function& RegisterFakeFunction(const char* name,
100 const Code& code); 99 const Code& code);
101 const int value1 = 10; 100 const int value1 = 10;
102 const int value2 = 20; 101 const int value2 = 20;
103 const char* kName = "Test_CallLeafRuntimeStubCode"; 102 const char* kName = "Test_CallLeafRuntimeStubCode";
104 Assembler _assembler_; 103 Assembler _assembler_;
105 GenerateCallToCallLeafRuntimeStub(&_assembler_, value1, value2); 104 GenerateCallToCallLeafRuntimeStub(&_assembler_, value1, value2);
106 const Code& code = Code::Handle(Code::FinalizeCode( 105 const Code& code = Code::Handle(Code::FinalizeCode(
107 *CreateFunction("Test_CallLeafRuntimeStubCode"), &_assembler_)); 106 *CreateFunction("Test_CallLeafRuntimeStubCode"), &_assembler_));
108 const Function& function = RegisterFakeFunction(kName, code); 107 const Function& function = RegisterFakeFunction(kName, code);
109 const Array& args = Array::Handle(Object::empty_array());
110 Smi& result = Smi::Handle(); 108 Smi& result = Smi::Handle();
111 result ^= DartEntry::InvokeStatic(function, args); 109 result ^= DartEntry::InvokeStatic(function, Object::empty_array());
112 EXPECT_EQ((value1 + value2), result.Value()); 110 EXPECT_EQ((value1 + value2), result.Value());
113 } 111 }
114 112
115 } // namespace dart 113 } // namespace dart
116 114
117 #endif // defined TARGET_ARCH_IA32 115 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « vm/snapshot.cc ('k') | vm/stub_code_x64_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698