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

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

Issue 575663002: Eliminate 99% of allocated ExceptionHandler objects (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/raw_object.h » ('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/globals.h" 5 #include "platform/globals.h"
6 6
7 #include "vm/assembler.h" 7 #include "vm/assembler.h"
8 #include "vm/class_finalizer.h" 8 #include "vm/class_finalizer.h"
9 #include "vm/dart_api_impl.h" 9 #include "vm/dart_api_impl.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 2733 matching lines...) Expand 10 before | Expand all | Expand 10 after
2744 extern void GenerateIncrement(Assembler* assembler); 2744 extern void GenerateIncrement(Assembler* assembler);
2745 Assembler _assembler_; 2745 Assembler _assembler_;
2746 GenerateIncrement(&_assembler_); 2746 GenerateIncrement(&_assembler_);
2747 Code& code = Code::Handle(Code::FinalizeCode( 2747 Code& code = Code::Handle(Code::FinalizeCode(
2748 *CreateFunction("Test_Code"), &_assembler_)); 2748 *CreateFunction("Test_Code"), &_assembler_));
2749 code.set_exception_handlers(exception_handlers); 2749 code.set_exception_handlers(exception_handlers);
2750 2750
2751 // Verify the exception handler table entries by accessing them. 2751 // Verify the exception handler table entries by accessing them.
2752 const ExceptionHandlers& handlers = 2752 const ExceptionHandlers& handlers =
2753 ExceptionHandlers::Handle(code.exception_handlers()); 2753 ExceptionHandlers::Handle(code.exception_handlers());
2754 EXPECT_EQ(kNumEntries, handlers.Length()); 2754 EXPECT_EQ(kNumEntries, handlers.num_entries());
2755 RawExceptionHandlers::HandlerInfo info; 2755 RawExceptionHandlers::HandlerInfo info;
2756 handlers.GetHandlerInfo(0, &info); 2756 handlers.GetHandlerInfo(0, &info);
2757 EXPECT_EQ(-1, handlers.OuterTryIndex(0)); 2757 EXPECT_EQ(-1, handlers.OuterTryIndex(0));
2758 EXPECT_EQ(-1, info.outer_try_index); 2758 EXPECT_EQ(-1, info.outer_try_index);
2759 EXPECT_EQ(20, handlers.HandlerPC(0)); 2759 EXPECT_EQ(20, handlers.HandlerPC(0));
2760 EXPECT(handlers.NeedsStacktrace(0)); 2760 EXPECT(handlers.NeedsStacktrace(0));
2761 EXPECT(!handlers.HasCatchAll(0)); 2761 EXPECT(!handlers.HasCatchAll(0));
2762 EXPECT_EQ(20, info.handler_pc); 2762 EXPECT_EQ(20, info.handler_pc);
2763 EXPECT_EQ(1, handlers.OuterTryIndex(3)); 2763 EXPECT_EQ(1, handlers.OuterTryIndex(3));
2764 EXPECT_EQ(150, handlers.HandlerPC(3)); 2764 EXPECT_EQ(150, handlers.HandlerPC(3));
(...skipping 1706 matching lines...) Expand 10 before | Expand all | Expand 10 after
4471 EXPECT_VALID(h_result); 4471 EXPECT_VALID(h_result);
4472 Integer& result = Integer::Handle(); 4472 Integer& result = Integer::Handle();
4473 result ^= Api::UnwrapHandle(h_result); 4473 result ^= Api::UnwrapHandle(h_result);
4474 String& foo = String::Handle(String::New("foo")); 4474 String& foo = String::Handle(String::New("foo"));
4475 Integer& expected = Integer::Handle(); 4475 Integer& expected = Integer::Handle();
4476 expected ^= foo.HashCode(); 4476 expected ^= foo.HashCode();
4477 EXPECT(result.IsIdenticalTo(expected)); 4477 EXPECT(result.IsIdenticalTo(expected));
4478 } 4478 }
4479 4479
4480 } // namespace dart 4480 } // namespace dart
OLDNEW
« no previous file with comments | « 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