Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1062)

Side by Side Diff: test/cctest/test-object-observe.cc

Issue 239113009: Reland "Move functions from handles.cc to where they belong." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fix Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « test/cctest/test-debug.cc ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 400
401 401
402 TEST(ObservationWeakMap) { 402 TEST(ObservationWeakMap) {
403 HandleScope scope(CcTest::isolate()); 403 HandleScope scope(CcTest::isolate());
404 LocalContext context(CcTest::isolate()); 404 LocalContext context(CcTest::isolate());
405 CompileRun( 405 CompileRun(
406 "var obj = {};" 406 "var obj = {};"
407 "Object.observe(obj, function(){});" 407 "Object.observe(obj, function(){});"
408 "Object.getNotifier(obj);" 408 "Object.getNotifier(obj);"
409 "obj = null;"); 409 "obj = null;");
410 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(CcTest::isolate()); 410 i::Isolate* i_isolate = CcTest::i_isolate();
411 i::Handle<i::JSObject> observation_state = 411 i::Handle<i::JSObject> observation_state =
412 i_isolate->factory()->observation_state(); 412 i_isolate->factory()->observation_state();
413 i::Handle<i::JSWeakMap> callbackInfoMap = 413 i::Handle<i::JSWeakMap> callbackInfoMap =
414 i::Handle<i::JSWeakMap>::cast( 414 i::Handle<i::JSWeakMap>::cast(i::Object::GetProperty(
415 i::GetProperty( 415 i_isolate, observation_state, "callbackInfoMap").ToHandleChecked());
416 observation_state, "callbackInfoMap").ToHandleChecked());
417 i::Handle<i::JSWeakMap> objectInfoMap = 416 i::Handle<i::JSWeakMap> objectInfoMap =
418 i::Handle<i::JSWeakMap>::cast( 417 i::Handle<i::JSWeakMap>::cast(i::Object::GetProperty(
419 i::GetProperty(observation_state, "objectInfoMap").ToHandleChecked()); 418 i_isolate, observation_state, "objectInfoMap").ToHandleChecked());
420 i::Handle<i::JSWeakMap> notifierObjectInfoMap = 419 i::Handle<i::JSWeakMap> notifierObjectInfoMap =
421 i::Handle<i::JSWeakMap>::cast( 420 i::Handle<i::JSWeakMap>::cast(i::Object::GetProperty(
422 i::GetProperty( 421 i_isolate, observation_state, "notifierObjectInfoMap")
423 observation_state, "notifierObjectInfoMap").ToHandleChecked()); 422 .ToHandleChecked());
424 CHECK_EQ(1, NumberOfElements(callbackInfoMap)); 423 CHECK_EQ(1, NumberOfElements(callbackInfoMap));
425 CHECK_EQ(1, NumberOfElements(objectInfoMap)); 424 CHECK_EQ(1, NumberOfElements(objectInfoMap));
426 CHECK_EQ(1, NumberOfElements(notifierObjectInfoMap)); 425 CHECK_EQ(1, NumberOfElements(notifierObjectInfoMap));
427 i_isolate->heap()->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask); 426 i_isolate->heap()->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask);
428 CHECK_EQ(0, NumberOfElements(callbackInfoMap)); 427 CHECK_EQ(0, NumberOfElements(callbackInfoMap));
429 CHECK_EQ(0, NumberOfElements(objectInfoMap)); 428 CHECK_EQ(0, NumberOfElements(objectInfoMap));
430 CHECK_EQ(0, NumberOfElements(notifierObjectInfoMap)); 429 CHECK_EQ(0, NumberOfElements(notifierObjectInfoMap));
431 } 430 }
432 431
433 432
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 "var observer = function(r) { records = r };" 720 "var observer = function(r) { records = r };"
722 "Object.observe(obj, observer);"); 721 "Object.observe(obj, observer);");
723 Handle<Value> obj = 722 Handle<Value> obj =
724 context->Global()->Get(String::NewFromUtf8(CcTest::isolate(), "obj")); 723 context->Global()->Get(String::NewFromUtf8(CcTest::isolate(), "obj"));
725 Handle<Object>::Cast(obj) 724 Handle<Object>::Cast(obj)
726 ->SetHiddenValue(String::NewFromUtf8(CcTest::isolate(), "foo"), 725 ->SetHiddenValue(String::NewFromUtf8(CcTest::isolate(), "foo"),
727 Null(CcTest::isolate())); 726 Null(CcTest::isolate()));
728 CompileRun(""); // trigger delivery 727 CompileRun(""); // trigger delivery
729 CHECK(CompileRun("records")->IsNull()); 728 CHECK(CompileRun("records")->IsNull());
730 } 729 }
OLDNEW
« no previous file with comments | « test/cctest/test-debug.cc ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698