OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 <stdlib.h> | 5 #include <stdlib.h> |
6 #include <limits> | 6 #include <limits> |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/accessors.h" | 10 #include "src/accessors.h" |
(...skipping 5506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5517 callback->IsJSFunction() && !JSFunction::cast(callback)->IsBuiltin()); | 5517 callback->IsJSFunction() && !JSFunction::cast(callback)->IsBuiltin()); |
5518 } | 5518 } |
5519 | 5519 |
5520 | 5520 |
5521 // Set one shot breakpoints for the callback function that is passed to a | 5521 // Set one shot breakpoints for the callback function that is passed to a |
5522 // built-in function such as Array.forEach to enable stepping into the callback. | 5522 // built-in function such as Array.forEach to enable stepping into the callback. |
5523 RUNTIME_FUNCTION(Runtime_DebugPrepareStepInIfStepping) { | 5523 RUNTIME_FUNCTION(Runtime_DebugPrepareStepInIfStepping) { |
5524 DCHECK(args.length() == 1); | 5524 DCHECK(args.length() == 1); |
5525 Debug* debug = isolate->debug(); | 5525 Debug* debug = isolate->debug(); |
5526 if (!debug->IsStepping()) return isolate->heap()->undefined_value(); | 5526 if (!debug->IsStepping()) return isolate->heap()->undefined_value(); |
5527 CONVERT_ARG_HANDLE_CHECKED(JSFunction, callback, 0); | 5527 |
5528 HandleScope scope(isolate); | 5528 HandleScope scope(isolate); |
5529 // When leaving the callback, step out has been activated, but not performed | 5529 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); |
5530 // if we do not leave the builtin. To be able to step into the callback | 5530 RUNTIME_ASSERT(object->IsJSFunction() || object->IsJSGeneratorObject()); |
| 5531 Handle<JSFunction> fun; |
| 5532 if (object->IsJSFunction()) { |
| 5533 fun = Handle<JSFunction>::cast(object); |
| 5534 } else { |
| 5535 fun = Handle<JSFunction>( |
| 5536 Handle<JSGeneratorObject>::cast(object)->function(), isolate); |
| 5537 } |
| 5538 // When leaving the function, step out has been activated, but not performed |
| 5539 // if we do not leave the builtin. To be able to step into the function |
5531 // again, we need to clear the step out at this point. | 5540 // again, we need to clear the step out at this point. |
5532 debug->ClearStepOut(); | 5541 debug->ClearStepOut(); |
5533 debug->FloodWithOneShot(callback); | 5542 debug->FloodWithOneShot(fun); |
5534 return isolate->heap()->undefined_value(); | 5543 return isolate->heap()->undefined_value(); |
5535 } | 5544 } |
5536 | 5545 |
5537 | 5546 |
5538 RUNTIME_FUNCTION(Runtime_DebugPushPromise) { | 5547 RUNTIME_FUNCTION(Runtime_DebugPushPromise) { |
5539 DCHECK(args.length() == 1); | 5548 DCHECK(args.length() == 1); |
5540 HandleScope scope(isolate); | 5549 HandleScope scope(isolate); |
5541 CONVERT_ARG_HANDLE_CHECKED(JSObject, promise, 0); | 5550 CONVERT_ARG_HANDLE_CHECKED(JSObject, promise, 0); |
5542 isolate->PushPromise(promise); | 5551 isolate->PushPromise(promise); |
5543 return isolate->heap()->undefined_value(); | 5552 return isolate->heap()->undefined_value(); |
(...skipping 10103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15647 } | 15656 } |
15648 return NULL; | 15657 return NULL; |
15649 } | 15658 } |
15650 | 15659 |
15651 | 15660 |
15652 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { | 15661 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { |
15653 return &(kIntrinsicFunctions[static_cast<int>(id)]); | 15662 return &(kIntrinsicFunctions[static_cast<int>(id)]); |
15654 } | 15663 } |
15655 | 15664 |
15656 } } // namespace v8::internal | 15665 } } // namespace v8::internal |
OLD | NEW |