OLD | NEW |
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 1291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1302 instances->set(i, *wrapper); | 1302 instances->set(i, *wrapper); |
1303 } | 1303 } |
1304 | 1304 |
1305 // Return result as a JS array. | 1305 // Return result as a JS array. |
1306 Handle<JSObject> result = | 1306 Handle<JSObject> result = |
1307 isolate->factory()->NewJSObject(isolate->array_function()); | 1307 isolate->factory()->NewJSObject(isolate->array_function()); |
1308 JSArray::SetContent(Handle<JSArray>::cast(result), instances); | 1308 JSArray::SetContent(Handle<JSArray>::cast(result), instances); |
1309 return *result; | 1309 return *result; |
1310 } | 1310 } |
1311 | 1311 |
1312 | 1312 static bool HasInPrototypeChainIgnoringProxies(Isolate* isolate, |
1313 static bool HasInPrototypeChainIgnoringProxies(Isolate* isolate, Object* object, | 1313 JSObject* object, |
1314 Object* proto) { | 1314 Object* proto) { |
1315 PrototypeIterator iter(isolate, object, PrototypeIterator::START_AT_RECEIVER); | 1315 PrototypeIterator iter(isolate, object, PrototypeIterator::START_AT_RECEIVER); |
1316 while (true) { | 1316 while (true) { |
1317 iter.AdvanceIgnoringProxies(); | 1317 iter.AdvanceIgnoringProxies(); |
1318 if (iter.IsAtEnd()) return false; | 1318 if (iter.IsAtEnd()) return false; |
1319 if (iter.IsAtEnd(proto)) return true; | 1319 if (iter.GetCurrent() == proto) return true; |
1320 } | 1320 } |
1321 } | 1321 } |
1322 | 1322 |
1323 | 1323 |
1324 // Scan the heap for objects with direct references to an object | 1324 // Scan the heap for objects with direct references to an object |
1325 // args[0]: the object to find references to | 1325 // args[0]: the object to find references to |
1326 // args[1]: constructor function for instances to exclude (Mirror) | 1326 // args[1]: constructor function for instances to exclude (Mirror) |
1327 // args[2]: the the maximum number of objects to return | 1327 // args[2]: the the maximum number of objects to return |
1328 RUNTIME_FUNCTION(Runtime_DebugReferencedBy) { | 1328 RUNTIME_FUNCTION(Runtime_DebugReferencedBy) { |
1329 HandleScope scope(isolate); | 1329 HandleScope scope(isolate); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1416 // Find the effective prototype object as returned by __proto__. | 1416 // Find the effective prototype object as returned by __proto__. |
1417 // args[0]: the object to find the prototype for. | 1417 // args[0]: the object to find the prototype for. |
1418 RUNTIME_FUNCTION(Runtime_DebugGetPrototype) { | 1418 RUNTIME_FUNCTION(Runtime_DebugGetPrototype) { |
1419 HandleScope shs(isolate); | 1419 HandleScope shs(isolate); |
1420 DCHECK(args.length() == 1); | 1420 DCHECK(args.length() == 1); |
1421 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0); | 1421 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0); |
1422 Handle<Object> prototype; | 1422 Handle<Object> prototype; |
1423 // TODO(1543): Come up with a solution for clients to handle potential errors | 1423 // TODO(1543): Come up with a solution for clients to handle potential errors |
1424 // thrown by an intermediate proxy. | 1424 // thrown by an intermediate proxy. |
1425 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, prototype, | 1425 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, prototype, |
1426 Object::GetPrototype(isolate, obj)); | 1426 JSReceiver::GetPrototype(isolate, obj)); |
1427 return *prototype; | 1427 return *prototype; |
1428 } | 1428 } |
1429 | 1429 |
1430 | 1430 |
1431 // Patches script source (should be called upon BeforeCompile event). | 1431 // Patches script source (should be called upon BeforeCompile event). |
1432 RUNTIME_FUNCTION(Runtime_DebugSetScriptSource) { | 1432 RUNTIME_FUNCTION(Runtime_DebugSetScriptSource) { |
1433 HandleScope scope(isolate); | 1433 HandleScope scope(isolate); |
1434 DCHECK(args.length() == 2); | 1434 DCHECK(args.length() == 2); |
1435 | 1435 |
1436 CONVERT_ARG_HANDLE_CHECKED(JSValue, script_wrapper, 0); | 1436 CONVERT_ARG_HANDLE_CHECKED(JSValue, script_wrapper, 0); |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1669 return Smi::FromInt(isolate->debug()->is_active()); | 1669 return Smi::FromInt(isolate->debug()->is_active()); |
1670 } | 1670 } |
1671 | 1671 |
1672 | 1672 |
1673 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { | 1673 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { |
1674 UNIMPLEMENTED(); | 1674 UNIMPLEMENTED(); |
1675 return NULL; | 1675 return NULL; |
1676 } | 1676 } |
1677 } // namespace internal | 1677 } // namespace internal |
1678 } // namespace v8 | 1678 } // namespace v8 |
OLD | NEW |