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

Unified Diff: src/string.js

Issue 10134006: Disabling stepping into callback function of String.replace. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/mjsunit/debug-stepin-builtin-callback.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/string.js
diff --git a/src/string.js b/src/string.js
index 964790f52b83834595f6a7625af269ed6ce79ff3..bd996deaa6af93ebb7a25e96c8f8beac17bea19d 100644
--- a/src/string.js
+++ b/src/string.js
@@ -266,10 +266,6 @@ function StringReplace(search, replace) {
// Compute the string to replace with.
if (IS_SPEC_FUNCTION(replace)) {
var receiver = %GetDefaultReceiver(replace);
- // Prepare break slots for debugger step in.
- if (%DebugCallbackSupportsStepping(replace)) {
- %DebugPrepareStepInIfStepping(replace);
- }
builder.add(%_CallFunction(receiver,
search,
start,
@@ -438,49 +434,24 @@ function StringReplaceGlobalRegExpWithFunction(subject, regexp, replace) {
var match_start = 0;
var override = new InternalArray(null, 0, subject);
var receiver = %GetDefaultReceiver(replace);
- if (%DebugCallbackSupportsStepping(replace)) {
- while (i < len) {
- var elem = res[i];
- if (%_IsSmi(elem)) {
- if (elem > 0) {
- match_start = (elem >> 11) + (elem & 0x7ff);
- } else {
- match_start = res[++i] - elem;
- }
- } else {
- override[0] = elem;
- override[1] = match_start;
- lastMatchInfoOverride = override;
- %DebugPrepareStepInIfStepping(replace);
- var func_result =
- %_CallFunction(receiver, elem, match_start, subject, replace);
- res[i] = TO_STRING_INLINE(func_result);
- match_start += elem.length;
- }
- i++;
- }
- } else {
- // This is a duplicate of the previous loop sans debug stepping.
- while (i < len) {
- var elem = res[i];
- if (%_IsSmi(elem)) {
- if (elem > 0) {
- match_start = (elem >> 11) + (elem & 0x7ff);
- } else {
- match_start = res[++i] - elem;
- }
+ while (i < len) {
+ var elem = res[i];
+ if (%_IsSmi(elem)) {
+ if (elem > 0) {
+ match_start = (elem >> 11) + (elem & 0x7ff);
} else {
- override[0] = elem;
- override[1] = match_start;
- lastMatchInfoOverride = override;
- var func_result =
- %_CallFunction(receiver, elem, match_start, subject, replace);
- res[i] = TO_STRING_INLINE(func_result);
- match_start += elem.length;
+ match_start = res[++i] - elem;
}
- i++;
+ } else {
+ override[0] = elem;
+ override[1] = match_start;
+ lastMatchInfoOverride = override;
+ var func_result =
+ %_CallFunction(receiver, elem, match_start, subject, replace);
+ res[i] = TO_STRING_INLINE(func_result);
+ match_start += elem.length;
}
- // End of duplicate.
+ i++;
}
} else {
var receiver = %GetDefaultReceiver(replace);
@@ -520,10 +491,6 @@ function StringReplaceNonGlobalRegExpWithFunction(subject, regexp, replace) {
if (m == 1) {
// No captures, only the match, which is always valid.
var s = SubString(subject, index, endOfMatch);
- // Prepare break slots for debugger step in.
- if (%DebugCallbackSupportsStepping(replace)) {
- %DebugPrepareStepInIfStepping(replace);
- }
// Don't call directly to avoid exposing the built-in global object.
replacement = %_CallFunction(receiver, s, index, subject, replace);
} else {
« no previous file with comments | « no previous file | test/mjsunit/debug-stepin-builtin-callback.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698