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

Side by Side Diff: src/runtime.cc

Issue 668246: Check that function being patched has no activations on any thread stack (Closed)
Patch Set: format Created 10 years, 9 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
« no previous file with comments | « src/runtime.h ('k') | test/mjsunit/debug-liveedit-check-stack.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 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 8425 matching lines...) Expand 10 before | Expand all | Expand 10 after
8436 HandleScope scope; 8436 HandleScope scope;
8437 CONVERT_ARG_CHECKED(JSArray, shared_array, 0); 8437 CONVERT_ARG_CHECKED(JSArray, shared_array, 0);
8438 CONVERT_ARG_CHECKED(JSArray, position_change_array, 1); 8438 CONVERT_ARG_CHECKED(JSArray, position_change_array, 1);
8439 8439
8440 LiveEdit::PatchFunctionPositions(shared_array, position_change_array); 8440 LiveEdit::PatchFunctionPositions(shared_array, position_change_array);
8441 8441
8442 return Heap::undefined_value(); 8442 return Heap::undefined_value();
8443 } 8443 }
8444 8444
8445 8445
8446 static LiveEdit::FunctionPatchabilityStatus FindFunctionCodeOnStacks(
8447 Handle<SharedFunctionInfo> shared) {
8448 // TODO(635): check all threads, not only the current one.
8449 for (StackFrameIterator it; !it.done(); it.Advance()) {
8450 StackFrame* frame = it.frame();
8451 if (frame->code() == shared->code()) {
8452 return LiveEdit::FUNCTION_BLOCKED_ON_STACK;
8453 }
8454 }
8455 return LiveEdit::FUNCTION_AVAILABLE_FOR_PATCH;
8456 }
8457
8458 // For array of SharedFunctionInfo's (each wrapped in JSValue)
8459 // checks that none of them have activations on stacks (of any thread).
8460 // Returns array of the same length with corresponding results of
8461 // LiveEdit::FunctionPatchabilityStatus type.
8462 static Object* Runtime_LiveEditCheckStackActivations(Arguments args) {
8463 ASSERT(args.length() == 1);
8464 HandleScope scope;
8465 CONVERT_ARG_CHECKED(JSArray, shared_array, 0);
8466
8467
8468 int len = Smi::cast(shared_array->length())->value();
8469 Handle<JSArray> result = Factory::NewJSArray(len);
8470
8471 for (int i = 0; i < len; i++) {
8472 JSValue* wrapper = JSValue::cast(shared_array->GetElement(i));
8473 Handle<SharedFunctionInfo> shared(
8474 SharedFunctionInfo::cast(wrapper->value()));
8475 LiveEdit::FunctionPatchabilityStatus check_res =
8476 FindFunctionCodeOnStacks(shared);
8477 SetElement(result, i, Handle<Smi>(Smi::FromInt(check_res)));
8478 }
8479
8480 return *result;
8481 }
8482
8483
8446 #endif // ENABLE_DEBUGGER_SUPPORT 8484 #endif // ENABLE_DEBUGGER_SUPPORT
8447 8485
8448 #ifdef ENABLE_LOGGING_AND_PROFILING 8486 #ifdef ENABLE_LOGGING_AND_PROFILING
8449 8487
8450 static Object* Runtime_ProfilerResume(Arguments args) { 8488 static Object* Runtime_ProfilerResume(Arguments args) {
8451 NoHandleAllocation ha; 8489 NoHandleAllocation ha;
8452 ASSERT(args.length() == 2); 8490 ASSERT(args.length() == 2);
8453 8491
8454 CONVERT_CHECKED(Smi, smi_modules, args[0]); 8492 CONVERT_CHECKED(Smi, smi_modules, args[0]);
8455 CONVERT_CHECKED(Smi, smi_tag, args[1]); 8493 CONVERT_CHECKED(Smi, smi_tag, args[1]);
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
8711 } else { 8749 } else {
8712 // Handle last resort GC and make sure to allow future allocations 8750 // Handle last resort GC and make sure to allow future allocations
8713 // to grow the heap without causing GCs (if possible). 8751 // to grow the heap without causing GCs (if possible).
8714 Counters::gc_last_resort_from_js.Increment(); 8752 Counters::gc_last_resort_from_js.Increment();
8715 Heap::CollectAllGarbage(false); 8753 Heap::CollectAllGarbage(false);
8716 } 8754 }
8717 } 8755 }
8718 8756
8719 8757
8720 } } // namespace v8::internal 8758 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime.h ('k') | test/mjsunit/debug-liveedit-check-stack.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698