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

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

Issue 1775973002: Add GetProperty/GetElement to JSReceiver and use it where possible (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « test/cctest/test-compiler.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 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 HandleScope scope(CcTest::isolate()); 484 HandleScope scope(CcTest::isolate());
485 LocalContext context(CcTest::isolate()); 485 LocalContext context(CcTest::isolate());
486 CompileRun( 486 CompileRun(
487 "var obj = {};" 487 "var obj = {};"
488 "Object.observe(obj, function(){});" 488 "Object.observe(obj, function(){});"
489 "Object.getNotifier(obj);" 489 "Object.getNotifier(obj);"
490 "obj = null;"); 490 "obj = null;");
491 i::Isolate* i_isolate = CcTest::i_isolate(); 491 i::Isolate* i_isolate = CcTest::i_isolate();
492 i::Handle<i::JSObject> observation_state = 492 i::Handle<i::JSObject> observation_state =
493 i_isolate->factory()->observation_state(); 493 i_isolate->factory()->observation_state();
494 i::Handle<i::JSWeakMap> callbackInfoMap = 494 i::Handle<i::JSWeakMap> callbackInfoMap = i::Handle<i::JSWeakMap>::cast(
495 i::Handle<i::JSWeakMap>::cast(i::Object::GetProperty( 495 i::JSReceiver::GetProperty(i_isolate, observation_state,
496 i_isolate, observation_state, "callbackInfoMap").ToHandleChecked()); 496 "callbackInfoMap")
497 i::Handle<i::JSWeakMap> objectInfoMap = 497 .ToHandleChecked());
498 i::Handle<i::JSWeakMap>::cast(i::Object::GetProperty( 498 i::Handle<i::JSWeakMap> objectInfoMap = i::Handle<i::JSWeakMap>::cast(
499 i_isolate, observation_state, "objectInfoMap").ToHandleChecked()); 499 i::JSReceiver::GetProperty(i_isolate, observation_state, "objectInfoMap")
500 i::Handle<i::JSWeakMap> notifierObjectInfoMap = 500 .ToHandleChecked());
501 i::Handle<i::JSWeakMap>::cast(i::Object::GetProperty( 501 i::Handle<i::JSWeakMap> notifierObjectInfoMap = i::Handle<i::JSWeakMap>::cast(
502 i_isolate, observation_state, "notifierObjectInfoMap") 502 i::JSReceiver::GetProperty(i_isolate, observation_state,
503 .ToHandleChecked()); 503 "notifierObjectInfoMap")
504 .ToHandleChecked());
504 CHECK_EQ(1, NumberOfElements(callbackInfoMap)); 505 CHECK_EQ(1, NumberOfElements(callbackInfoMap));
505 CHECK_EQ(1, NumberOfElements(objectInfoMap)); 506 CHECK_EQ(1, NumberOfElements(objectInfoMap));
506 CHECK_EQ(1, NumberOfElements(notifierObjectInfoMap)); 507 CHECK_EQ(1, NumberOfElements(notifierObjectInfoMap));
507 i_isolate->heap()->CollectAllGarbage(); 508 i_isolate->heap()->CollectAllGarbage();
508 CHECK_EQ(0, NumberOfElements(callbackInfoMap)); 509 CHECK_EQ(0, NumberOfElements(callbackInfoMap));
509 CHECK_EQ(0, NumberOfElements(objectInfoMap)); 510 CHECK_EQ(0, NumberOfElements(objectInfoMap));
510 CHECK_EQ(0, NumberOfElements(notifierObjectInfoMap)); 511 CHECK_EQ(0, NumberOfElements(notifierObjectInfoMap));
511 } 512 }
512 513
513 514
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
1068 v8::Isolate::GetCurrent()->GetCurrentContext()) 1069 v8::Isolate::GetCurrent()->GetCurrentContext())
1069 .ToLocalChecked(); 1070 .ToLocalChecked();
1070 env->Global() 1071 env->Global()
1071 ->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("obj"), 1072 ->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("obj"),
1072 new_instance) 1073 new_instance)
1073 .FromJust(); 1074 .FromJust();
1074 v8::TryCatch try_catch(isolate); 1075 v8::TryCatch try_catch(isolate);
1075 CompileRun("Object.getNotifier(obj)"); 1076 CompileRun("Object.getNotifier(obj)");
1076 CHECK(try_catch.HasCaught()); 1077 CHECK(try_catch.HasCaught());
1077 } 1078 }
OLDNEW
« no previous file with comments | « test/cctest/test-compiler.cc ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698