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

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

Issue 14273015: Implements exception handler stub on MIPS. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 8 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/object_mips_test.cc ('k') | runtime/vm/stub_code_mips.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) 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/assembler.h" 6 #include "vm/assembler.h"
7 #include "vm/bigint_operations.h" 7 #include "vm/bigint_operations.h"
8 #include "vm/class_finalizer.h" 8 #include "vm/class_finalizer.h"
9 #include "vm/isolate.h" 9 #include "vm/isolate.h"
10 #include "vm/object.h" 10 #include "vm/object.h"
(...skipping 2219 matching lines...) Expand 10 before | Expand all | Expand 10 after
2230 EXPECT(!str3.IsOneByteString()); 2230 EXPECT(!str3.IsOneByteString());
2231 str3 = String::New("Steep and Deep!"); 2231 str3 = String::New("Steep and Deep!");
2232 EXPECT(str3.IsString()); 2232 EXPECT(str3.IsString());
2233 EXPECT(str3.IsOneByteString()); 2233 EXPECT(str3.IsOneByteString());
2234 str3 = OneByteString::null(); 2234 str3 = OneByteString::null();
2235 EXPECT(str3.IsString()); 2235 EXPECT(str3.IsString());
2236 EXPECT(!str3.IsOneByteString()); 2236 EXPECT(!str3.IsOneByteString());
2237 } 2237 }
2238 2238
2239 2239
2240 // Only ia32, x64, and arm can run execution tests.
2241 #if defined(TARGET_ARCH_IA32) || \
2242 defined(TARGET_ARCH_X64) || \
2243 defined(TARGET_ARCH_ARM)
2244
2245 static Function* CreateFunction(const char* name) { 2240 static Function* CreateFunction(const char* name) {
2246 const String& class_name = String::Handle(Symbols::New("ownerClass")); 2241 const String& class_name = String::Handle(Symbols::New("ownerClass"));
2247 const Script& script = Script::Handle(); 2242 const Script& script = Script::Handle();
2248 const Class& owner_class = 2243 const Class& owner_class =
2249 Class::Handle(Class::New(class_name, script, Scanner::kDummyTokenIndex)); 2244 Class::Handle(Class::New(class_name, script, Scanner::kDummyTokenIndex));
2250 const String& function_name = String::ZoneHandle(Symbols::New(name)); 2245 const String& function_name = String::ZoneHandle(Symbols::New(name));
2251 Function& function = Function::ZoneHandle( 2246 Function& function = Function::ZoneHandle(
2252 Function::New(function_name, RawFunction::kRegularFunction, 2247 Function::New(function_name, RawFunction::kRegularFunction,
2253 true, false, false, false, owner_class, 0)); 2248 true, false, false, false, owner_class, 0));
2254 return &function; 2249 return &function;
2255 } 2250 }
2256 2251
2252
2257 // Test for Code and Instruction object creation. 2253 // Test for Code and Instruction object creation.
2258 TEST_CASE(Code) { 2254 TEST_CASE(Code) {
2259 extern void GenerateIncrement(Assembler* assembler); 2255 extern void GenerateIncrement(Assembler* assembler);
2260 Assembler _assembler_; 2256 Assembler _assembler_;
2261 GenerateIncrement(&_assembler_); 2257 GenerateIncrement(&_assembler_);
2262 Code& code = Code::Handle(Code::FinalizeCode( 2258 Code& code = Code::Handle(Code::FinalizeCode(
2263 *CreateFunction("Test_Code"), &_assembler_)); 2259 *CreateFunction("Test_Code"), &_assembler_));
2264 Instructions& instructions = Instructions::Handle(code.instructions()); 2260 Instructions& instructions = Instructions::Handle(code.instructions());
2265 uword entry_point = instructions.EntryPoint(); 2261 uword entry_point = instructions.EntryPoint();
2266 intptr_t retval = 0; 2262 intptr_t retval = 0;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
2338 intptr_t retval = 0; 2334 intptr_t retval = 0;
2339 #if defined(USING_SIMULATOR) 2335 #if defined(USING_SIMULATOR)
2340 retval = bit_copy<intptr_t, int64_t>(Simulator::Current()->Call( 2336 retval = bit_copy<intptr_t, int64_t>(Simulator::Current()->Call(
2341 static_cast<int32_t>(instructions.EntryPoint()), 0, 0, 0, 0)); 2337 static_cast<int32_t>(instructions.EntryPoint()), 0, 0, 0, 0));
2342 #else 2338 #else
2343 typedef intptr_t (*EmbedSmiCode)(); 2339 typedef intptr_t (*EmbedSmiCode)();
2344 retval = reinterpret_cast<EmbedSmiCode>(instructions.EntryPoint())(); 2340 retval = reinterpret_cast<EmbedSmiCode>(instructions.EntryPoint())();
2345 #endif 2341 #endif
2346 EXPECT((retval >> kSmiTagShift) == kSmiTestValue); 2342 EXPECT((retval >> kSmiTagShift) == kSmiTestValue);
2347 } 2343 }
2348 #endif
2349 2344
2350 2345
2351 TEST_CASE(ExceptionHandlers) { 2346 TEST_CASE(ExceptionHandlers) {
2352 const int kNumEntries = 4; 2347 const int kNumEntries = 4;
2353 // Add an exception handler table to the code. 2348 // Add an exception handler table to the code.
2354 ExceptionHandlers& exception_handlers = ExceptionHandlers::Handle(); 2349 ExceptionHandlers& exception_handlers = ExceptionHandlers::Handle();
2355 exception_handlers ^= ExceptionHandlers::New(kNumEntries); 2350 exception_handlers ^= ExceptionHandlers::New(kNumEntries);
2356 exception_handlers.SetHandlerInfo(0, -1, 20); 2351 exception_handlers.SetHandlerInfo(0, -1, 20);
2357 exception_handlers.SetHandlerInfo(1, 0, 30); 2352 exception_handlers.SetHandlerInfo(1, 0, 30);
2358 exception_handlers.SetHandlerInfo(2, -1, 40); 2353 exception_handlers.SetHandlerInfo(2, -1, 40);
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after
3204 EXPECT_NE(test1.SourceFingerprint(), test3.SourceFingerprint()); 3199 EXPECT_NE(test1.SourceFingerprint(), test3.SourceFingerprint());
3205 EXPECT_NE(test3.SourceFingerprint(), test4.SourceFingerprint()); 3200 EXPECT_NE(test3.SourceFingerprint(), test4.SourceFingerprint());
3206 EXPECT_NE(test4.SourceFingerprint(), test5.SourceFingerprint()); 3201 EXPECT_NE(test4.SourceFingerprint(), test5.SourceFingerprint());
3207 EXPECT_NE(test5.SourceFingerprint(), test6.SourceFingerprint()); 3202 EXPECT_NE(test5.SourceFingerprint(), test6.SourceFingerprint());
3208 EXPECT_EQ(test6.SourceFingerprint(), test7.SourceFingerprint()); 3203 EXPECT_EQ(test6.SourceFingerprint(), test7.SourceFingerprint());
3209 } 3204 }
3210 3205
3211 #endif // TARGET_ARCH_IA32 || TARGET_ARCH_X64 || TARGET_ARCH_ARM 3206 #endif // TARGET_ARCH_IA32 || TARGET_ARCH_X64 || TARGET_ARCH_ARM
3212 3207
3213 } // namespace dart 3208 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object_mips_test.cc ('k') | runtime/vm/stub_code_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698