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

Unified Diff: src/parsing/pattern-rewriter.cc

Issue 1770783003: Revert of [debugger] break at each initialization in a multiple var declaration. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/cctest/test-debug.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/pattern-rewriter.cc
diff --git a/src/parsing/pattern-rewriter.cc b/src/parsing/pattern-rewriter.cc
index 2a194ee14b32d9145bddd82f26285ab86ad81241..02d6de513fe9ce5ec8cd8f0895d4358af88a45ea 100644
--- a/src/parsing/pattern-rewriter.cc
+++ b/src/parsing/pattern-rewriter.cc
@@ -230,20 +230,22 @@
if (IsImmutableVariableMode(descriptor_->mode)) {
arguments->Add(value, zone());
+ value = NULL; // zap the value to avoid the unnecessary assignment
+
// Construct the call to Runtime_InitializeConstGlobal
// and add it to the initialization statement block.
// Note that the function does different things depending on
// the number of arguments (1 or 2).
- initialize = factory()->NewCallRuntime(Runtime::kInitializeConstGlobal,
- arguments, value->position());
- value = NULL; // zap the value to avoid the unnecessary assignment
+ initialize =
+ factory()->NewCallRuntime(Runtime::kInitializeConstGlobal, arguments,
+ descriptor_->initialization_pos);
} else {
// Add language mode.
// We may want to pass singleton to avoid Literal allocations.
LanguageMode language_mode = initialization_scope->language_mode();
- arguments->Add(
- factory()->NewNumberLiteral(language_mode, RelocInfo::kNoPosition),
- zone());
+ arguments->Add(factory()->NewNumberLiteral(language_mode,
+ descriptor_->declaration_pos),
+ zone());
// Be careful not to assign a value to the global variable if
// we're in a with. The initialization value should not
@@ -251,11 +253,12 @@
// which is why we need to generate a separate assignment node.
if (value != NULL && !descriptor_->scope->inside_with()) {
arguments->Add(value, zone());
+ value = NULL; // zap the value to avoid the unnecessary assignment
// Construct the call to Runtime_InitializeVarGlobal
// and add it to the initialization statement block.
- initialize = factory()->NewCallRuntime(Runtime::kInitializeVarGlobal,
- arguments, value->position());
- value = NULL; // zap the value to avoid the unnecessary assignment
+ initialize =
+ factory()->NewCallRuntime(Runtime::kInitializeVarGlobal, arguments,
+ descriptor_->declaration_pos);
} else {
initialize = NULL;
}
@@ -279,7 +282,8 @@
DCHECK_NOT_NULL(proxy->var());
DCHECK_NOT_NULL(value);
// Add break location for destructured sub-pattern.
- int pos = IsSubPattern() ? pattern->position() : value->position();
+ int pos =
+ IsSubPattern() ? pattern->position() : descriptor_->initialization_pos;
Assignment* assignment =
factory()->NewAssignment(Token::INIT, proxy, value, pos);
block_->statements()->Add(
@@ -296,7 +300,8 @@
// property).
VariableProxy* proxy = initialization_scope->NewUnresolved(factory(), name);
// Add break location for destructured sub-pattern.
- int pos = IsSubPattern() ? pattern->position() : value->position();
+ int pos =
+ IsSubPattern() ? pattern->position() : descriptor_->initialization_pos;
Assignment* assignment =
factory()->NewAssignment(Token::INIT, proxy, value, pos);
block_->statements()->Add(
« no previous file with comments | « no previous file | test/cctest/test-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698