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 1584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1595 // for the requested break point. For lazily compiled functions several heap | 1595 // for the requested break point. For lazily compiled functions several heap |
1596 // traversals might be required rendering this operation as a rather slow | 1596 // traversals might be required rendering this operation as a rather slow |
1597 // operation. However for setting break points which is normally done through | 1597 // operation. However for setting break points which is normally done through |
1598 // some kind of user interaction the performance is not crucial. | 1598 // some kind of user interaction the performance is not crucial. |
1599 RUNTIME_FUNCTION(Runtime_GetScript) { | 1599 RUNTIME_FUNCTION(Runtime_GetScript) { |
1600 HandleScope scope(isolate); | 1600 HandleScope scope(isolate); |
1601 DCHECK(args.length() == 1); | 1601 DCHECK(args.length() == 1); |
1602 CONVERT_ARG_HANDLE_CHECKED(String, script_name, 0); | 1602 CONVERT_ARG_HANDLE_CHECKED(String, script_name, 0); |
1603 | 1603 |
1604 Handle<Script> found; | 1604 Handle<Script> found; |
1605 Heap* heap = isolate->heap(); | |
1606 { | 1605 { |
1607 HeapIterator iterator(heap); | 1606 Script::Iterator iterator(isolate); |
1608 HeapObject* obj = NULL; | 1607 Script* script = NULL; |
1609 while ((obj = iterator.next()) != NULL) { | 1608 while ((script = iterator.Next()) != NULL) { |
1610 if (!obj->IsScript()) continue; | |
1611 Script* script = Script::cast(obj); | |
1612 if (!script->name()->IsString()) continue; | 1609 if (!script->name()->IsString()) continue; |
1613 String* name = String::cast(script->name()); | 1610 String* name = String::cast(script->name()); |
1614 if (name->Equals(*script_name)) { | 1611 if (name->Equals(*script_name)) { |
1615 found = Handle<Script>(script, isolate); | 1612 found = Handle<Script>(script, isolate); |
1616 break; | 1613 break; |
1617 } | 1614 } |
1618 } | 1615 } |
1619 } | 1616 } |
1620 | 1617 |
1621 if (found.is_null()) return heap->undefined_value(); | 1618 if (found.is_null()) return isolate->heap()->undefined_value(); |
1622 return *Script::GetWrapper(found); | 1619 return *Script::GetWrapper(found); |
1623 } | 1620 } |
1624 | 1621 |
1625 | 1622 |
1626 // Check whether debugger is about to step into the callback that is passed | 1623 // Check whether debugger is about to step into the callback that is passed |
1627 // to a built-in function such as Array.forEach. | 1624 // to a built-in function such as Array.forEach. |
1628 RUNTIME_FUNCTION(Runtime_DebugCallbackSupportsStepping) { | 1625 RUNTIME_FUNCTION(Runtime_DebugCallbackSupportsStepping) { |
1629 DCHECK(args.length() == 1); | 1626 DCHECK(args.length() == 1); |
1630 Debug* debug = isolate->debug(); | 1627 Debug* debug = isolate->debug(); |
1631 if (!debug->is_active() || !debug->IsStepping() || | 1628 if (!debug->is_active() || !debug->IsStepping() || |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1722 return *isolate->factory()->undefined_value(); | 1719 return *isolate->factory()->undefined_value(); |
1723 } | 1720 } |
1724 | 1721 |
1725 | 1722 |
1726 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { | 1723 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { |
1727 UNIMPLEMENTED(); | 1724 UNIMPLEMENTED(); |
1728 return NULL; | 1725 return NULL; |
1729 } | 1726 } |
1730 } // namespace internal | 1727 } // namespace internal |
1731 } // namespace v8 | 1728 } // namespace v8 |
OLD | NEW |