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 "vm/service.h" | 5 #include "vm/service.h" |
6 | 6 |
7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 #include "include/dart_native_api.h" | 8 #include "include/dart_native_api.h" |
9 #include "platform/globals.h" | 9 #include "platform/globals.h" |
10 | 10 |
(...skipping 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1094 return true; | 1094 return true; |
1095 } | 1095 } |
1096 } | 1096 } |
1097 return false; | 1097 return false; |
1098 } else { | 1098 } else { |
1099 return !(obj.IsInstance() || obj.IsNull()); | 1099 return !(obj.IsInstance() || obj.IsNull()); |
1100 } | 1100 } |
1101 } | 1101 } |
1102 | 1102 |
1103 | 1103 |
1104 static RawObject* LookupObjectId(Isolate* isolate, | 1104 static RawObject* LookupObjectId(Thread* thread, |
1105 const char* arg, | 1105 const char* arg, |
1106 ObjectIdRing::LookupResult* kind) { | 1106 ObjectIdRing::LookupResult* kind) { |
1107 *kind = ObjectIdRing::kValid; | 1107 *kind = ObjectIdRing::kValid; |
1108 if (strncmp(arg, "int-", 4) == 0) { | 1108 if (strncmp(arg, "int-", 4) == 0) { |
1109 arg += 4; | 1109 arg += 4; |
1110 int64_t value = 0; | 1110 int64_t value = 0; |
1111 if (!OS::StringToInt64(arg, &value) || | 1111 if (!OS::StringToInt64(arg, &value) || |
1112 !Smi::IsValid(value)) { | 1112 !Smi::IsValid(value)) { |
1113 *kind = ObjectIdRing::kInvalid; | 1113 *kind = ObjectIdRing::kInvalid; |
1114 return Object::null(); | 1114 return Object::null(); |
1115 } | 1115 } |
1116 const Integer& obj = Integer::Handle(isolate->current_zone(), | 1116 const Integer& obj = Integer::Handle(thread->zone(), |
1117 Smi::New(static_cast<intptr_t>(value))); | 1117 Smi::New(static_cast<intptr_t>(value))); |
1118 return obj.raw(); | 1118 return obj.raw(); |
1119 } else if (strcmp(arg, "bool-true") == 0) { | 1119 } else if (strcmp(arg, "bool-true") == 0) { |
1120 return Bool::True().raw(); | 1120 return Bool::True().raw(); |
1121 } else if (strcmp(arg, "bool-false") == 0) { | 1121 } else if (strcmp(arg, "bool-false") == 0) { |
1122 return Bool::False().raw(); | 1122 return Bool::False().raw(); |
1123 } else if (strcmp(arg, "null") == 0) { | 1123 } else if (strcmp(arg, "null") == 0) { |
1124 return Object::null(); | 1124 return Object::null(); |
1125 } | 1125 } |
1126 | 1126 |
1127 ObjectIdRing* ring = isolate->object_id_ring(); | 1127 ObjectIdRing* ring = thread->isolate()->object_id_ring(); |
1128 ASSERT(ring != NULL); | 1128 ASSERT(ring != NULL); |
1129 intptr_t id = -1; | 1129 intptr_t id = -1; |
1130 if (!GetIntegerId(arg, &id)) { | 1130 if (!GetIntegerId(arg, &id)) { |
1131 *kind = ObjectIdRing::kInvalid; | 1131 *kind = ObjectIdRing::kInvalid; |
1132 return Object::null(); | 1132 return Object::null(); |
1133 } | 1133 } |
1134 return ring->GetObjectForId(id, kind); | 1134 return ring->GetObjectForId(id, kind); |
1135 } | 1135 } |
1136 | 1136 |
1137 | 1137 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1178 if (script_url.Equals(requested_url)) { | 1178 if (script_url.Equals(requested_url)) { |
1179 return script.raw(); | 1179 return script.raw(); |
1180 } | 1180 } |
1181 } | 1181 } |
1182 } | 1182 } |
1183 | 1183 |
1184 // Not found. | 1184 // Not found. |
1185 return Object::sentinel().raw(); | 1185 return Object::sentinel().raw(); |
1186 } | 1186 } |
1187 | 1187 |
1188 static RawObject* LookupHeapObjectClasses(Isolate* isolate, | 1188 static RawObject* LookupHeapObjectClasses(Thread* thread, |
1189 char** parts, int num_parts) { | 1189 char** parts, int num_parts) { |
1190 // Class ids look like: "classes/17" | 1190 // Class ids look like: "classes/17" |
1191 if (num_parts < 2) { | 1191 if (num_parts < 2) { |
1192 return Object::sentinel().raw(); | 1192 return Object::sentinel().raw(); |
1193 } | 1193 } |
| 1194 Isolate* isolate = thread->isolate(); |
| 1195 Zone* zone = thread->zone(); |
1194 ClassTable* table = isolate->class_table(); | 1196 ClassTable* table = isolate->class_table(); |
1195 intptr_t id; | 1197 intptr_t id; |
1196 if (!GetIntegerId(parts[1], &id) || | 1198 if (!GetIntegerId(parts[1], &id) || |
1197 !table->IsValidIndex(id)) { | 1199 !table->IsValidIndex(id)) { |
1198 return Object::sentinel().raw(); | 1200 return Object::sentinel().raw(); |
1199 } | 1201 } |
1200 Class& cls = Class::Handle(table->At(id)); | 1202 Class& cls = Class::Handle(zone, table->At(id)); |
1201 if (num_parts == 2) { | 1203 if (num_parts == 2) { |
1202 return cls.raw(); | 1204 return cls.raw(); |
1203 } | 1205 } |
1204 if (strcmp(parts[2], "closures") == 0) { | 1206 if (strcmp(parts[2], "closures") == 0) { |
1205 // Closure ids look like: "classes/17/closures/11" | 1207 // Closure ids look like: "classes/17/closures/11" |
1206 if (num_parts != 4) { | 1208 if (num_parts != 4) { |
1207 return Object::sentinel().raw(); | 1209 return Object::sentinel().raw(); |
1208 } | 1210 } |
1209 intptr_t id; | 1211 intptr_t id; |
1210 if (!GetIntegerId(parts[3], &id)) { | 1212 if (!GetIntegerId(parts[3], &id)) { |
1211 return Object::sentinel().raw(); | 1213 return Object::sentinel().raw(); |
1212 } | 1214 } |
1213 Function& func = Function::Handle(); | 1215 Function& func = Function::Handle(zone); |
1214 func ^= cls.ClosureFunctionFromIndex(id); | 1216 func ^= cls.ClosureFunctionFromIndex(id); |
1215 if (func.IsNull()) { | 1217 if (func.IsNull()) { |
1216 return Object::sentinel().raw(); | 1218 return Object::sentinel().raw(); |
1217 } | 1219 } |
1218 return func.raw(); | 1220 return func.raw(); |
1219 | 1221 |
1220 } else if (strcmp(parts[2], "fields") == 0) { | 1222 } else if (strcmp(parts[2], "fields") == 0) { |
1221 // Field ids look like: "classes/17/fields/11" | 1223 // Field ids look like: "classes/17/fields/11" |
1222 if (num_parts != 4) { | 1224 if (num_parts != 4) { |
1223 return Object::sentinel().raw(); | 1225 return Object::sentinel().raw(); |
1224 } | 1226 } |
1225 intptr_t id; | 1227 intptr_t id; |
1226 if (!GetIntegerId(parts[3], &id)) { | 1228 if (!GetIntegerId(parts[3], &id)) { |
1227 return Object::sentinel().raw(); | 1229 return Object::sentinel().raw(); |
1228 } | 1230 } |
1229 Field& field = Field::Handle(cls.FieldFromIndex(id)); | 1231 Field& field = Field::Handle(zone, cls.FieldFromIndex(id)); |
1230 if (field.IsNull()) { | 1232 if (field.IsNull()) { |
1231 return Object::sentinel().raw(); | 1233 return Object::sentinel().raw(); |
1232 } | 1234 } |
1233 return field.raw(); | 1235 return field.raw(); |
1234 | 1236 |
1235 } else if (strcmp(parts[2], "functions") == 0) { | 1237 } else if (strcmp(parts[2], "functions") == 0) { |
1236 // Function ids look like: "classes/17/functions/11" | 1238 // Function ids look like: "classes/17/functions/11" |
1237 if (num_parts != 4) { | 1239 if (num_parts != 4) { |
1238 return Object::sentinel().raw(); | 1240 return Object::sentinel().raw(); |
1239 } | 1241 } |
1240 const char* encoded_id = parts[3]; | 1242 const char* encoded_id = parts[3]; |
1241 String& id = String::Handle(isolate->current_zone(), | 1243 String& id = String::Handle(zone, String::New(encoded_id)); |
1242 String::New(encoded_id)); | |
1243 id = String::DecodeIRI(id); | 1244 id = String::DecodeIRI(id); |
1244 if (id.IsNull()) { | 1245 if (id.IsNull()) { |
1245 return Object::sentinel().raw(); | 1246 return Object::sentinel().raw(); |
1246 } | 1247 } |
1247 Function& func = Function::Handle(cls.LookupFunction(id)); | 1248 Function& func = Function::Handle(zone, cls.LookupFunction(id)); |
1248 if (func.IsNull()) { | 1249 if (func.IsNull()) { |
1249 return Object::sentinel().raw(); | 1250 return Object::sentinel().raw(); |
1250 } | 1251 } |
1251 return func.raw(); | 1252 return func.raw(); |
1252 | 1253 |
1253 } else if (strcmp(parts[2], "implicit_closures") == 0) { | 1254 } else if (strcmp(parts[2], "implicit_closures") == 0) { |
1254 // Function ids look like: "classes/17/implicit_closures/11" | 1255 // Function ids look like: "classes/17/implicit_closures/11" |
1255 if (num_parts != 4) { | 1256 if (num_parts != 4) { |
1256 return Object::sentinel().raw(); | 1257 return Object::sentinel().raw(); |
1257 } | 1258 } |
1258 intptr_t id; | 1259 intptr_t id; |
1259 if (!GetIntegerId(parts[3], &id)) { | 1260 if (!GetIntegerId(parts[3], &id)) { |
1260 return Object::sentinel().raw(); | 1261 return Object::sentinel().raw(); |
1261 } | 1262 } |
1262 Function& func = Function::Handle(); | 1263 Function& func = Function::Handle(zone); |
1263 func ^= cls.ImplicitClosureFunctionFromIndex(id); | 1264 func ^= cls.ImplicitClosureFunctionFromIndex(id); |
1264 if (func.IsNull()) { | 1265 if (func.IsNull()) { |
1265 return Object::sentinel().raw(); | 1266 return Object::sentinel().raw(); |
1266 } | 1267 } |
1267 return func.raw(); | 1268 return func.raw(); |
1268 | 1269 |
1269 } else if (strcmp(parts[2], "dispatchers") == 0) { | 1270 } else if (strcmp(parts[2], "dispatchers") == 0) { |
1270 // Dispatcher Function ids look like: "classes/17/dispatchers/11" | 1271 // Dispatcher Function ids look like: "classes/17/dispatchers/11" |
1271 if (num_parts != 4) { | 1272 if (num_parts != 4) { |
1272 return Object::sentinel().raw(); | 1273 return Object::sentinel().raw(); |
1273 } | 1274 } |
1274 intptr_t id; | 1275 intptr_t id; |
1275 if (!GetIntegerId(parts[3], &id)) { | 1276 if (!GetIntegerId(parts[3], &id)) { |
1276 return Object::sentinel().raw(); | 1277 return Object::sentinel().raw(); |
1277 } | 1278 } |
1278 Function& func = Function::Handle(); | 1279 Function& func = Function::Handle(zone); |
1279 func ^= cls.InvocationDispatcherFunctionFromIndex(id); | 1280 func ^= cls.InvocationDispatcherFunctionFromIndex(id); |
1280 if (func.IsNull()) { | 1281 if (func.IsNull()) { |
1281 return Object::sentinel().raw(); | 1282 return Object::sentinel().raw(); |
1282 } | 1283 } |
1283 return func.raw(); | 1284 return func.raw(); |
1284 | 1285 |
1285 } else if (strcmp(parts[2], "types") == 0) { | 1286 } else if (strcmp(parts[2], "types") == 0) { |
1286 // Type ids look like: "classes/17/types/11" | 1287 // Type ids look like: "classes/17/types/11" |
1287 if (num_parts != 4) { | 1288 if (num_parts != 4) { |
1288 return Object::sentinel().raw(); | 1289 return Object::sentinel().raw(); |
1289 } | 1290 } |
1290 intptr_t id; | 1291 intptr_t id; |
1291 if (!GetIntegerId(parts[3], &id)) { | 1292 if (!GetIntegerId(parts[3], &id)) { |
1292 return Object::sentinel().raw(); | 1293 return Object::sentinel().raw(); |
1293 } | 1294 } |
1294 Type& type = Type::Handle(); | 1295 Type& type = Type::Handle(zone); |
1295 type ^= cls.CanonicalTypeFromIndex(id); | 1296 type ^= cls.CanonicalTypeFromIndex(id); |
1296 if (type.IsNull()) { | 1297 if (type.IsNull()) { |
1297 return Object::sentinel().raw(); | 1298 return Object::sentinel().raw(); |
1298 } | 1299 } |
1299 return type.raw(); | 1300 return type.raw(); |
1300 } | 1301 } |
1301 | 1302 |
1302 // Not found. | 1303 // Not found. |
1303 return Object::sentinel().raw(); | 1304 return Object::sentinel().raw(); |
1304 } | 1305 } |
1305 | 1306 |
1306 | 1307 |
1307 static RawObject* LookupHeapObjectTypeArguments(Isolate* isolate, | 1308 static RawObject* LookupHeapObjectTypeArguments(Thread* thread, |
1308 char** parts, int num_parts) { | 1309 char** parts, int num_parts) { |
| 1310 Isolate* isolate = thread->isolate(); |
1309 // TypeArguments ids look like: "typearguments/17" | 1311 // TypeArguments ids look like: "typearguments/17" |
1310 if (num_parts < 2) { | 1312 if (num_parts < 2) { |
1311 return Object::sentinel().raw(); | 1313 return Object::sentinel().raw(); |
1312 } | 1314 } |
1313 intptr_t id; | 1315 intptr_t id; |
1314 if (!GetIntegerId(parts[1], &id)) { | 1316 if (!GetIntegerId(parts[1], &id)) { |
1315 return Object::sentinel().raw(); | 1317 return Object::sentinel().raw(); |
1316 } | 1318 } |
1317 ObjectStore* object_store = isolate->object_store(); | 1319 ObjectStore* object_store = isolate->object_store(); |
1318 const Array& table = Array::Handle(object_store->canonical_type_arguments()); | 1320 const Array& table = Array::Handle(thread->zone(), |
| 1321 object_store->canonical_type_arguments()); |
1319 ASSERT(table.Length() > 0); | 1322 ASSERT(table.Length() > 0); |
1320 const intptr_t table_size = table.Length() - 1; | 1323 const intptr_t table_size = table.Length() - 1; |
1321 if ((id < 0) || (id >= table_size) || (table.At(id) == Object::null())) { | 1324 if ((id < 0) || (id >= table_size) || (table.At(id) == Object::null())) { |
1322 return Object::sentinel().raw(); | 1325 return Object::sentinel().raw(); |
1323 } | 1326 } |
1324 return table.At(id); | 1327 return table.At(id); |
1325 } | 1328 } |
1326 | 1329 |
1327 | 1330 |
1328 static RawObject* LookupHeapObjectCode(Isolate* isolate, | 1331 static RawObject* LookupHeapObjectCode(Isolate* isolate, |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1392 MessageSnapshotReader reader(message->data(), | 1395 MessageSnapshotReader reader(message->data(), |
1393 message->len(), | 1396 message->len(), |
1394 Thread::Current()); | 1397 Thread::Current()); |
1395 return reader.ReadObject(); | 1398 return reader.ReadObject(); |
1396 } | 1399 } |
1397 | 1400 |
1398 | 1401 |
1399 static RawObject* LookupHeapObject(Isolate* isolate, | 1402 static RawObject* LookupHeapObject(Isolate* isolate, |
1400 const char* id_original, | 1403 const char* id_original, |
1401 ObjectIdRing::LookupResult* result) { | 1404 ObjectIdRing::LookupResult* result) { |
1402 char* id = Thread::Current()->zone()->MakeCopyOfString(id_original); | 1405 Thread* thread = Thread::Current(); |
| 1406 char* id = thread->zone()->MakeCopyOfString(id_original); |
1403 | 1407 |
1404 // Parse the id by splitting at each '/'. | 1408 // Parse the id by splitting at each '/'. |
1405 const int MAX_PARTS = 8; | 1409 const int MAX_PARTS = 8; |
1406 char* parts[MAX_PARTS]; | 1410 char* parts[MAX_PARTS]; |
1407 int num_parts = 0; | 1411 int num_parts = 0; |
1408 int i = 0; | 1412 int i = 0; |
1409 int start_pos = 0; | 1413 int start_pos = 0; |
1410 while (id[i] != '\0') { | 1414 while (id[i] != '\0') { |
1411 if (id[i] == '/') { | 1415 if (id[i] == '/') { |
1412 id[i++] = '\0'; | 1416 id[i++] = '\0'; |
1413 parts[num_parts++] = &id[start_pos]; | 1417 parts[num_parts++] = &id[start_pos]; |
1414 if (num_parts == MAX_PARTS) { | 1418 if (num_parts == MAX_PARTS) { |
1415 break; | 1419 break; |
1416 } | 1420 } |
1417 start_pos = i; | 1421 start_pos = i; |
1418 } else { | 1422 } else { |
1419 i++; | 1423 i++; |
1420 } | 1424 } |
1421 } | 1425 } |
1422 if (num_parts < MAX_PARTS) { | 1426 if (num_parts < MAX_PARTS) { |
1423 parts[num_parts++] = &id[start_pos]; | 1427 parts[num_parts++] = &id[start_pos]; |
1424 } | 1428 } |
1425 | 1429 |
1426 if (result != NULL) { | 1430 if (result != NULL) { |
1427 *result = ObjectIdRing::kValid; | 1431 *result = ObjectIdRing::kValid; |
1428 } | 1432 } |
1429 | 1433 |
1430 if (strcmp(parts[0], "objects") == 0) { | 1434 if (strcmp(parts[0], "objects") == 0) { |
1431 // Object ids look like "objects/1123" | 1435 // Object ids look like "objects/1123" |
1432 Object& obj = Object::Handle(isolate->current_zone()); | 1436 Object& obj = Object::Handle(thread->zone()); |
1433 ObjectIdRing::LookupResult lookup_result; | 1437 ObjectIdRing::LookupResult lookup_result; |
1434 obj = LookupObjectId(isolate, parts[1], &lookup_result); | 1438 obj = LookupObjectId(thread, parts[1], &lookup_result); |
1435 if (lookup_result != ObjectIdRing::kValid) { | 1439 if (lookup_result != ObjectIdRing::kValid) { |
1436 if (result != NULL) { | 1440 if (result != NULL) { |
1437 *result = lookup_result; | 1441 *result = lookup_result; |
1438 } | 1442 } |
1439 return Object::sentinel().raw(); | 1443 return Object::sentinel().raw(); |
1440 } | 1444 } |
1441 return obj.raw(); | 1445 return obj.raw(); |
1442 | 1446 |
1443 } else if (strcmp(parts[0], "libraries") == 0) { | 1447 } else if (strcmp(parts[0], "libraries") == 0) { |
1444 return LookupHeapObjectLibraries(isolate, parts, num_parts); | 1448 return LookupHeapObjectLibraries(isolate, parts, num_parts); |
1445 } else if (strcmp(parts[0], "classes") == 0) { | 1449 } else if (strcmp(parts[0], "classes") == 0) { |
1446 return LookupHeapObjectClasses(isolate, parts, num_parts); | 1450 return LookupHeapObjectClasses(thread, parts, num_parts); |
1447 } else if (strcmp(parts[0], "typearguments") == 0) { | 1451 } else if (strcmp(parts[0], "typearguments") == 0) { |
1448 return LookupHeapObjectTypeArguments(isolate, parts, num_parts); | 1452 return LookupHeapObjectTypeArguments(thread, parts, num_parts); |
1449 } else if (strcmp(parts[0], "code") == 0) { | 1453 } else if (strcmp(parts[0], "code") == 0) { |
1450 return LookupHeapObjectCode(isolate, parts, num_parts); | 1454 return LookupHeapObjectCode(isolate, parts, num_parts); |
1451 } else if (strcmp(parts[0], "messages") == 0) { | 1455 } else if (strcmp(parts[0], "messages") == 0) { |
1452 return LookupHeapObjectMessage(isolate, parts, num_parts); | 1456 return LookupHeapObjectMessage(isolate, parts, num_parts); |
1453 } | 1457 } |
1454 | 1458 |
1455 // Not found. | 1459 // Not found. |
1456 return Object::sentinel().raw(); | 1460 return Object::sentinel().raw(); |
1457 } | 1461 } |
1458 | 1462 |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1772 const char* target_id = js->LookupParam("targetId"); | 1776 const char* target_id = js->LookupParam("targetId"); |
1773 if (target_id == NULL) { | 1777 if (target_id == NULL) { |
1774 PrintMissingParamError(js, "targetId"); | 1778 PrintMissingParamError(js, "targetId"); |
1775 return true; | 1779 return true; |
1776 } | 1780 } |
1777 const char* expr = js->LookupParam("expression"); | 1781 const char* expr = js->LookupParam("expression"); |
1778 if (expr == NULL) { | 1782 if (expr == NULL) { |
1779 PrintMissingParamError(js, "expression"); | 1783 PrintMissingParamError(js, "expression"); |
1780 return true; | 1784 return true; |
1781 } | 1785 } |
1782 const String& expr_str = | 1786 Zone* zone = Thread::Current()->zone(); |
1783 String::Handle(isolate->current_zone(), String::New(expr)); | 1787 const String& expr_str = String::Handle(zone, String::New(expr)); |
1784 ObjectIdRing::LookupResult lookup_result; | 1788 ObjectIdRing::LookupResult lookup_result; |
1785 Object& obj = Object::Handle(LookupHeapObject(isolate, target_id, | 1789 Object& obj = Object::Handle(zone, LookupHeapObject(isolate, target_id, |
1786 &lookup_result)); | 1790 &lookup_result)); |
1787 if (obj.raw() == Object::sentinel().raw()) { | 1791 if (obj.raw() == Object::sentinel().raw()) { |
1788 if (lookup_result == ObjectIdRing::kCollected) { | 1792 if (lookup_result == ObjectIdRing::kCollected) { |
1789 PrintSentinel(js, kCollectedSentinel); | 1793 PrintSentinel(js, kCollectedSentinel); |
1790 } else if (lookup_result == ObjectIdRing::kExpired) { | 1794 } else if (lookup_result == ObjectIdRing::kExpired) { |
1791 PrintSentinel(js, kExpiredSentinel); | 1795 PrintSentinel(js, kExpiredSentinel); |
1792 } else { | 1796 } else { |
1793 PrintInvalidParamError(js, "targetId"); | 1797 PrintInvalidParamError(js, "targetId"); |
1794 } | 1798 } |
1795 return true; | 1799 return true; |
1796 } | 1800 } |
1797 if (obj.IsLibrary()) { | 1801 if (obj.IsLibrary()) { |
1798 const Library& lib = Library::Cast(obj); | 1802 const Library& lib = Library::Cast(obj); |
1799 const Object& result = Object::Handle(lib.Evaluate(expr_str, | 1803 const Object& result = Object::Handle(zone, |
1800 Array::empty_array(), | 1804 lib.Evaluate(expr_str, Array::empty_array(), Array::empty_array())); |
1801 Array::empty_array())); | |
1802 result.PrintJSON(js, true); | 1805 result.PrintJSON(js, true); |
1803 return true; | 1806 return true; |
1804 } | 1807 } |
1805 if (obj.IsClass()) { | 1808 if (obj.IsClass()) { |
1806 const Class& cls = Class::Cast(obj); | 1809 const Class& cls = Class::Cast(obj); |
1807 const Object& result = Object::Handle(cls.Evaluate(expr_str, | 1810 const Object& result = Object::Handle(zone, |
1808 Array::empty_array(), | 1811 cls.Evaluate(expr_str, Array::empty_array(), Array::empty_array())); |
1809 Array::empty_array())); | |
1810 result.PrintJSON(js, true); | 1812 result.PrintJSON(js, true); |
1811 return true; | 1813 return true; |
1812 } | 1814 } |
1813 if ((obj.IsInstance() || obj.IsNull()) && | 1815 if ((obj.IsInstance() || obj.IsNull()) && |
1814 !ContainsNonInstance(obj)) { | 1816 !ContainsNonInstance(obj)) { |
1815 // We don't use Instance::Cast here because it doesn't allow null. | 1817 // We don't use Instance::Cast here because it doesn't allow null. |
1816 Instance& instance = Instance::Handle(isolate->current_zone()); | 1818 Instance& instance = Instance::Handle(zone); |
1817 instance ^= obj.raw(); | 1819 instance ^= obj.raw(); |
1818 const Object& result = | 1820 const Object& result = |
1819 Object::Handle(instance.Evaluate(expr_str, | 1821 Object::Handle(zone, instance.Evaluate(expr_str, |
1820 Array::empty_array(), | 1822 Array::empty_array(), |
1821 Array::empty_array())); | 1823 Array::empty_array())); |
1822 result.PrintJSON(js, true); | 1824 result.PrintJSON(js, true); |
1823 return true; | 1825 return true; |
1824 } | 1826 } |
1825 js->PrintError(kInvalidParams, | 1827 js->PrintError(kInvalidParams, |
1826 "%s: invalid 'targetId' parameter: " | 1828 "%s: invalid 'targetId' parameter: " |
1827 "id '%s' does not correspond to a " | 1829 "id '%s' does not correspond to a " |
1828 "library, class, or instance", js->method(), target_id); | 1830 "library, class, or instance", js->method(), target_id); |
1829 return true; | 1831 return true; |
1830 } | 1832 } |
1831 | 1833 |
(...skipping 13 matching lines...) Expand all Loading... |
1845 return true; | 1847 return true; |
1846 } | 1848 } |
1847 DebuggerStackTrace* stack = isolate->debugger()->StackTrace(); | 1849 DebuggerStackTrace* stack = isolate->debugger()->StackTrace(); |
1848 intptr_t framePos = UIntParameter::Parse(js->LookupParam("frameIndex")); | 1850 intptr_t framePos = UIntParameter::Parse(js->LookupParam("frameIndex")); |
1849 if (framePos > stack->Length()) { | 1851 if (framePos > stack->Length()) { |
1850 PrintInvalidParamError(js, "frameIndex"); | 1852 PrintInvalidParamError(js, "frameIndex"); |
1851 return true; | 1853 return true; |
1852 } | 1854 } |
1853 ActivationFrame* frame = stack->FrameAt(framePos); | 1855 ActivationFrame* frame = stack->FrameAt(framePos); |
1854 | 1856 |
| 1857 Zone* zone = Thread::Current()->zone(); |
1855 const char* expr = js->LookupParam("expression"); | 1858 const char* expr = js->LookupParam("expression"); |
1856 const String& expr_str = String::Handle(isolate->current_zone(), | 1859 const String& expr_str = String::Handle(zone, String::New(expr)); |
1857 String::New(expr)); | |
1858 | 1860 |
1859 const Object& result = Object::Handle(frame->Evaluate(expr_str)); | 1861 const Object& result = Object::Handle(zone, frame->Evaluate(expr_str)); |
1860 result.PrintJSON(js, true); | 1862 result.PrintJSON(js, true); |
1861 return true; | 1863 return true; |
1862 } | 1864 } |
1863 | 1865 |
1864 | 1866 |
1865 class GetInstancesVisitor : public ObjectGraph::Visitor { | 1867 class GetInstancesVisitor : public ObjectGraph::Visitor { |
1866 public: | 1868 public: |
1867 GetInstancesVisitor(const Class& cls, const Array& storage) | 1869 GetInstancesVisitor(const Class& cls, const Array& storage) |
1868 : cls_(cls), storage_(storage), count_(0) {} | 1870 : cls_(cls), storage_(storage), count_(0) {} |
1869 | 1871 |
(...skipping 1454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3324 ServiceMethodDescriptor& method = service_methods_[i]; | 3326 ServiceMethodDescriptor& method = service_methods_[i]; |
3325 if (strcmp(method_name, method.name) == 0) { | 3327 if (strcmp(method_name, method.name) == 0) { |
3326 return &method; | 3328 return &method; |
3327 } | 3329 } |
3328 } | 3330 } |
3329 return NULL; | 3331 return NULL; |
3330 } | 3332 } |
3331 | 3333 |
3332 | 3334 |
3333 } // namespace dart | 3335 } // namespace dart |
OLD | NEW |