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

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

Issue 10885039: Deoptimization can occur at Dart calls (includes native calls to C) but not at runtime calls. This … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 "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/isolate.h" 8 #include "vm/isolate.h"
9 #include "vm/object.h" 9 #include "vm/object.h"
10 #include "vm/object_store.h" 10 #include "vm/object_store.h"
(...skipping 2494 matching lines...) Expand 10 before | Expand all | Expand 10 after
2505 EXPECT_EQ(150, handlers.HandlerPC(5)); 2505 EXPECT_EQ(150, handlers.HandlerPC(5));
2506 } 2506 }
2507 2507
2508 2508
2509 TEST_CASE(PcDescriptors) { 2509 TEST_CASE(PcDescriptors) {
2510 const int kNumEntries = 6; 2510 const int kNumEntries = 6;
2511 // Add PcDescriptors to the code. 2511 // Add PcDescriptors to the code.
2512 PcDescriptors& descriptors = PcDescriptors::Handle(); 2512 PcDescriptors& descriptors = PcDescriptors::Handle();
2513 descriptors ^= PcDescriptors::New(kNumEntries); 2513 descriptors ^= PcDescriptors::New(kNumEntries);
2514 descriptors.AddDescriptor(0, 10, PcDescriptors::kOther, 1, 20, 1); 2514 descriptors.AddDescriptor(0, 10, PcDescriptors::kOther, 1, 20, 1);
2515 descriptors.AddDescriptor(1, 20, PcDescriptors::kDeopt, 2, 30, 0); 2515 descriptors.AddDescriptor(1, 20, PcDescriptors::kDeoptBefore, 2, 30, 0);
2516 descriptors.AddDescriptor(2, 30, PcDescriptors::kOther, 3, 40, 1); 2516 descriptors.AddDescriptor(2, 30, PcDescriptors::kOther, 3, 40, 1);
2517 descriptors.AddDescriptor(3, 10, PcDescriptors::kOther, 4, 40, 2); 2517 descriptors.AddDescriptor(3, 10, PcDescriptors::kOther, 4, 40, 2);
2518 descriptors.AddDescriptor(4, 10, PcDescriptors::kOther, 5, 80, 3); 2518 descriptors.AddDescriptor(4, 10, PcDescriptors::kOther, 5, 80, 3);
2519 descriptors.AddDescriptor(5, 80, PcDescriptors::kOther, 6, 150, 3); 2519 descriptors.AddDescriptor(5, 80, PcDescriptors::kOther, 6, 150, 3);
2520 2520
2521 extern void GenerateIncrement(Assembler* assembler); 2521 extern void GenerateIncrement(Assembler* assembler);
2522 Assembler _assembler_; 2522 Assembler _assembler_;
2523 GenerateIncrement(&_assembler_); 2523 GenerateIncrement(&_assembler_);
2524 Code& code = Code::Handle(Code::FinalizeCode( 2524 Code& code = Code::Handle(Code::FinalizeCode(
2525 *CreateFunction("Test_Code"), &_assembler_)); 2525 *CreateFunction("Test_Code"), &_assembler_));
2526 code.set_pc_descriptors(descriptors); 2526 code.set_pc_descriptors(descriptors);
2527 2527
2528 // Verify the PcDescriptor entries by accessing them. 2528 // Verify the PcDescriptor entries by accessing them.
2529 const PcDescriptors& pc_descs = PcDescriptors::Handle(code.pc_descriptors()); 2529 const PcDescriptors& pc_descs = PcDescriptors::Handle(code.pc_descriptors());
2530 EXPECT_EQ(kNumEntries, pc_descs.Length()); 2530 EXPECT_EQ(kNumEntries, pc_descs.Length());
2531 EXPECT_EQ(1, pc_descs.TryIndex(0)); 2531 EXPECT_EQ(1, pc_descs.TryIndex(0));
2532 EXPECT_EQ(static_cast<uword>(10), pc_descs.PC(0)); 2532 EXPECT_EQ(static_cast<uword>(10), pc_descs.PC(0));
2533 EXPECT_EQ(1, pc_descs.DeoptId(0)); 2533 EXPECT_EQ(1, pc_descs.DeoptId(0));
2534 EXPECT_EQ(20, pc_descs.TokenPos(0)); 2534 EXPECT_EQ(20, pc_descs.TokenPos(0));
2535 EXPECT_EQ(3, pc_descs.TryIndex(5)); 2535 EXPECT_EQ(3, pc_descs.TryIndex(5));
2536 EXPECT_EQ(static_cast<uword>(80), pc_descs.PC(5)); 2536 EXPECT_EQ(static_cast<uword>(80), pc_descs.PC(5));
2537 EXPECT_EQ(150, pc_descs.TokenPos(5)); 2537 EXPECT_EQ(150, pc_descs.TokenPos(5));
2538 EXPECT_EQ(PcDescriptors::kOther, pc_descs.DescriptorKind(0)); 2538 EXPECT_EQ(PcDescriptors::kOther, pc_descs.DescriptorKind(0));
2539 EXPECT_EQ(PcDescriptors::kDeopt, pc_descs.DescriptorKind(1)); 2539 EXPECT_EQ(PcDescriptors::kDeoptBefore, pc_descs.DescriptorKind(1));
2540 } 2540 }
2541 2541
2542 2542
2543 static RawClass* CreateTestClass(const char* name) { 2543 static RawClass* CreateTestClass(const char* name) {
2544 const String& class_name = String::Handle(Symbols::New(name)); 2544 const String& class_name = String::Handle(Symbols::New(name));
2545 const Class& cls = Class::Handle( 2545 const Class& cls = Class::Handle(
2546 Class::New(class_name, Script::Handle(), Scanner::kDummyTokenIndex)); 2546 Class::New(class_name, Script::Handle(), Scanner::kDummyTokenIndex));
2547 return cls.raw(); 2547 return cls.raw();
2548 } 2548 }
2549 2549
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
3104 isolate->heap()->CollectAllGarbage(); 3104 isolate->heap()->CollectAllGarbage();
3105 EXPECT(weak1.key() == Object::null()); 3105 EXPECT(weak1.key() == Object::null());
3106 EXPECT(weak1.value() == Object::null()); 3106 EXPECT(weak1.value() == Object::null());
3107 EXPECT(weak2.key() == Object::null()); 3107 EXPECT(weak2.key() == Object::null());
3108 EXPECT(weak2.value() == Object::null()); 3108 EXPECT(weak2.value() == Object::null());
3109 } 3109 }
3110 3110
3111 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). 3111 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64).
3112 3112
3113 } // namespace dart 3113 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698