| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 | 411 |
| 412 TEST(ObservationWeakMap) { | 412 TEST(ObservationWeakMap) { |
| 413 HarmonyIsolate isolate; | 413 HarmonyIsolate isolate; |
| 414 HandleScope scope(isolate.GetIsolate()); | 414 HandleScope scope(isolate.GetIsolate()); |
| 415 v8::LocalContext context; | 415 v8::LocalContext context; |
| 416 CompileRun( | 416 CompileRun( |
| 417 "var obj = {};" | 417 "var obj = {};" |
| 418 "Object.observe(obj, function(){});" | 418 "Object.observe(obj, function(){});" |
| 419 "Object.getNotifier(obj);" | 419 "Object.getNotifier(obj);" |
| 420 "obj = null;"); | 420 "obj = null;"); |
| 421 i::Handle<i::JSObject> observation_state = FACTORY->observation_state(); | 421 i::Handle<i::JSObject> observation_state = |
| 422 i::Isolate::Current()->factory()->observation_state(); |
| 422 i::Handle<i::JSWeakMap> observerInfoMap = | 423 i::Handle<i::JSWeakMap> observerInfoMap = |
| 423 i::Handle<i::JSWeakMap>::cast( | 424 i::Handle<i::JSWeakMap>::cast( |
| 424 i::GetProperty(observation_state, "observerInfoMap")); | 425 i::GetProperty(observation_state, "observerInfoMap")); |
| 425 i::Handle<i::JSWeakMap> objectInfoMap = | 426 i::Handle<i::JSWeakMap> objectInfoMap = |
| 426 i::Handle<i::JSWeakMap>::cast( | 427 i::Handle<i::JSWeakMap>::cast( |
| 427 i::GetProperty(observation_state, "objectInfoMap")); | 428 i::GetProperty(observation_state, "objectInfoMap")); |
| 428 i::Handle<i::JSWeakMap> notifierTargetMap = | 429 i::Handle<i::JSWeakMap> notifierTargetMap = |
| 429 i::Handle<i::JSWeakMap>::cast( | 430 i::Handle<i::JSWeakMap>::cast( |
| 430 i::GetProperty(observation_state, "notifierTargetMap")); | 431 i::GetProperty(observation_state, "notifierTargetMap")); |
| 431 CHECK_EQ(1, NumberOfElements(observerInfoMap)); | 432 CHECK_EQ(1, NumberOfElements(observerInfoMap)); |
| 432 CHECK_EQ(1, NumberOfElements(objectInfoMap)); | 433 CHECK_EQ(1, NumberOfElements(objectInfoMap)); |
| 433 CHECK_EQ(1, NumberOfElements(notifierTargetMap)); | 434 CHECK_EQ(1, NumberOfElements(notifierTargetMap)); |
| 434 HEAP->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask); | 435 HEAP->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask); |
| 435 CHECK_EQ(0, NumberOfElements(observerInfoMap)); | 436 CHECK_EQ(0, NumberOfElements(observerInfoMap)); |
| 436 CHECK_EQ(0, NumberOfElements(objectInfoMap)); | 437 CHECK_EQ(0, NumberOfElements(objectInfoMap)); |
| 437 CHECK_EQ(0, NumberOfElements(notifierTargetMap)); | 438 CHECK_EQ(0, NumberOfElements(notifierTargetMap)); |
| 438 } | 439 } |
| OLD | NEW |