A few tests fails when I run them with --hydrogen-track-positions

The root of problem is the fact that we don't track the position of 'this' statement but use them when visit compare statement.
As a result we have -1 as the position of left expression and the resulting relative position is negative and doesn't fit into BitField.

BUG=452067
TEST=test-cpu-profiler/SourceLocation
LOG=n

Review URL: https://codereview.chromium.org/940593002

Cr-Commit-Position: refs/heads/master@{#26741}
This commit is contained in:
loislo 2015-02-19 02:07:46 -08:00 committed by Commit bot
parent 5242700da4
commit 36ed9ca348
2 changed files with 19 additions and 2 deletions

View File

@ -1375,7 +1375,8 @@ class PreParserTraits {
}
static PreParserExpression ThisExpression(Scope* scope,
PreParserFactory* factory) {
PreParserFactory* factory,
int pos) {
return PreParserExpression::This();
}
@ -1850,7 +1851,7 @@ ParserBase<Traits>::ParsePrimaryExpression(bool* ok) {
case Token::THIS: {
Consume(Token::THIS);
scope_->RecordThisUsage();
result = this->ThisExpression(scope_, factory());
result = this->ThisExpression(scope_, factory(), pos);
break;
}

View File

@ -1780,3 +1780,19 @@ TEST(CollectDeoptEvents) {
iopt_function->deopt_infos()[1].deopt_reason);
iprofiler->DeleteProfile(iprofile);
}
TEST(SourceLocation) {
i::FLAG_always_opt = true;
i::FLAG_hydrogen_track_positions = true;
LocalContext env;
v8::HandleScope scope(CcTest::isolate());
const char* source =
"function CompareStatementWithThis() {\n"
" if (this === 1) {}\n"
"}\n"
"CompareStatementWithThis();\n";
v8::Script::Compile(v8_str(source))->Run();
}