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

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

Issue 23531008: Last round of cleanups in exception handler, before going to the next stage. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 3 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 "vm/assembler.h" 5 #include "vm/assembler.h"
6 #include "vm/bigint_operations.h" 6 #include "vm/bigint_operations.h"
7 #include "vm/class_finalizer.h" 7 #include "vm/class_finalizer.h"
8 #include "vm/dart_api_impl.h" 8 #include "vm/dart_api_impl.h"
9 #include "vm/dart_entry.h" 9 #include "vm/dart_entry.h"
10 #include "vm/isolate.h" 10 #include "vm/isolate.h"
(...skipping 2369 matching lines...) Expand 10 before | Expand all | Expand 10 after
2380 #endif // ARCH_IS_64_BIT 2380 #endif // ARCH_IS_64_BIT
2381 2381
2382 2382
2383 TEST_CASE(ExceptionHandlers) { 2383 TEST_CASE(ExceptionHandlers) {
2384 const int kNumEntries = 4; 2384 const int kNumEntries = 4;
2385 // Add an exception handler table to the code. 2385 // Add an exception handler table to the code.
2386 ExceptionHandlers& exception_handlers = ExceptionHandlers::Handle(); 2386 ExceptionHandlers& exception_handlers = ExceptionHandlers::Handle();
2387 exception_handlers ^= ExceptionHandlers::New(kNumEntries); 2387 exception_handlers ^= ExceptionHandlers::New(kNumEntries);
2388 const bool kNeedsStacktrace = true; 2388 const bool kNeedsStacktrace = true;
2389 const bool kNoStacktrace = false; 2389 const bool kNoStacktrace = false;
2390 exception_handlers.SetHandlerInfo(0, -1, 20, kNeedsStacktrace); 2390 exception_handlers.SetHandlerInfo(0, -1, 20, kNeedsStacktrace, false);
2391 exception_handlers.SetHandlerInfo(1, 0, 30, kNeedsStacktrace); 2391 exception_handlers.SetHandlerInfo(1, 0, 30, kNeedsStacktrace, false);
2392 exception_handlers.SetHandlerInfo(2, -1, 40, kNoStacktrace); 2392 exception_handlers.SetHandlerInfo(2, -1, 40, kNoStacktrace, true);
2393 exception_handlers.SetHandlerInfo(3, 1, 150, kNoStacktrace); 2393 exception_handlers.SetHandlerInfo(3, 1, 150, kNoStacktrace, true);
2394 2394
2395 extern void GenerateIncrement(Assembler* assembler); 2395 extern void GenerateIncrement(Assembler* assembler);
2396 Assembler _assembler_; 2396 Assembler _assembler_;
2397 GenerateIncrement(&_assembler_); 2397 GenerateIncrement(&_assembler_);
2398 Code& code = Code::Handle(Code::FinalizeCode( 2398 Code& code = Code::Handle(Code::FinalizeCode(
2399 *CreateFunction("Test_Code"), &_assembler_)); 2399 *CreateFunction("Test_Code"), &_assembler_));
2400 code.set_exception_handlers(exception_handlers); 2400 code.set_exception_handlers(exception_handlers);
2401 2401
2402 // Verify the exception handler table entries by accessing them. 2402 // Verify the exception handler table entries by accessing them.
2403 const ExceptionHandlers& handlers = 2403 const ExceptionHandlers& handlers =
2404 ExceptionHandlers::Handle(code.exception_handlers()); 2404 ExceptionHandlers::Handle(code.exception_handlers());
2405 EXPECT_EQ(kNumEntries, handlers.Length()); 2405 EXPECT_EQ(kNumEntries, handlers.Length());
2406 RawExceptionHandlers::HandlerInfo info; 2406 RawExceptionHandlers::HandlerInfo info;
2407 handlers.GetHandlerInfo(0, &info); 2407 handlers.GetHandlerInfo(0, &info);
2408 EXPECT_EQ(-1, handlers.OuterTryIndex(0)); 2408 EXPECT_EQ(-1, handlers.OuterTryIndex(0));
2409 EXPECT_EQ(-1, info.outer_try_index); 2409 EXPECT_EQ(-1, info.outer_try_index);
2410 EXPECT_EQ(20, handlers.HandlerPC(0)); 2410 EXPECT_EQ(20, handlers.HandlerPC(0));
2411 EXPECT(handlers.NeedsStacktrace(0)); 2411 EXPECT(handlers.NeedsStacktrace(0));
2412 EXPECT(!handlers.HasCatchAll(0));
2412 EXPECT_EQ(20, info.handler_pc); 2413 EXPECT_EQ(20, info.handler_pc);
2413 EXPECT_EQ(1, handlers.OuterTryIndex(3)); 2414 EXPECT_EQ(1, handlers.OuterTryIndex(3));
2414 EXPECT_EQ(150, handlers.HandlerPC(3)); 2415 EXPECT_EQ(150, handlers.HandlerPC(3));
2415 EXPECT(!handlers.NeedsStacktrace(3)); 2416 EXPECT(!handlers.NeedsStacktrace(3));
2417 EXPECT(handlers.HasCatchAll(3));
2416 } 2418 }
2417 2419
2418 2420
2419 TEST_CASE(PcDescriptors) { 2421 TEST_CASE(PcDescriptors) {
2420 const int kNumEntries = 6; 2422 const int kNumEntries = 6;
2421 // Add PcDescriptors to the code. 2423 // Add PcDescriptors to the code.
2422 PcDescriptors& descriptors = PcDescriptors::Handle(); 2424 PcDescriptors& descriptors = PcDescriptors::Handle();
2423 descriptors ^= PcDescriptors::New(kNumEntries); 2425 descriptors ^= PcDescriptors::New(kNumEntries);
2424 descriptors.AddDescriptor(0, 10, PcDescriptors::kOther, 1, 20, 1); 2426 descriptors.AddDescriptor(0, 10, PcDescriptors::kOther, 1, 20, 1);
2425 descriptors.AddDescriptor(1, 20, PcDescriptors::kDeopt, 2, 30, 0); 2427 descriptors.AddDescriptor(1, 20, PcDescriptors::kDeopt, 2, 30, 0);
(...skipping 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after
3450 cls = Object::dynamic_class(); 3452 cls = Object::dynamic_class();
3451 array = cls.fields(); 3453 array = cls.fields();
3452 EXPECT(!array.IsNull()); 3454 EXPECT(!array.IsNull());
3453 EXPECT(array.IsArray()); 3455 EXPECT(array.IsArray());
3454 array = cls.functions(); 3456 array = cls.functions();
3455 EXPECT(!array.IsNull()); 3457 EXPECT(!array.IsNull());
3456 EXPECT(array.IsArray()); 3458 EXPECT(array.IsArray());
3457 } 3459 }
3458 3460
3459 } // namespace dart 3461 } // namespace dart
OLDNEW
« runtime/vm/object.cc ('K') | « runtime/vm/object.cc ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698