Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 // TODO(zra): Remove when tests are ready to enable. | 5 // TODO(zra): Remove when tests are ready to enable. |
| 6 #include "platform/globals.h" | 6 #include "platform/globals.h" |
| 7 #if !defined(TARGET_ARCH_ARM64) | |
| 8 | 7 |
| 9 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 10 #include "vm/bigint_operations.h" | 9 #include "vm/bigint_operations.h" |
| 11 #include "vm/class_finalizer.h" | 10 #include "vm/class_finalizer.h" |
| 12 #include "vm/dart_api_impl.h" | 11 #include "vm/dart_api_impl.h" |
| 13 #include "vm/dart_entry.h" | 12 #include "vm/dart_entry.h" |
| 14 #include "vm/debugger.h" | 13 #include "vm/debugger.h" |
| 15 #include "vm/isolate.h" | 14 #include "vm/isolate.h" |
| 16 #include "vm/object.h" | 15 #include "vm/object.h" |
| 17 #include "vm/object_store.h" | 16 #include "vm/object_store.h" |
| (...skipping 2473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2491 extern void GenerateIncrement(Assembler* assembler); | 2490 extern void GenerateIncrement(Assembler* assembler); |
| 2492 Assembler _assembler_; | 2491 Assembler _assembler_; |
| 2493 GenerateIncrement(&_assembler_); | 2492 GenerateIncrement(&_assembler_); |
| 2494 Code& code = Code::Handle(Code::FinalizeCode( | 2493 Code& code = Code::Handle(Code::FinalizeCode( |
| 2495 *CreateFunction("Test_Code"), &_assembler_)); | 2494 *CreateFunction("Test_Code"), &_assembler_)); |
| 2496 Instructions& instructions = Instructions::Handle(code.instructions()); | 2495 Instructions& instructions = Instructions::Handle(code.instructions()); |
| 2497 uword entry_point = instructions.EntryPoint(); | 2496 uword entry_point = instructions.EntryPoint(); |
| 2498 intptr_t retval = 0; | 2497 intptr_t retval = 0; |
| 2499 #if defined(USING_SIMULATOR) | 2498 #if defined(USING_SIMULATOR) |
| 2500 retval = bit_copy<intptr_t, int64_t>(Simulator::Current()->Call( | 2499 retval = bit_copy<intptr_t, int64_t>(Simulator::Current()->Call( |
| 2501 static_cast<int32_t>(entry_point), 0, 0, 0, 0)); | 2500 static_cast<intptr_t>(entry_point), 0, 0, 0, 0)); |
| 2502 #else | 2501 #else |
| 2503 typedef intptr_t (*IncrementCode)(); | 2502 typedef intptr_t (*IncrementCode)(); |
| 2504 retval = reinterpret_cast<IncrementCode>(entry_point)(); | 2503 retval = reinterpret_cast<IncrementCode>(entry_point)(); |
| 2505 #endif | 2504 #endif |
| 2506 EXPECT_EQ(2, retval); | 2505 EXPECT_EQ(2, retval); |
| 2507 EXPECT_EQ(instructions.raw(), Instructions::FromEntryPoint(entry_point)); | 2506 EXPECT_EQ(instructions.raw(), Instructions::FromEntryPoint(entry_point)); |
| 2508 } | 2507 } |
| 2509 | 2508 |
| 2510 | 2509 |
| 2511 // Test for immutability of generated instructions. The test crashes with a | 2510 // Test for immutability of generated instructions. The test crashes with a |
| 2512 // segmentation fault when writing into it. | 2511 // segmentation fault when writing into it. |
| 2513 TEST_CASE(CodeImmutability) { | 2512 TEST_CASE(CodeImmutability) { |
| 2514 extern void GenerateIncrement(Assembler* assembler); | 2513 extern void GenerateIncrement(Assembler* assembler); |
| 2515 Assembler _assembler_; | 2514 Assembler _assembler_; |
| 2516 GenerateIncrement(&_assembler_); | 2515 GenerateIncrement(&_assembler_); |
| 2517 Code& code = Code::Handle(Code::FinalizeCode( | 2516 Code& code = Code::Handle(Code::FinalizeCode( |
| 2518 *CreateFunction("Test_Code"), &_assembler_)); | 2517 *CreateFunction("Test_Code"), &_assembler_)); |
| 2519 Instructions& instructions = Instructions::Handle(code.instructions()); | 2518 Instructions& instructions = Instructions::Handle(code.instructions()); |
| 2520 uword entry_point = instructions.EntryPoint(); | 2519 uword entry_point = instructions.EntryPoint(); |
| 2521 // Try writing into the generated code, expected to crash. | 2520 // Try writing into the generated code, expected to crash. |
| 2522 *(reinterpret_cast<char*>(entry_point) + 1) = 1; | 2521 *(reinterpret_cast<char*>(entry_point) + 1) = 1; |
| 2523 intptr_t retval = 0; | 2522 intptr_t retval = 0; |
| 2524 #if defined(USING_SIMULATOR) | 2523 #if defined(USING_SIMULATOR) |
| 2525 retval = bit_copy<intptr_t, int64_t>(Simulator::Current()->Call( | 2524 retval = bit_copy<intptr_t, int64_t>(Simulator::Current()->Call( |
| 2526 static_cast<int32_t>(entry_point), 0, 0, 0, 0)); | 2525 static_cast<intptr_t>(entry_point), 0, 0, 0, 0)); |
| 2527 #else | 2526 #else |
| 2528 typedef intptr_t (*IncrementCode)(); | 2527 typedef intptr_t (*IncrementCode)(); |
| 2529 retval = reinterpret_cast<IncrementCode>(entry_point)(); | 2528 retval = reinterpret_cast<IncrementCode>(entry_point)(); |
| 2530 #endif | 2529 #endif |
| 2531 EXPECT_EQ(3, retval); | 2530 EXPECT_EQ(3, retval); |
| 2532 EXPECT_EQ(instructions.raw(), Instructions::FromEntryPoint(entry_point)); | 2531 EXPECT_EQ(instructions.raw(), Instructions::FromEntryPoint(entry_point)); |
| 2533 if (!FLAG_write_protect_code) { | 2532 if (!FLAG_write_protect_code) { |
| 2534 // Since this test is expected to crash, crash if write protection of code | 2533 // Since this test is expected to crash, crash if write protection of code |
| 2535 // is switched off. | 2534 // is switched off. |
| 2536 OS::DebugBreak(); | 2535 OS::DebugBreak(); |
| 2537 } | 2536 } |
| 2538 } | 2537 } |
| 2539 | 2538 |
| 2540 | 2539 |
| 2541 // Test for Embedded String object in the instructions. | 2540 // Test for Embedded String object in the instructions. |
| 2542 TEST_CASE(EmbedStringInCode) { | 2541 TEST_CASE(EmbedStringInCode) { |
| 2543 extern void GenerateEmbedStringInCode(Assembler* assembler, const char* str); | 2542 extern void GenerateEmbedStringInCode(Assembler* assembler, const char* str); |
| 2544 const char* kHello = "Hello World!"; | 2543 const char* kHello = "Hello World!"; |
| 2545 word expected_length = static_cast<word>(strlen(kHello)); | 2544 word expected_length = static_cast<word>(strlen(kHello)); |
| 2546 Assembler _assembler_; | 2545 Assembler _assembler_; |
| 2547 GenerateEmbedStringInCode(&_assembler_, kHello); | 2546 GenerateEmbedStringInCode(&_assembler_, kHello); |
| 2548 Code& code = Code::Handle(Code::FinalizeCode( | 2547 Code& code = Code::Handle(Code::FinalizeCode( |
| 2549 *CreateFunction("Test_EmbedStringInCode"), &_assembler_)); | 2548 *CreateFunction("Test_EmbedStringInCode"), &_assembler_)); |
| 2550 Instructions& instructions = Instructions::Handle(code.instructions()); | 2549 Instructions& instructions = Instructions::Handle(code.instructions()); |
| 2551 uword retval = 0; | 2550 uword retval = 0; |
| 2552 #if defined(USING_SIMULATOR) | 2551 #if defined(USING_SIMULATOR) |
| 2553 retval = bit_copy<uword, int64_t>(Simulator::Current()->Call( | 2552 retval = bit_copy<uword, int64_t>(Simulator::Current()->Call( |
| 2554 static_cast<int32_t>(instructions.EntryPoint()), 0, 0, 0, 0)); | 2553 static_cast<intptr_t>(instructions.EntryPoint()), 0, 0, 0, 0)); |
| 2555 #else | 2554 #else |
| 2556 typedef uword (*EmbedStringCode)(); | 2555 typedef uword (*EmbedStringCode)(); |
| 2557 retval = reinterpret_cast<EmbedStringCode>(instructions.EntryPoint())(); | 2556 retval = reinterpret_cast<EmbedStringCode>(instructions.EntryPoint())(); |
| 2558 #endif | 2557 #endif |
| 2559 EXPECT((retval & kSmiTagMask) == kHeapObjectTag); | 2558 EXPECT((retval & kSmiTagMask) == kHeapObjectTag); |
| 2560 String& string_object = String::Handle(); | 2559 String& string_object = String::Handle(); |
| 2561 string_object ^= reinterpret_cast<RawInstructions*>(retval); | 2560 string_object ^= reinterpret_cast<RawInstructions*>(retval); |
| 2562 EXPECT(string_object.Length() == expected_length); | 2561 EXPECT(string_object.Length() == expected_length); |
| 2563 for (int i = 0; i < expected_length; i ++) { | 2562 for (int i = 0; i < expected_length; i ++) { |
| 2564 EXPECT(string_object.CharAt(i) == kHello[i]); | 2563 EXPECT(string_object.CharAt(i) == kHello[i]); |
| 2565 } | 2564 } |
| 2566 } | 2565 } |
| 2567 | 2566 |
| 2568 | 2567 |
| 2569 // Test for Embedded Smi object in the instructions. | 2568 // Test for Embedded Smi object in the instructions. |
| 2570 TEST_CASE(EmbedSmiInCode) { | 2569 TEST_CASE(EmbedSmiInCode) { |
| 2571 extern void GenerateEmbedSmiInCode(Assembler* assembler, intptr_t value); | 2570 extern void GenerateEmbedSmiInCode(Assembler* assembler, intptr_t value); |
| 2572 const intptr_t kSmiTestValue = 5; | 2571 const intptr_t kSmiTestValue = 5; |
| 2573 Assembler _assembler_; | 2572 Assembler _assembler_; |
| 2574 GenerateEmbedSmiInCode(&_assembler_, kSmiTestValue); | 2573 GenerateEmbedSmiInCode(&_assembler_, kSmiTestValue); |
| 2575 Code& code = Code::Handle(Code::FinalizeCode( | 2574 Code& code = Code::Handle(Code::FinalizeCode( |
| 2576 *CreateFunction("Test_EmbedSmiInCode"), &_assembler_)); | 2575 *CreateFunction("Test_EmbedSmiInCode"), &_assembler_)); |
| 2577 Instructions& instructions = Instructions::Handle(code.instructions()); | 2576 Instructions& instructions = Instructions::Handle(code.instructions()); |
| 2578 intptr_t retval = 0; | 2577 intptr_t retval = 0; |
| 2579 #if defined(USING_SIMULATOR) | 2578 #if defined(USING_SIMULATOR) |
| 2580 retval = bit_copy<intptr_t, int64_t>(Simulator::Current()->Call( | 2579 retval = bit_copy<intptr_t, int64_t>(Simulator::Current()->Call( |
| 2581 static_cast<int32_t>(instructions.EntryPoint()), 0, 0, 0, 0)); | 2580 static_cast<intptr_t>(instructions.EntryPoint()), 0, 0, 0, 0)); |
| 2582 #else | 2581 #else |
| 2583 typedef intptr_t (*EmbedSmiCode)(); | 2582 typedef intptr_t (*EmbedSmiCode)(); |
| 2584 retval = reinterpret_cast<EmbedSmiCode>(instructions.EntryPoint())(); | 2583 retval = reinterpret_cast<EmbedSmiCode>(instructions.EntryPoint())(); |
| 2585 #endif | 2584 #endif |
| 2586 EXPECT((retval >> kSmiTagShift) == kSmiTestValue); | 2585 EXPECT((retval >> kSmiTagShift) == kSmiTestValue); |
| 2587 } | 2586 } |
| 2588 | 2587 |
| 2589 | 2588 |
| 2590 #if defined(ARCH_IS_64_BIT) | 2589 #if defined(ARCH_IS_64_BIT) |
| 2591 // Test for Embedded Smi object in the instructions. | 2590 // Test for Embedded Smi object in the instructions. |
| 2592 TEST_CASE(EmbedSmiIn64BitCode) { | 2591 TEST_CASE(EmbedSmiIn64BitCode) { |
| 2593 extern void GenerateEmbedSmiInCode(Assembler* assembler, intptr_t value); | 2592 extern void GenerateEmbedSmiInCode(Assembler* assembler, intptr_t value); |
| 2594 const intptr_t kSmiTestValue = 5L << 32; | 2593 const intptr_t kSmiTestValue = 5L << 32; |
| 2595 Assembler _assembler_; | 2594 Assembler _assembler_; |
| 2596 GenerateEmbedSmiInCode(&_assembler_, kSmiTestValue); | 2595 GenerateEmbedSmiInCode(&_assembler_, kSmiTestValue); |
| 2597 Code& code = Code::Handle(Code::FinalizeCode( | 2596 Code& code = Code::Handle(Code::FinalizeCode( |
| 2598 *CreateFunction("Test_EmbedSmiIn64BitCode"), &_assembler_)); | 2597 *CreateFunction("Test_EmbedSmiIn64BitCode"), &_assembler_)); |
| 2599 Instructions& instructions = Instructions::Handle(code.instructions()); | 2598 Instructions& instructions = Instructions::Handle(code.instructions()); |
| 2600 intptr_t retval = 0; | 2599 intptr_t retval = 0; |
| 2601 #if defined(USING_SIMULATOR) | 2600 #if defined(USING_SIMULATOR) |
| 2602 retval = bit_copy<intptr_t, int64_t>(Simulator::Current()->Call( | 2601 retval = bit_copy<intptr_t, int64_t>(Simulator::Current()->Call( |
| 2603 static_cast<int32_t>(instructions.EntryPoint()), 0, 0, 0, 0)); | 2602 static_cast<intptr_t>(instructions.EntryPoint()), 0, 0, 0, 0)); |
| 2604 #else | 2603 #else |
| 2605 typedef intptr_t (*EmbedSmiCode)(); | 2604 typedef intptr_t (*EmbedSmiCode)(); |
| 2606 retval = reinterpret_cast<EmbedSmiCode>(instructions.EntryPoint())(); | 2605 retval = reinterpret_cast<EmbedSmiCode>(instructions.EntryPoint())(); |
| 2607 #endif | 2606 #endif |
| 2608 EXPECT((retval >> kSmiTagShift) == kSmiTestValue); | 2607 EXPECT((retval >> kSmiTagShift) == kSmiTestValue); |
| 2609 } | 2608 } |
| 2610 #endif // ARCH_IS_64_BIT | 2609 #endif // ARCH_IS_64_BIT |
| 2611 | 2610 |
| 2612 | 2611 |
| 2613 TEST_CASE(ExceptionHandlers) { | 2612 TEST_CASE(ExceptionHandlers) { |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2986 EXPECT(!String::EqualsIgnoringPrivateKey(ext_mangled_name, | 2985 EXPECT(!String::EqualsIgnoringPrivateKey(ext_mangled_name, |
| 2987 ext_bad_bare_name)); | 2986 ext_bad_bare_name)); |
| 2988 } | 2987 } |
| 2989 | 2988 |
| 2990 | 2989 |
| 2991 TEST_CASE(ArrayNew_Overflow_Crash) { | 2990 TEST_CASE(ArrayNew_Overflow_Crash) { |
| 2992 Array::Handle(Array::New(Array::kMaxElements + 1)); | 2991 Array::Handle(Array::New(Array::kMaxElements + 1)); |
| 2993 } | 2992 } |
| 2994 | 2993 |
| 2995 | 2994 |
| 2995 #if !defined(TARGET_ARCH_ARM64) | |
|
regis
2014/04/15 23:37:04
I would add a TODO(zra) here and below
zra
2014/04/16 15:48:16
Done.
| |
| 2996 | |
| 2996 TEST_CASE(StackTraceFormat) { | 2997 TEST_CASE(StackTraceFormat) { |
| 2997 const char* kScriptChars = | 2998 const char* kScriptChars = |
| 2998 "void baz() {\n" | 2999 "void baz() {\n" |
| 2999 " throw 'MyException';\n" | 3000 " throw 'MyException';\n" |
| 3000 "}\n" | 3001 "}\n" |
| 3001 "\n" | 3002 "\n" |
| 3002 "class _OtherClass {\n" | 3003 "class _OtherClass {\n" |
| 3003 " _OtherClass._named() {\n" | 3004 " _OtherClass._named() {\n" |
| 3004 " baz();\n" | 3005 " baz();\n" |
| 3005 " }\n" | 3006 " }\n" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3046 "#3 _bar (dart:test-lib:16:3)\n" | 3047 "#3 _bar (dart:test-lib:16:3)\n" |
| 3047 "#4 MyClass.field (dart:test-lib:25:9)\n" | 3048 "#4 MyClass.field (dart:test-lib:25:9)\n" |
| 3048 "#5 MyClass.foo.fooHelper (dart:test-lib:30:7)\n" | 3049 "#5 MyClass.foo.fooHelper (dart:test-lib:30:7)\n" |
| 3049 "#6 MyClass.foo (dart:test-lib:32:14)\n" | 3050 "#6 MyClass.foo (dart:test-lib:32:14)\n" |
| 3050 "#7 MyClass.MyClass.<anonymous closure> (dart:test-lib:21:15)\n" | 3051 "#7 MyClass.MyClass.<anonymous closure> (dart:test-lib:21:15)\n" |
| 3051 "#8 MyClass.MyClass (dart:test-lib:21:18)\n" | 3052 "#8 MyClass.MyClass (dart:test-lib:21:18)\n" |
| 3052 "#9 main.<anonymous closure> (dart:test-lib:37:14)\n" | 3053 "#9 main.<anonymous closure> (dart:test-lib:37:14)\n" |
| 3053 "#10 main (dart:test-lib:37:24)"); | 3054 "#10 main (dart:test-lib:37:24)"); |
| 3054 } | 3055 } |
| 3055 | 3056 |
| 3057 #endif // !defined(TARGET_ARCH_ARM64) | |
| 3056 | 3058 |
| 3057 TEST_CASE(WeakProperty_PreserveCrossGen) { | 3059 TEST_CASE(WeakProperty_PreserveCrossGen) { |
| 3058 Isolate* isolate = Isolate::Current(); | 3060 Isolate* isolate = Isolate::Current(); |
| 3059 WeakProperty& weak = WeakProperty::Handle(); | 3061 WeakProperty& weak = WeakProperty::Handle(); |
| 3060 { | 3062 { |
| 3061 // Weak property and value in new. Key in old. | 3063 // Weak property and value in new. Key in old. |
| 3062 HANDLESCOPE(isolate); | 3064 HANDLESCOPE(isolate); |
| 3063 String& key = String::Handle(); | 3065 String& key = String::Handle(); |
| 3064 key ^= OneByteString::New("key", Heap::kOld); | 3066 key ^= OneByteString::New("key", Heap::kOld); |
| 3065 String& value = String::Handle(); | 3067 String& value = String::Handle(); |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3454 EXPECT_NE(reference.raw(), other_reference.raw()); | 3456 EXPECT_NE(reference.raw(), other_reference.raw()); |
| 3455 other_reference.set_referent(library); | 3457 other_reference.set_referent(library); |
| 3456 EXPECT_NE(reference.raw(), other_reference.raw()); | 3458 EXPECT_NE(reference.raw(), other_reference.raw()); |
| 3457 EXPECT_EQ(reference.referent(), other_reference.referent()); | 3459 EXPECT_EQ(reference.referent(), other_reference.referent()); |
| 3458 | 3460 |
| 3459 Object& obj = Object::Handle(reference.raw()); | 3461 Object& obj = Object::Handle(reference.raw()); |
| 3460 EXPECT(obj.IsMirrorReference()); | 3462 EXPECT(obj.IsMirrorReference()); |
| 3461 } | 3463 } |
| 3462 | 3464 |
| 3463 | 3465 |
| 3466 #if !defined(TARGET_ARCH_ARM64) | |
| 3467 | |
| 3464 static RawFunction* GetFunction(const Class& cls, const char* name) { | 3468 static RawFunction* GetFunction(const Class& cls, const char* name) { |
| 3465 const Function& result = Function::Handle(cls.LookupDynamicFunction( | 3469 const Function& result = Function::Handle(cls.LookupDynamicFunction( |
| 3466 String::Handle(String::New(name)))); | 3470 String::Handle(String::New(name)))); |
| 3467 EXPECT(!result.IsNull()); | 3471 EXPECT(!result.IsNull()); |
| 3468 return result.raw(); | 3472 return result.raw(); |
| 3469 } | 3473 } |
| 3470 | 3474 |
| 3471 | 3475 |
| 3472 static RawFunction* GetStaticFunction(const Class& cls, const char* name) { | 3476 static RawFunction* GetStaticFunction(const Class& cls, const char* name) { |
| 3473 const Function& result = Function::Handle(cls.LookupStaticFunction( | 3477 const Function& result = Function::Handle(cls.LookupStaticFunction( |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3593 func_b_from_index ^= class_a.FunctionFromIndex(func_b_index); | 3597 func_b_from_index ^= class_a.FunctionFromIndex(func_b_index); |
| 3594 EXPECT(!func_b_from_index.IsNull()); | 3598 EXPECT(!func_b_from_index.IsNull()); |
| 3595 // Same function. | 3599 // Same function. |
| 3596 EXPECT_EQ(func_b.raw(), func_b_from_index.raw()); | 3600 EXPECT_EQ(func_b.raw(), func_b_from_index.raw()); |
| 3597 // Retrieve implicit closure function. | 3601 // Retrieve implicit closure function. |
| 3598 Function& func_x_from_index = Function::Handle(); | 3602 Function& func_x_from_index = Function::Handle(); |
| 3599 func_x_from_index ^= class_a.ImplicitClosureFunctionFromIndex(func_x_index); | 3603 func_x_from_index ^= class_a.ImplicitClosureFunctionFromIndex(func_x_index); |
| 3600 EXPECT_EQ(func_x.raw(), func_x_from_index.raw()); | 3604 EXPECT_EQ(func_x.raw(), func_x_from_index.raw()); |
| 3601 } | 3605 } |
| 3602 | 3606 |
| 3607 #endif // !defined(TARGET_ARCH_ARM64) | |
| 3608 | |
| 3603 | 3609 |
| 3604 TEST_CASE(FindClosureIndex) { | 3610 TEST_CASE(FindClosureIndex) { |
| 3605 // Allocate the class first. | 3611 // Allocate the class first. |
| 3606 const String& class_name = String::Handle(Symbols::New("MyClass")); | 3612 const String& class_name = String::Handle(Symbols::New("MyClass")); |
| 3607 const Script& script = Script::Handle(); | 3613 const Script& script = Script::Handle(); |
| 3608 const Class& cls = Class::Handle(CreateDummyClass(class_name, script)); | 3614 const Class& cls = Class::Handle(CreateDummyClass(class_name, script)); |
| 3609 const Array& functions = Array::Handle(Array::New(1)); | 3615 const Array& functions = Array::Handle(Array::New(1)); |
| 3610 | 3616 |
| 3611 Function& parent = Function::Handle(); | 3617 Function& parent = Function::Handle(); |
| 3612 const String& parent_name = String::Handle(Symbols::New("foo_papa")); | 3618 const String& parent_name = String::Handle(Symbols::New("foo_papa")); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3673 EXPECT_EQ(invocation_dispatcher.raw(), | 3679 EXPECT_EQ(invocation_dispatcher.raw(), |
| 3674 invocation_dispatcher_from_index.raw()); | 3680 invocation_dispatcher_from_index.raw()); |
| 3675 // Test function not found case. | 3681 // Test function not found case. |
| 3676 const Function& bad_function = Function::Handle(Function::null()); | 3682 const Function& bad_function = Function::Handle(Function::null()); |
| 3677 intptr_t bad_invocation_dispatcher_index = | 3683 intptr_t bad_invocation_dispatcher_index = |
| 3678 cls.FindInvocationDispatcherFunctionIndex(bad_function); | 3684 cls.FindInvocationDispatcherFunctionIndex(bad_function); |
| 3679 EXPECT_EQ(bad_invocation_dispatcher_index, -1); | 3685 EXPECT_EQ(bad_invocation_dispatcher_index, -1); |
| 3680 } | 3686 } |
| 3681 | 3687 |
| 3682 | 3688 |
| 3689 #if !defined(TARGET_ARCH_ARM64) | |
| 3690 | |
| 3683 static void PrintMetadata(const char* name, const Object& data) { | 3691 static void PrintMetadata(const char* name, const Object& data) { |
| 3684 if (data.IsError()) { | 3692 if (data.IsError()) { |
| 3685 OS::Print("Error in metadata evaluation for %s: '%s'\n", | 3693 OS::Print("Error in metadata evaluation for %s: '%s'\n", |
| 3686 name, | 3694 name, |
| 3687 Error::Cast(data).ToErrorCString()); | 3695 Error::Cast(data).ToErrorCString()); |
| 3688 } | 3696 } |
| 3689 EXPECT(data.IsArray()); | 3697 EXPECT(data.IsArray()); |
| 3690 const Array& metadata = Array::Cast(data); | 3698 const Array& metadata = Array::Cast(data); |
| 3691 OS::Print("Metadata for %s has %" Pd " values:\n", name, metadata.Length()); | 3699 OS::Print("Metadata for %s has %" Pd " values:\n", name, metadata.Length()); |
| 3692 Object& elem = Object::Handle(); | 3700 Object& elem = Object::Handle(); |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3878 EXPECT(func_b.IsInlineable()); | 3886 EXPECT(func_b.IsInlineable()); |
| 3879 | 3887 |
| 3880 // After setting a breakpoint in a function A.b, it is no longer inlineable. | 3888 // After setting a breakpoint in a function A.b, it is no longer inlineable. |
| 3881 SourceBreakpoint* bpt = | 3889 SourceBreakpoint* bpt = |
| 3882 Isolate::Current()->debugger()->SetBreakpointAtLine(name, | 3890 Isolate::Current()->debugger()->SetBreakpointAtLine(name, |
| 3883 kBreakpointLine); | 3891 kBreakpointLine); |
| 3884 ASSERT(bpt != NULL); | 3892 ASSERT(bpt != NULL); |
| 3885 EXPECT(!func_b.IsInlineable()); | 3893 EXPECT(!func_b.IsInlineable()); |
| 3886 } | 3894 } |
| 3887 | 3895 |
| 3896 #endif // !defined(TARGET_ARCH_ARM64) | |
| 3897 | |
| 3888 | 3898 |
| 3889 TEST_CASE(SpecialClassesHaveEmptyArrays) { | 3899 TEST_CASE(SpecialClassesHaveEmptyArrays) { |
| 3890 ObjectStore* object_store = Isolate::Current()->object_store(); | 3900 ObjectStore* object_store = Isolate::Current()->object_store(); |
| 3891 Class& cls = Class::Handle(); | 3901 Class& cls = Class::Handle(); |
| 3892 Object& array = Object::Handle(); | 3902 Object& array = Object::Handle(); |
| 3893 | 3903 |
| 3894 cls = object_store->null_class(); | 3904 cls = object_store->null_class(); |
| 3895 array = cls.fields(); | 3905 array = cls.fields(); |
| 3896 EXPECT(!array.IsNull()); | 3906 EXPECT(!array.IsNull()); |
| 3897 EXPECT(array.IsArray()); | 3907 EXPECT(array.IsArray()); |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 3910 cls = Object::dynamic_class(); | 3920 cls = Object::dynamic_class(); |
| 3911 array = cls.fields(); | 3921 array = cls.fields(); |
| 3912 EXPECT(!array.IsNull()); | 3922 EXPECT(!array.IsNull()); |
| 3913 EXPECT(array.IsArray()); | 3923 EXPECT(array.IsArray()); |
| 3914 array = cls.functions(); | 3924 array = cls.functions(); |
| 3915 EXPECT(!array.IsNull()); | 3925 EXPECT(!array.IsNull()); |
| 3916 EXPECT(array.IsArray()); | 3926 EXPECT(array.IsArray()); |
| 3917 } | 3927 } |
| 3918 | 3928 |
| 3919 | 3929 |
| 3930 #if !defined(TARGET_ARCH_ARM64) | |
| 3931 | |
| 3920 TEST_CASE(ToUserCString) { | 3932 TEST_CASE(ToUserCString) { |
| 3921 const char* kScriptChars = | 3933 const char* kScriptChars = |
| 3922 "var simple = 'simple';\n" | 3934 "var simple = 'simple';\n" |
| 3923 "var escapes = 'stuff\\n\\r\\f\\b\\t\\v\\'\"\\$stuff';\n" | 3935 "var escapes = 'stuff\\n\\r\\f\\b\\t\\v\\'\"\\$stuff';\n" |
| 3924 "var uescapes = 'stuff\\u0001\\u0002stuff';\n" | 3936 "var uescapes = 'stuff\\u0001\\u0002stuff';\n" |
| 3925 "var toolong = " | 3937 "var toolong = " |
| 3926 "'01234567890123456789012345678901234567890123456789howdy';\n" | 3938 "'01234567890123456789012345678901234567890123456789howdy';\n" |
| 3927 "var toolong2 = " | 3939 "var toolong2 = " |
| 3928 "'0123456789012345678901234567890123\\t567890123456789howdy';\n" | 3940 "'0123456789012345678901234567890123\\t567890123456789howdy';\n" |
| 3929 "var toolong3 = " | 3941 "var toolong3 = " |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4005 }; | 4017 }; |
| 4006 | 4018 |
| 4007 | 4019 |
| 4008 TEST_CASE(PrintToJSONStream) { | 4020 TEST_CASE(PrintToJSONStream) { |
| 4009 Heap* heap = Isolate::Current()->heap(); | 4021 Heap* heap = Isolate::Current()->heap(); |
| 4010 heap->CollectAllGarbage(); | 4022 heap->CollectAllGarbage(); |
| 4011 JSONTypeVerifier verifier; | 4023 JSONTypeVerifier verifier; |
| 4012 heap->IterateObjects(&verifier); | 4024 heap->IterateObjects(&verifier); |
| 4013 } | 4025 } |
| 4014 | 4026 |
| 4027 #endif // !defined(TARGET_ARCH_ARM64) | |
| 4028 | |
| 4015 } // namespace dart | 4029 } // namespace dart |
| 4016 | |
| 4017 #endif // !defined(TARGET_ARCH_ARM64) | |
| OLD | NEW |