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

Side by Side Diff: src/runtime/runtime-debug.cc

Issue 1494283002: Revert of [proxies] Make Object.prototype.isPrototypeOf work with proxies. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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 | « src/prototype.h ('k') | src/runtime/runtime-object.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/runtime/runtime-utils.h" 5 #include "src/runtime/runtime-utils.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/debug/debug.h" 8 #include "src/debug/debug.h"
9 #include "src/debug/debug-evaluate.h" 9 #include "src/debug/debug-evaluate.h"
10 #include "src/debug/debug-frames.h" 10 #include "src/debug/debug-frames.h"
(...skipping 1332 matching lines...) Expand 10 before | Expand all | Expand 10 after
1343 } 1343 }
1344 1344
1345 // Return result as a JS array. 1345 // Return result as a JS array.
1346 Handle<JSObject> result = 1346 Handle<JSObject> result =
1347 isolate->factory()->NewJSObject(isolate->array_function()); 1347 isolate->factory()->NewJSObject(isolate->array_function());
1348 JSArray::SetContent(Handle<JSArray>::cast(result), instances); 1348 JSArray::SetContent(Handle<JSArray>::cast(result), instances);
1349 return *result; 1349 return *result;
1350 } 1350 }
1351 1351
1352 1352
1353 static bool HasInPrototypeChainIgnoringProxies(Isolate* isolate, Object* object,
1354 Object* proto) {
1355 PrototypeIterator iter(isolate, object, PrototypeIterator::START_AT_RECEIVER);
1356 while (true) {
1357 iter.AdvanceIgnoringProxies();
1358 if (iter.IsAtEnd()) return false;
1359 if (iter.IsAtEnd(proto)) return true;
1360 }
1361 }
1362
1363
1364 // Scan the heap for objects with direct references to an object 1353 // Scan the heap for objects with direct references to an object
1365 // args[0]: the object to find references to 1354 // args[0]: the object to find references to
1366 // args[1]: constructor function for instances to exclude (Mirror) 1355 // args[1]: constructor function for instances to exclude (Mirror)
1367 // args[2]: the the maximum number of objects to return 1356 // args[2]: the the maximum number of objects to return
1368 RUNTIME_FUNCTION(Runtime_DebugReferencedBy) { 1357 RUNTIME_FUNCTION(Runtime_DebugReferencedBy) {
1369 HandleScope scope(isolate); 1358 HandleScope scope(isolate);
1370 DCHECK(args.length() == 3); 1359 DCHECK(args.length() == 3);
1371 CONVERT_ARG_HANDLE_CHECKED(JSObject, target, 0); 1360 CONVERT_ARG_HANDLE_CHECKED(JSObject, target, 0);
1372 CONVERT_ARG_HANDLE_CHECKED(Object, filter, 1); 1361 CONVERT_ARG_HANDLE_CHECKED(Object, filter, 1);
1373 RUNTIME_ASSERT(filter->IsUndefined() || filter->IsJSObject()); 1362 RUNTIME_ASSERT(filter->IsUndefined() || filter->IsJSObject());
1374 CONVERT_NUMBER_CHECKED(int32_t, max_references, Int32, args[2]); 1363 CONVERT_NUMBER_CHECKED(int32_t, max_references, Int32, args[2]);
1375 RUNTIME_ASSERT(max_references >= 0); 1364 RUNTIME_ASSERT(max_references >= 0);
1376 1365
1377 List<Handle<JSObject> > instances; 1366 List<Handle<JSObject> > instances;
1378 Heap* heap = isolate->heap(); 1367 Heap* heap = isolate->heap();
1379 { 1368 {
1380 HeapIterator iterator(heap, HeapIterator::kFilterUnreachable); 1369 HeapIterator iterator(heap, HeapIterator::kFilterUnreachable);
1381 // Get the constructor function for context extension and arguments array. 1370 // Get the constructor function for context extension and arguments array.
1382 Object* arguments_fun = isolate->sloppy_arguments_map()->GetConstructor(); 1371 Object* arguments_fun = isolate->sloppy_arguments_map()->GetConstructor();
1383 HeapObject* heap_obj; 1372 HeapObject* heap_obj;
1384 while ((heap_obj = iterator.next())) { 1373 while ((heap_obj = iterator.next())) {
1385 if (!heap_obj->IsJSObject()) continue; 1374 if (!heap_obj->IsJSObject()) continue;
1386 JSObject* obj = JSObject::cast(heap_obj); 1375 JSObject* obj = JSObject::cast(heap_obj);
1387 if (obj->IsJSContextExtensionObject()) continue; 1376 if (obj->IsJSContextExtensionObject()) continue;
1388 if (obj->map()->GetConstructor() == arguments_fun) continue; 1377 if (obj->map()->GetConstructor() == arguments_fun) continue;
1389 if (!obj->ReferencesObject(*target)) continue; 1378 if (!obj->ReferencesObject(*target)) continue;
1390 // Check filter if supplied. This is normally used to avoid 1379 // Check filter if supplied. This is normally used to avoid
1391 // references from mirror objects. 1380 // references from mirror objects.
1392 if (!filter->IsUndefined() && 1381 if (!filter->IsUndefined() &&
1393 HasInPrototypeChainIgnoringProxies(isolate, obj, *filter)) { 1382 obj->HasInPrototypeChain(isolate, *filter)) {
1394 continue; 1383 continue;
1395 } 1384 }
1396 if (obj->IsJSGlobalObject()) { 1385 if (obj->IsJSGlobalObject()) {
1397 obj = JSGlobalObject::cast(obj)->global_proxy(); 1386 obj = JSGlobalObject::cast(obj)->global_proxy();
1398 } 1387 }
1399 instances.Add(Handle<JSObject>(obj)); 1388 instances.Add(Handle<JSObject>(obj));
1400 if (instances.length() == max_references) break; 1389 if (instances.length() == max_references) break;
1401 } 1390 }
1402 // Iterate the rest of the heap to satisfy HeapIterator constraints. 1391 // Iterate the rest of the heap to satisfy HeapIterator constraints.
1403 while (iterator.next()) { 1392 while (iterator.next()) {
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
1701 return Smi::FromInt(isolate->debug()->is_active()); 1690 return Smi::FromInt(isolate->debug()->is_active());
1702 } 1691 }
1703 1692
1704 1693
1705 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { 1694 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) {
1706 UNIMPLEMENTED(); 1695 UNIMPLEMENTED();
1707 return NULL; 1696 return NULL;
1708 } 1697 }
1709 } // namespace internal 1698 } // namespace internal
1710 } // namespace v8 1699 } // namespace v8
OLDNEW
« no previous file with comments | « src/prototype.h ('k') | src/runtime/runtime-object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698