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 #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 4015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4026 EXPECT_NE(a_test1.SourceFingerprint(), a_test2.SourceFingerprint()); | 4026 EXPECT_NE(a_test1.SourceFingerprint(), a_test2.SourceFingerprint()); |
4027 EXPECT_NE(a_test2.SourceFingerprint(), a_test3.SourceFingerprint()); | 4027 EXPECT_NE(a_test2.SourceFingerprint(), a_test3.SourceFingerprint()); |
4028 EXPECT_NE(a_test3.SourceFingerprint(), a_test4.SourceFingerprint()); | 4028 EXPECT_NE(a_test3.SourceFingerprint(), a_test4.SourceFingerprint()); |
4029 EXPECT_NE(a_test4.SourceFingerprint(), a_test5.SourceFingerprint()); | 4029 EXPECT_NE(a_test4.SourceFingerprint(), a_test5.SourceFingerprint()); |
4030 EXPECT_EQ(a_test5.SourceFingerprint(), b_test5.SourceFingerprint()); | 4030 EXPECT_EQ(a_test5.SourceFingerprint(), b_test5.SourceFingerprint()); |
4031 EXPECT_NE(a_test6.SourceFingerprint(), b_test6.SourceFingerprint()); | 4031 EXPECT_NE(a_test6.SourceFingerprint(), b_test6.SourceFingerprint()); |
4032 } | 4032 } |
4033 | 4033 |
4034 | 4034 |
4035 TEST_CASE(FunctionWithBreakpointNotInlined) { | 4035 TEST_CASE(FunctionWithBreakpointNotInlined) { |
| 4036 if (!FLAG_support_debugger) { |
| 4037 return; |
| 4038 } |
4036 const char* kScriptChars = | 4039 const char* kScriptChars = |
4037 "class A {\n" | 4040 "class A {\n" |
4038 " a() {\n" | 4041 " a() {\n" |
4039 " }\n" | 4042 " }\n" |
4040 " b() {\n" | 4043 " b() {\n" |
4041 " a();\n" // This is line 5. | 4044 " a();\n" // This is line 5. |
4042 " }\n" | 4045 " }\n" |
4043 "}\n" | 4046 "}\n" |
4044 "test() {\n" | 4047 "test() {\n" |
4045 " new A().b();\n" | 4048 " new A().b();\n" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4095 cls = Object::dynamic_class(); | 4098 cls = Object::dynamic_class(); |
4096 array = cls.fields(); | 4099 array = cls.fields(); |
4097 EXPECT(!array.IsNull()); | 4100 EXPECT(!array.IsNull()); |
4098 EXPECT(array.IsArray()); | 4101 EXPECT(array.IsArray()); |
4099 array = cls.functions(); | 4102 array = cls.functions(); |
4100 EXPECT(!array.IsNull()); | 4103 EXPECT(!array.IsNull()); |
4101 EXPECT(array.IsArray()); | 4104 EXPECT(array.IsArray()); |
4102 } | 4105 } |
4103 | 4106 |
4104 | 4107 |
| 4108 #ifndef PRODUCT |
| 4109 |
| 4110 |
4105 class ObjectAccumulator : public ObjectVisitor { | 4111 class ObjectAccumulator : public ObjectVisitor { |
4106 public: | 4112 public: |
4107 explicit ObjectAccumulator(GrowableArray<Object*>* objects) | 4113 explicit ObjectAccumulator(GrowableArray<Object*>* objects) |
4108 : ObjectVisitor(Isolate::Current()), objects_(objects) {} | 4114 : ObjectVisitor(Isolate::Current()), objects_(objects) {} |
4109 virtual ~ObjectAccumulator() { } | 4115 virtual ~ObjectAccumulator() { } |
4110 virtual void VisitObject(RawObject* obj) { | 4116 virtual void VisitObject(RawObject* obj) { |
4111 // Free-list elements cannot even be wrapped in handles. | 4117 // Free-list elements cannot even be wrapped in handles. |
4112 if (obj->IsFreeListElement()) { | 4118 if (obj->IsFreeListElement()) { |
4113 return; | 4119 return; |
4114 } | 4120 } |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4423 LiteralToken& tok = LiteralToken::Handle(LiteralToken::New()); | 4429 LiteralToken& tok = LiteralToken::Handle(LiteralToken::New()); |
4424 tok.PrintJSON(&js, true); | 4430 tok.PrintJSON(&js, true); |
4425 ElideJSONSubstring("objects", js.ToCString(), buffer); | 4431 ElideJSONSubstring("objects", js.ToCString(), buffer); |
4426 EXPECT_STREQ( | 4432 EXPECT_STREQ( |
4427 "{\"type\":\"@Object\",\"_vmType\":\"LiteralToken\",\"id\":\"\"}", | 4433 "{\"type\":\"@Object\",\"_vmType\":\"LiteralToken\",\"id\":\"\"}", |
4428 buffer); | 4434 buffer); |
4429 } | 4435 } |
4430 } | 4436 } |
4431 | 4437 |
4432 | 4438 |
| 4439 #endif // !PRODUCT |
| 4440 |
| 4441 |
4433 TEST_CASE(InstanceEquality) { | 4442 TEST_CASE(InstanceEquality) { |
4434 // Test that Instance::OperatorEquals can call a user-defined operator==. | 4443 // Test that Instance::OperatorEquals can call a user-defined operator==. |
4435 const char* kScript = | 4444 const char* kScript = |
4436 "class A {\n" | 4445 "class A {\n" |
4437 " bool operator==(A other) { return true; }\n" | 4446 " bool operator==(A other) { return true; }\n" |
4438 "}\n" | 4447 "}\n" |
4439 "main() {\n" | 4448 "main() {\n" |
4440 " A a = new A();\n" | 4449 " A a = new A();\n" |
4441 "}"; | 4450 "}"; |
4442 | 4451 |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4696 String& test = String::Handle(); | 4705 String& test = String::Handle(); |
4697 String& result = String::Handle(); | 4706 String& result = String::Handle(); |
4698 for (size_t i = 0; i < ARRAY_SIZE(tests); i++) { | 4707 for (size_t i = 0; i < ARRAY_SIZE(tests); i++) { |
4699 test = String::New(tests[i].in); | 4708 test = String::New(tests[i].in); |
4700 result = String::IdentifierPrettyName(test); | 4709 result = String::IdentifierPrettyName(test); |
4701 EXPECT_STREQ(tests[i].out, result.ToCString()); | 4710 EXPECT_STREQ(tests[i].out, result.ToCString()); |
4702 } | 4711 } |
4703 } | 4712 } |
4704 | 4713 |
4705 } // namespace dart | 4714 } // namespace dart |
OLD | NEW |