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

Unified Diff: src/runtime.cc

Issue 2943002: Reimplement stack manipulations for LiveEdit (Closed)
Patch Set: follow codereview Created 10 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime.h ('k') | src/scopeinfo.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index 867c86d3c841ee2cfc3f1c375f2af716d383d8ad..df693c097e5e7c12682e08630a17f758a42ba7a0 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -8490,7 +8490,9 @@ static Object* Runtime_GetFrameDetails(Arguments args) {
// Get code and read scope info from it for local variable information.
Handle<Code> code(it.frame()->code());
- ScopeInfo<> info(*code);
+ FunctionScopeState scope_state = LiveEdit::IsAtFrameResetPatch(it.frame())
+ ? FUNCTION_SCOPE_NOT_ENTERED : FUNCTION_SCOPE_NORMAL;
+ ScopeInfo<> info(*code, scope_state);
// Get the context.
Handle<Context> context(Context::cast(it.frame()->context()));
@@ -8687,7 +8689,10 @@ static void CopyContextLocalsToScopeObject(Handle<Code> code,
static Handle<JSObject> MaterializeLocalScope(JavaScriptFrame* frame) {
Handle<JSFunction> function(JSFunction::cast(frame->function()));
Handle<Code> code(function->code());
- ScopeInfo<> scope_info(*code);
+
+ FunctionScopeState scope_state = LiveEdit::IsAtFrameResetPatch(frame)
+ ? FUNCTION_SCOPE_NOT_ENTERED : FUNCTION_SCOPE_NORMAL;
+ ScopeInfo<> scope_info(*code, scope_state);
// Allocate and initialize a JSObject with all the arguments, stack locals
// heap locals and extension properties of the debugged function.
@@ -8738,7 +8743,7 @@ static Handle<JSObject> MaterializeClosure(Handle<Context> context) {
ASSERT(context->is_function_context());
Handle<Code> code(context->closure()->code());
- ScopeInfo<> scope_info(*code);
+ ScopeInfo<> scope_info(*code, FUNCTION_SCOPE_NORMAL);
// Allocate and initialize a JSObject with all the content of theis function
// closure.
@@ -8927,7 +8932,7 @@ class ScopeIterator {
case ScopeIterator::ScopeTypeLocal: {
PrintF("Local:\n");
Handle<Code> code(function_->code());
- ScopeInfo<> scope_info(*code);
+ ScopeInfo<> scope_info(*code, FUNCTION_SCOPE_NORMAL);
scope_info.Print();
if (!CurrentContext().is_null()) {
CurrentContext()->Print();
@@ -9519,7 +9524,9 @@ static Object* Runtime_DebugEvaluate(Arguments args) {
JavaScriptFrame* frame = it.frame();
Handle<JSFunction> function(JSFunction::cast(frame->function()));
Handle<Code> code(function->code());
- ScopeInfo<> sinfo(*code);
+ FunctionScopeState scope_state = LiveEdit::IsAtFrameResetPatch(frame)
+ ? FUNCTION_SCOPE_NOT_ENTERED : FUNCTION_SCOPE_NORMAL;
+ ScopeInfo<> sinfo(*code, scope_state);
// Traverse the saved contexts chain to find the active context for the
// selected frame.
@@ -9541,7 +9548,8 @@ static Object* Runtime_DebugEvaluate(Arguments args) {
Factory::NewFunction(Factory::empty_string(), Factory::undefined_value());
go_between->set_context(function->context());
#ifdef DEBUG
- ScopeInfo<> go_between_sinfo(go_between->shared()->code());
+ ScopeInfo<> go_between_sinfo(go_between->shared()->code(),
+ FUNCTION_SCOPE_NORMAL);
ASSERT(go_between_sinfo.number_of_parameters() == 0);
ASSERT(go_between_sinfo.number_of_context_slots() == 0);
#endif
@@ -10031,12 +10039,26 @@ static Object* Runtime_LiveEditReplaceScript(Arguments args) {
// Replaces code of SharedFunctionInfo with a new one.
static Object* Runtime_LiveEditReplaceFunctionCode(Arguments args) {
- ASSERT(args.length() == 2);
+ ASSERT(args.length() == 3);
HandleScope scope;
CONVERT_ARG_CHECKED(JSArray, new_compile_info, 0);
CONVERT_ARG_CHECKED(JSArray, shared_info, 1);
+ ByteArray* stack_drop_data;
+ if (args[2]->IsUndefined()) {
+ stack_drop_data = NULL;
+ } else {
+ CONVERT_CHECKED(JSValue, stack_drop_data_wrapped, args[2]);
+ CONVERT_CHECKED(ByteArray, stack_drop_data_temp,
+ stack_drop_data_wrapped->value());
+ stack_drop_data = stack_drop_data_temp;
+ }
+ Handle<ByteArray> stack_drop_data_handle;
+ if (stack_drop_data != NULL) {
+ stack_drop_data_handle = Handle<ByteArray>(stack_drop_data);
+ }
- return LiveEdit::ReplaceFunctionCode(new_compile_info, shared_info);
+ return LiveEdit::ReplaceFunctionCode(new_compile_info, shared_info,
+ stack_drop_data_handle);
}
// Connects SharedFunctionInfo to another script.
@@ -10099,13 +10121,12 @@ static Object* Runtime_LiveEditPatchFunctionPositions(Arguments args) {
// checks that none of them have activations on stacks (of any thread).
// Returns array of the same length with corresponding results of
// LiveEdit::FunctionPatchabilityStatus type.
-static Object* Runtime_LiveEditCheckAndDropActivations(Arguments args) {
- ASSERT(args.length() == 2);
+static Object* Runtime_LiveEditCheckActivations(Arguments args) {
+ ASSERT(args.length() == 1);
HandleScope scope;
CONVERT_ARG_CHECKED(JSArray, shared_array, 0);
- CONVERT_BOOLEAN_CHECKED(do_drop, args[1]);
- return *LiveEdit::CheckAndDropActivations(shared_array, do_drop);
+ return *LiveEdit::CheckActivations(shared_array);
}
// Compares 2 strings line-by-line and returns diff in form of JSArray of
« no previous file with comments | « src/runtime.h ('k') | src/scopeinfo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698