Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
dart::TTSTestState Class Reference
Inheritance diagram for dart::TTSTestState:
dart::ValueObject

Public Member Functions

 TTSTestState (Thread *thread, const AbstractType &type)
 
Zonezone () const
 
const SubtypeTestCachelast_stc () const
 
const SubtypeTestCachePtr current_stc () const
 
AbstractTypePtr TypeToTest (const TTSTestCase &test_case) const
 
void ClearCache ()
 
void InvokeEagerlySpecializedStub (const TTSTestCase &test_case)
 
void InvokeLazilySpecializedStub (const TTSTestCase &test_case, bool should_specialize=true)
 
void InvokeExistingStub (const TTSTestCase &test_case)
 
- Public Member Functions inherited from dart::ValueObject
 ValueObject ()
 
 ~ValueObject ()
 

Detailed Description

Definition at line 396 of file type_testing_stubs_test.cc.

Constructor & Destructor Documentation

◆ TTSTestState()

dart::TTSTestState::TTSTestState ( Thread thread,
const AbstractType type 
)
inline

Definition at line 398 of file type_testing_stubs_test.cc.

399 : thread_(thread),
400 type_(AbstractType::Handle(zone(), type.ptr())),
401 modified_abi_regs_box_(Array::Handle(zone(), Array::New(1))),
402 modified_rest_regs_box_(Array::Handle(zone(), Array::New(1))),
403 tts_invoker_(
404 Code::Handle(zone(), CreateInvocationStub(thread_, zone()))),
405 pool_(ObjectPool::Handle(zone(), tts_invoker_.object_pool())),
406 arguments_descriptor_(
408 previous_tts_stub_(Code::Handle(zone())),
409 previous_stc_(SubtypeTestCache::Handle(zone())),
410 last_arguments_(Array::Handle(zone())),
411 last_tested_type_(AbstractType::Handle(zone())),
412 new_tts_stub_(Code::Handle(zone())),
413 last_stc_(SubtypeTestCache::Handle(zone())),
414 last_result_(Object::Handle(zone())) {
415 if (FLAG_print_type_testing_stub_test_headers) {
416 THR_Print("Creating test state for type %s\n", type.ToCString());
417 }
418 }
static ArrayPtr NewBoxed(intptr_t type_args_len, intptr_t num_arguments, const Array &optional_arguments_names, Heap::Space space=Heap::kOld)
Definition dart_entry.h:83
static ArrayPtr New(intptr_t len, Heap::Space space=Heap::kNew)
Definition object.h:10933
ObjectPoolPtr object_pool() const
Definition object.h:6781
static Object & Handle()
Definition object.h:407
#define THR_Print(format,...)
Definition log.h:20

Member Function Documentation

◆ ClearCache()

void dart::TTSTestState::ClearCache ( )
inline

Definition at line 435 of file type_testing_stubs_test.cc.

435 {
436 pool_.SetObjectAt(kSubtypeTestCacheIndex, Object::null_object());
437 }
void SetObjectAt(intptr_t index, const Object &obj) const
Definition object.h:5605

◆ current_stc()

const SubtypeTestCachePtr dart::TTSTestState::current_stc ( ) const
inline

Definition at line 423 of file type_testing_stubs_test.cc.

423 {
424 return SubtypeTestCache::RawCast(pool_.ObjectAt(kSubtypeTestCacheIndex));
425 }
ObjectPtr ObjectAt(intptr_t index) const
Definition object.h:5599
static ObjectPtr RawCast(ObjectPtr obj)
Definition object.h:325

◆ InvokeEagerlySpecializedStub()

void dart::TTSTestState::InvokeEagerlySpecializedStub ( const TTSTestCase test_case)
inline

Definition at line 439 of file type_testing_stubs_test.cc.

439 {
440 // This shouldn't be used except within InvokeLazilySpecializedStub.
441 EXPECT_NE(kSpecialize, test_case.expected_result);
442 // A new stub is being installed, so we won't respecialize.
443 EXPECT_NE(kRespecialize, test_case.expected_result);
444 last_tested_type_ = TypeToTest(test_case);
445 {
446 // To make sure we output the disassembled stub if desired.
447 TraceStubInvocationScope scope;
449 thread_, last_tested_type_);
450 }
451 last_tested_type_.SetTypeTestingStub(previous_tts_stub_);
452 PrintInvocationHeader("eagerly specialized", test_case);
453 InvokeStubHelper(test_case);
454 // Treat it as a failure if the stub respecializes, since we're attempting
455 // to simulate AOT mode.
456 EXPECT(previous_tts_stub_.ptr() == new_tts_stub_.ptr());
457 }
#define EXPECT(type, expectedAlignment, expectedSize)
void SetTypeTestingStub(const Code &stub) const
Definition object.cc:21822
ObjectPtr ptr() const
Definition object.h:332
AbstractTypePtr TypeToTest(const TTSTestCase &test_case) const
static CodePtr SpecializeStubFor(Thread *thread, const AbstractType &type)

◆ InvokeExistingStub()

void dart::TTSTestState::InvokeExistingStub ( const TTSTestCase test_case)
inline

Definition at line 484 of file type_testing_stubs_test.cc.

484 {
485 // This shouldn't be used except within InvokeLazilySpecializedStub.
486 EXPECT_NE(kSpecialize, test_case.expected_result);
487 last_tested_type_ = TypeToTest(test_case);
488 PrintInvocationHeader("existing", test_case);
489 InvokeStubHelper(test_case);
490 // Only respecialization should result in a new stub.
491 EXPECT_EQ(test_case.expected_result == kRespecialize,
492 previous_tts_stub_.ptr() != new_tts_stub_.ptr());
493 }

◆ InvokeLazilySpecializedStub()

void dart::TTSTestState::InvokeLazilySpecializedStub ( const TTSTestCase test_case,
bool  should_specialize = true 
)
inline

Definition at line 459 of file type_testing_stubs_test.cc.

460 {
461 // This is governed by the should_specialize parameter.
462 EXPECT_NE(kSpecialize, test_case.expected_result);
463 // A new stub is being installed, so we won't respecialize.
464 EXPECT_NE(kRespecialize, test_case.expected_result);
465 last_tested_type_ = TypeToTest(test_case);
466 const auto& specializing_stub =
468 last_tested_type_, /*lazy_specialize=*/true));
469 last_tested_type_.SetTypeTestingStub(specializing_stub);
470 const TTSTestCase initial_case{
471 test_case.instance, test_case.instantiator_tav, test_case.function_tav,
472 should_specialize && test_case.expected_result != kFail
474 : test_case.expected_result};
475 PrintInvocationHeader("lazy specialized", initial_case);
476 InvokeStubHelper(initial_case);
477 if (initial_case.expected_result == kSpecialize) {
478 EXPECT(previous_tts_stub_.ptr() != new_tts_stub_.ptr());
479 } else {
480 EXPECT(previous_tts_stub_.ptr() == new_tts_stub_.ptr());
481 }
482 }
static CodePtr DefaultCodeForType(const AbstractType &type, bool lazy_specialize=true)

◆ last_stc()

const SubtypeTestCache & dart::TTSTestState::last_stc ( ) const
inline

Definition at line 421 of file type_testing_stubs_test.cc.

421{ return last_stc_; }

◆ TypeToTest()

AbstractTypePtr dart::TTSTestState::TypeToTest ( const TTSTestCase test_case) const
inline

Definition at line 427 of file type_testing_stubs_test.cc.

427 {
428 if (type_.IsTypeParameter()) {
429 return TypeParameter::Cast(type_).GetFromTypeArguments(
430 test_case.instantiator_tav, test_case.function_tav);
431 }
432 return type_.ptr();
433 }

◆ zone()

Zone * dart::TTSTestState::zone ( ) const
inline

Definition at line 420 of file type_testing_stubs_test.cc.

420{ return thread_->zone(); }
Zone * zone() const

The documentation for this class was generated from the following file: