OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 "include/dart_tools_api.h" | 7 #include "include/dart_tools_api.h" |
8 #include "vm/dart_api_impl.h" | 8 #include "vm/dart_api_impl.h" |
9 #include "vm/dart_entry.h" | 9 #include "vm/dart_entry.h" |
10 #include "vm/debugger.h" | 10 #include "vm/debugger.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 | 48 |
49 private: | 49 private: |
50 char* _msg; | 50 char* _msg; |
51 }; | 51 }; |
52 | 52 |
53 | 53 |
54 static RawArray* Eval(Dart_Handle lib, const char* expr) { | 54 static RawArray* Eval(Dart_Handle lib, const char* expr) { |
55 const String& dummy_isolate_id = String::Handle(String::New("isolateId")); | 55 const String& dummy_isolate_id = String::Handle(String::New("isolateId")); |
56 Dart_Handle expr_val = Dart_EvaluateExpr(lib, NewString(expr)); | 56 Dart_Handle expr_val = Dart_EvaluateExpr(lib, NewString(expr)); |
57 EXPECT_VALID(expr_val); | 57 EXPECT_VALID(expr_val); |
58 Isolate* isolate = Isolate::Current(); | 58 Zone* zone = Thread::Current()->zone(); |
59 const GrowableObjectArray& value = | 59 const GrowableObjectArray& value = |
60 Api::UnwrapGrowableObjectArrayHandle(isolate, expr_val); | 60 Api::UnwrapGrowableObjectArrayHandle(zone, expr_val); |
61 const Array& result = Array::Handle(Array::MakeArray(value)); | 61 const Array& result = Array::Handle(Array::MakeArray(value)); |
62 GrowableObjectArray& growable = GrowableObjectArray::Handle(); | 62 GrowableObjectArray& growable = GrowableObjectArray::Handle(); |
63 growable ^= result.At(4); | 63 growable ^= result.At(4); |
64 // Append dummy isolate id to parameter values. | 64 // Append dummy isolate id to parameter values. |
65 growable.Add(dummy_isolate_id); | 65 growable.Add(dummy_isolate_id); |
66 Array& array = Array::Handle(Array::MakeArray(growable)); | 66 Array& array = Array::Handle(Array::MakeArray(growable)); |
67 result.SetAt(4, array); | 67 result.SetAt(4, array); |
68 growable ^= result.At(5); | 68 growable ^= result.At(5); |
69 // Append dummy isolate id to parameter values. | 69 // Append dummy isolate id to parameter values. |
70 growable.Add(dummy_isolate_id); | 70 growable.Add(dummy_isolate_id); |
(...skipping 29 matching lines...) Expand all Loading... |
100 | 100 |
101 static RawClass* GetClass(const Library& lib, const char* name) { | 101 static RawClass* GetClass(const Library& lib, const char* name) { |
102 const Class& cls = Class::Handle( | 102 const Class& cls = Class::Handle( |
103 lib.LookupClass(String::Handle(Symbols::New(name)))); | 103 lib.LookupClass(String::Handle(Symbols::New(name)))); |
104 EXPECT(!cls.IsNull()); // No ambiguity error expected. | 104 EXPECT(!cls.IsNull()); // No ambiguity error expected. |
105 return cls.raw(); | 105 return cls.raw(); |
106 } | 106 } |
107 | 107 |
108 | 108 |
109 TEST_CASE(Service_IdZones) { | 109 TEST_CASE(Service_IdZones) { |
110 Isolate* isolate = Isolate::Current(); | 110 Zone* zone = thread->zone(); |
| 111 Isolate* isolate = thread->isolate(); |
111 ObjectIdRing* ring = isolate->object_id_ring(); | 112 ObjectIdRing* ring = isolate->object_id_ring(); |
112 | 113 |
113 const String& test_a = String::Handle(isolate, String::New("a")); | 114 const String& test_a = String::Handle(zone, String::New("a")); |
114 const String& test_b = String::Handle(isolate, String::New("b")); | 115 const String& test_b = String::Handle(zone, String::New("b")); |
115 const String& test_c = String::Handle(isolate, String::New("c")); | 116 const String& test_c = String::Handle(zone, String::New("c")); |
116 const String& test_d = String::Handle(isolate, String::New("d")); | 117 const String& test_d = String::Handle(zone, String::New("d")); |
117 | 118 |
118 // Both RingServiceIdZones share the same backing store and id space. | 119 // Both RingServiceIdZones share the same backing store and id space. |
119 | 120 |
120 // Always allocate a new id. | 121 // Always allocate a new id. |
121 RingServiceIdZone always_new_zone; | 122 RingServiceIdZone always_new_zone; |
122 always_new_zone.Init(ring, ObjectIdRing::kAllocateId); | 123 always_new_zone.Init(ring, ObjectIdRing::kAllocateId); |
123 EXPECT_STREQ("objects/0", always_new_zone.GetServiceId(test_a)); | 124 EXPECT_STREQ("objects/0", always_new_zone.GetServiceId(test_a)); |
124 EXPECT_STREQ("objects/1", always_new_zone.GetServiceId(test_a)); | 125 EXPECT_STREQ("objects/1", always_new_zone.GetServiceId(test_a)); |
125 EXPECT_STREQ("objects/2", always_new_zone.GetServiceId(test_a)); | 126 EXPECT_STREQ("objects/2", always_new_zone.GetServiceId(test_a)); |
126 EXPECT_STREQ("objects/3", always_new_zone.GetServiceId(test_b)); | 127 EXPECT_STREQ("objects/3", always_new_zone.GetServiceId(test_b)); |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 Eval(lib, "[0, port, '0', '_getCpuProfile', ['tags'], ['Bogus']]"); | 627 Eval(lib, "[0, port, '0', '_getCpuProfile', ['tags'], ['Bogus']]"); |
627 Service::HandleIsolateMessage(isolate, service_msg); | 628 Service::HandleIsolateMessage(isolate, service_msg); |
628 EXPECT_EQ(MessageHandler::kOK, handler.HandleNextMessage()); | 629 EXPECT_EQ(MessageHandler::kOK, handler.HandleNextMessage()); |
629 // Expect error. | 630 // Expect error. |
630 EXPECT_SUBSTRING("\"error\"", handler.msg()); | 631 EXPECT_SUBSTRING("\"error\"", handler.msg()); |
631 } | 632 } |
632 | 633 |
633 #endif // !defined(TARGET_ARCH_ARM64) | 634 #endif // !defined(TARGET_ARCH_ARM64) |
634 | 635 |
635 } // namespace dart | 636 } // namespace dart |
OLD | NEW |