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

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

Issue 239543010: Revert "Move functions from handles.cc to where they belong." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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 = CcTest::i_isolate(); 410 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(CcTest::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(i::Object::GetProperty( 414 i::Handle<i::JSWeakMap>::cast(
415 i_isolate, observation_state, "callbackInfoMap").ToHandleChecked()); 415 i::GetProperty(
416 observation_state, "callbackInfoMap").ToHandleChecked());
416 i::Handle<i::JSWeakMap> objectInfoMap = 417 i::Handle<i::JSWeakMap> objectInfoMap =
417 i::Handle<i::JSWeakMap>::cast(i::Object::GetProperty( 418 i::Handle<i::JSWeakMap>::cast(
418 i_isolate, observation_state, "objectInfoMap").ToHandleChecked()); 419 i::GetProperty(observation_state, "objectInfoMap").ToHandleChecked());
419 i::Handle<i::JSWeakMap> notifierObjectInfoMap = 420 i::Handle<i::JSWeakMap> notifierObjectInfoMap =
420 i::Handle<i::JSWeakMap>::cast(i::Object::GetProperty( 421 i::Handle<i::JSWeakMap>::cast(
421 i_isolate, observation_state, "notifierObjectInfoMap") 422 i::GetProperty(
422 .ToHandleChecked()); 423 observation_state, "notifierObjectInfoMap").ToHandleChecked());
423 CHECK_EQ(1, NumberOfElements(callbackInfoMap)); 424 CHECK_EQ(1, NumberOfElements(callbackInfoMap));
424 CHECK_EQ(1, NumberOfElements(objectInfoMap)); 425 CHECK_EQ(1, NumberOfElements(objectInfoMap));
425 CHECK_EQ(1, NumberOfElements(notifierObjectInfoMap)); 426 CHECK_EQ(1, NumberOfElements(notifierObjectInfoMap));
426 i_isolate->heap()->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask); 427 i_isolate->heap()->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask);
427 CHECK_EQ(0, NumberOfElements(callbackInfoMap)); 428 CHECK_EQ(0, NumberOfElements(callbackInfoMap));
428 CHECK_EQ(0, NumberOfElements(objectInfoMap)); 429 CHECK_EQ(0, NumberOfElements(objectInfoMap));
429 CHECK_EQ(0, NumberOfElements(notifierObjectInfoMap)); 430 CHECK_EQ(0, NumberOfElements(notifierObjectInfoMap));
430 } 431 }
431 432
432 433
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 "var observer = function(r) { records = r };" 721 "var observer = function(r) { records = r };"
721 "Object.observe(obj, observer);"); 722 "Object.observe(obj, observer);");
722 Handle<Value> obj = 723 Handle<Value> obj =
723 context->Global()->Get(String::NewFromUtf8(CcTest::isolate(), "obj")); 724 context->Global()->Get(String::NewFromUtf8(CcTest::isolate(), "obj"));
724 Handle<Object>::Cast(obj) 725 Handle<Object>::Cast(obj)
725 ->SetHiddenValue(String::NewFromUtf8(CcTest::isolate(), "foo"), 726 ->SetHiddenValue(String::NewFromUtf8(CcTest::isolate(), "foo"),
726 Null(CcTest::isolate())); 727 Null(CcTest::isolate()));
727 CompileRun(""); // trigger delivery 728 CompileRun(""); // trigger delivery
728 CHECK(CompileRun("records")->IsNull()); 729 CHECK(CompileRun("records")->IsNull());
729 } 730 }
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