| 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/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/arguments.h" | 8 #include "src/arguments.h" |
| 9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
| 10 #include "src/debug.h" | 10 #include "src/debug.h" |
| (...skipping 3004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3015 | 3015 |
| 3016 // Calls specified function with or without entering the debugger. | 3016 // Calls specified function with or without entering the debugger. |
| 3017 // This is used in unit tests to run code as if debugger is entered or simply | 3017 // This is used in unit tests to run code as if debugger is entered or simply |
| 3018 // to have a stack with C++ frame in the middle. | 3018 // to have a stack with C++ frame in the middle. |
| 3019 RUNTIME_FUNCTION(Runtime_ExecuteInDebugContext) { | 3019 RUNTIME_FUNCTION(Runtime_ExecuteInDebugContext) { |
| 3020 HandleScope scope(isolate); | 3020 HandleScope scope(isolate); |
| 3021 DCHECK(args.length() == 1); | 3021 DCHECK(args.length() == 1); |
| 3022 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); | 3022 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
| 3023 | 3023 |
| 3024 DebugScope debug_scope(isolate->debug()); | 3024 DebugScope debug_scope(isolate->debug()); |
| 3025 if (debug_scope.failed()) { |
| 3026 DCHECK(isolate->has_pending_exception()); |
| 3027 return isolate->heap()->exception(); |
| 3028 } |
| 3029 |
| 3025 Handle<Object> result; | 3030 Handle<Object> result; |
| 3026 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 3031 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 3027 isolate, result, | 3032 isolate, result, |
| 3028 Execution::Call(isolate, function, handle(function->global_proxy()), 0, | 3033 Execution::Call(isolate, function, handle(function->global_proxy()), 0, |
| 3029 NULL)); | 3034 NULL)); |
| 3030 return *result; | 3035 return *result; |
| 3031 } | 3036 } |
| 3032 | 3037 |
| 3033 | 3038 |
| 3034 RUNTIME_FUNCTION(Runtime_GetDebugContext) { | 3039 RUNTIME_FUNCTION(Runtime_GetDebugContext) { |
| 3035 HandleScope scope(isolate); | 3040 HandleScope scope(isolate); |
| 3036 DCHECK(args.length() == 0); | 3041 DCHECK(args.length() == 0); |
| 3037 Handle<Context> context; | 3042 Handle<Context> context; |
| 3038 { | 3043 { |
| 3039 DebugScope debug_scope(isolate->debug()); | 3044 DebugScope debug_scope(isolate->debug()); |
| 3045 if (debug_scope.failed()) { |
| 3046 DCHECK(isolate->has_pending_exception()); |
| 3047 return isolate->heap()->exception(); |
| 3048 } |
| 3040 context = isolate->debug()->GetDebugContext(); | 3049 context = isolate->debug()->GetDebugContext(); |
| 3041 } | 3050 } |
| 3042 if (context.is_null()) return isolate->heap()->undefined_value(); | 3051 if (context.is_null()) return isolate->heap()->undefined_value(); |
| 3043 context->set_security_token(isolate->native_context()->security_token()); | 3052 context->set_security_token(isolate->native_context()->security_token()); |
| 3044 return context->global_proxy(); | 3053 return context->global_proxy(); |
| 3045 } | 3054 } |
| 3046 | 3055 |
| 3047 | 3056 |
| 3048 // Performs a GC. | 3057 // Performs a GC. |
| 3049 // Presently, it only does a full GC. | 3058 // Presently, it only does a full GC. |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3188 return Smi::FromInt(isolate->debug()->is_active()); | 3197 return Smi::FromInt(isolate->debug()->is_active()); |
| 3189 } | 3198 } |
| 3190 | 3199 |
| 3191 | 3200 |
| 3192 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { | 3201 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { |
| 3193 UNIMPLEMENTED(); | 3202 UNIMPLEMENTED(); |
| 3194 return NULL; | 3203 return NULL; |
| 3195 } | 3204 } |
| 3196 } // namespace internal | 3205 } // namespace internal |
| 3197 } // namespace v8 | 3206 } // namespace v8 |
| OLD | NEW |