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

Side by Side Diff: src/runtime.cc

Issue 10078014: Enable stepping into callback passed to builtins (e.g. Array.forEach). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 8 months 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 | Annotate | Revision Log
« src/array.js ('K') | « src/runtime.h ('k') | src/string.js » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 4678 matching lines...) Expand 10 before | Expand all | Expand 10 after
4689 FAST_ELEMENTS)) { 4689 FAST_ELEMENTS)) {
4690 JSObject::TransitionElementsKind(boilerplate, FAST_ELEMENTS); 4690 JSObject::TransitionElementsKind(boilerplate, FAST_ELEMENTS);
4691 } 4691 }
4692 FixedArray* object_array = FixedArray::cast(object->elements()); 4692 FixedArray* object_array = FixedArray::cast(object->elements());
4693 object_array->set(store_index, *value); 4693 object_array->set(store_index, *value);
4694 } 4694 }
4695 return *object; 4695 return *object;
4696 } 4696 }
4697 4697
4698 4698
4699 // Check whether debugger and is about to step into the callback that is passed
4700 // to a built-in function such as Array.forEach.
4701 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugStepIntoBuiltinCallback) {
4702 if (!isolate->IsDebuggerActive()) return isolate->heap()->false_value();
4703 CONVERT_ARG_CHECKED(Object, callback, 0);
4704 // We do not step into the callback if it's a builtin or not even a function.
4705 if (!callback->IsJSFunction() || JSFunction::cast(callback)->IsBuiltin()) {
4706 return isolate->heap()->false_value();
4707 }
4708 return isolate->heap()->true_value();
4709 }
4710
4711
4712 // Set break slots for the callback function that is passed to a buil-tin
Søren Gjesse 2012/04/20 08:33:25 "break slots" -> "one shot breakpoints"
Yang 2012/04/20 11:06:54 Done.
4713 // function such as Array.forEach to enables stepping into callback functions.
4714 RUNTIME_FUNCTION(MaybeObject*, Runtime_PrepareBreakSlotsForCallback) {
4715 Debug* debug = isolate->debug();
4716 if (!debug->IsStepping()) return NULL;
4717 CONVERT_ARG_CHECKED(Object, callback, 0);
4718 HandleScope scope(isolate);
4719 Handle<SharedFunctionInfo> shared_info(JSFunction::cast(callback)->shared());
4720 // When leaving the callback, step out has been activated, but not performed
4721 // if we do not leave the builtin. To be able to step into the callback
4722 // again, we need to clear the step out at this point.
4723 debug->ClearStepOut();
4724 debug->FloodWithOneShot(shared_info);
4725 return NULL;
4726 }
4727
4728
4699 // Set a local property, even if it is READ_ONLY. If the property does not 4729 // Set a local property, even if it is READ_ONLY. If the property does not
4700 // exist, it will be added with attributes NONE. 4730 // exist, it will be added with attributes NONE.
4701 RUNTIME_FUNCTION(MaybeObject*, Runtime_IgnoreAttributesAndSetProperty) { 4731 RUNTIME_FUNCTION(MaybeObject*, Runtime_IgnoreAttributesAndSetProperty) {
4702 NoHandleAllocation ha; 4732 NoHandleAllocation ha;
4703 RUNTIME_ASSERT(args.length() == 3 || args.length() == 4); 4733 RUNTIME_ASSERT(args.length() == 3 || args.length() == 4);
4704 CONVERT_ARG_CHECKED(JSObject, object, 0); 4734 CONVERT_ARG_CHECKED(JSObject, object, 0);
4705 CONVERT_ARG_CHECKED(String, name, 1); 4735 CONVERT_ARG_CHECKED(String, name, 1);
4706 // Compute attributes. 4736 // Compute attributes.
4707 PropertyAttributes attributes = NONE; 4737 PropertyAttributes attributes = NONE;
4708 if (args.length() == 4) { 4738 if (args.length() == 4) {
(...skipping 8657 matching lines...) Expand 10 before | Expand all | Expand 10 after
13366 // Handle last resort GC and make sure to allow future allocations 13396 // Handle last resort GC and make sure to allow future allocations
13367 // to grow the heap without causing GCs (if possible). 13397 // to grow the heap without causing GCs (if possible).
13368 isolate->counters()->gc_last_resort_from_js()->Increment(); 13398 isolate->counters()->gc_last_resort_from_js()->Increment();
13369 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 13399 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
13370 "Runtime::PerformGC"); 13400 "Runtime::PerformGC");
13371 } 13401 }
13372 } 13402 }
13373 13403
13374 13404
13375 } } // namespace v8::internal 13405 } } // namespace v8::internal
OLDNEW
« src/array.js ('K') | « src/runtime.h ('k') | src/string.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698