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

Side by Side Diff: src/liveedit-debugger.js

Issue 1118007: LiveEdit: implement frame dropping (Closed)
Patch Set: adding rule to mjsunit.status Created 10 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
« no previous file with comments | « src/liveedit.cc ('k') | src/mips/debug-mips.cc » ('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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 // have activations on stack (of any thread). Throws a Failure exception 382 // have activations on stack (of any thread). Throws a Failure exception
383 // if this proves to be false. 383 // if this proves to be false.
384 Debug.LiveEditChangeScript.CheckStackActivations = function(shared_wrapper_list, 384 Debug.LiveEditChangeScript.CheckStackActivations = function(shared_wrapper_list,
385 change_log) { 385 change_log) {
386 var liveedit = Debug.LiveEditChangeScript; 386 var liveedit = Debug.LiveEditChangeScript;
387 387
388 var shared_list = new Array(); 388 var shared_list = new Array();
389 for (var i = 0; i < shared_wrapper_list.length; i++) { 389 for (var i = 0; i < shared_wrapper_list.length; i++) {
390 shared_list[i] = shared_wrapper_list[i].info; 390 shared_list[i] = shared_wrapper_list[i].info;
391 } 391 }
392 var result = %LiveEditCheckStackActivations(shared_list); 392 var result = %LiveEditCheckAndDropActivations(shared_list, true);
393 if (result[shared_list.length]) {
394 // Extra array element may contain error message.
395 throw new liveedit.Failure(result[shared_list.length]);
396 }
397
393 var problems = new Array(); 398 var problems = new Array();
399 var dropped = new Array();
394 for (var i = 0; i < shared_list.length; i++) { 400 for (var i = 0; i < shared_list.length; i++) {
395 if (result[i] == liveedit.FunctionPatchabilityStatus.FUNCTION_BLOCKED_ON_STA CK) { 401 var shared = shared_wrapper_list[i];
396 var shared = shared_list[i]; 402 if (result[i] == liveedit.FunctionPatchabilityStatus.REPLACED_ON_ACTIVE_STAC K) {
403 dropped.push({ name: shared.function_name } );
404 } else if (result[i] != liveedit.FunctionPatchabilityStatus.AVAILABLE_FOR_PA TCH) {
397 var description = { 405 var description = {
398 name: shared.function_name, 406 name: shared.function_name,
399 start_pos: shared.start_position, 407 start_pos: shared.start_position,
400 end_pos: shared.end_position 408 end_pos: shared.end_position,
409 replace_problem:
410 liveedit.FunctionPatchabilityStatus.SymbolName(result[i])
401 }; 411 };
402 problems.push(description); 412 problems.push(description);
403 } 413 }
404 } 414 }
415 if (dropped.length > 0) {
416 change_log.push({ dropped_from_stack: dropped });
417 }
405 if (problems.length > 0) { 418 if (problems.length > 0) {
406 change_log.push( { functions_on_stack: problems } ); 419 change_log.push( { functions_on_stack: problems } );
407 throw new liveedit.Failure("Blocked by functions on stack"); 420 throw new liveedit.Failure("Blocked by functions on stack");
408 } 421 }
409 } 422 }
410 423
411 // A copy of the FunctionPatchabilityStatus enum from liveedit.h 424 // A copy of the FunctionPatchabilityStatus enum from liveedit.h
412 Debug.LiveEditChangeScript.FunctionPatchabilityStatus = { 425 Debug.LiveEditChangeScript.FunctionPatchabilityStatus = {
413 FUNCTION_AVAILABLE_FOR_PATCH: 0, 426 AVAILABLE_FOR_PATCH: 1,
414 FUNCTION_BLOCKED_ON_STACK: 1 427 BLOCKED_ON_ACTIVE_STACK: 2,
428 BLOCKED_ON_OTHER_STACK: 3,
429 BLOCKED_UNDER_NATIVE_CODE: 4,
430 REPLACED_ON_ACTIVE_STACK: 5
431 }
432
433 Debug.LiveEditChangeScript.FunctionPatchabilityStatus.SymbolName =
434 function(code) {
435 var enum = Debug.LiveEditChangeScript.FunctionPatchabilityStatus;
436 for (name in enum) {
437 if (enum[name] == code) {
438 return name;
439 }
440 }
415 } 441 }
416 442
417 443
418 // A logical failure in liveedit process. This means that change_log 444 // A logical failure in liveedit process. This means that change_log
419 // is valid and consistent description of what happened. 445 // is valid and consistent description of what happened.
420 Debug.LiveEditChangeScript.Failure = function(message) { 446 Debug.LiveEditChangeScript.Failure = function(message) {
421 this.message = message; 447 this.message = message;
422 } 448 }
423 449
424 Debug.LiveEditChangeScript.Failure.prototype.toString = function() { 450 Debug.LiveEditChangeScript.Failure.prototype.toString = function() {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 } 531 }
506 532
507 if (old_len == 0 && new_len == 0) { 533 if (old_len == 0 && new_len == 0) {
508 // no change 534 // no change
509 return; 535 return;
510 } 536 }
511 537
512 return { "change_pos": change_pos, "old_len": old_len, "new_len": new_len }; 538 return { "change_pos": change_pos, "old_len": old_len, "new_len": new_len };
513 } 539 }
514 } 540 }
OLDNEW
« no previous file with comments | « src/liveedit.cc ('k') | src/mips/debug-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698