Fix handling of constant global variable assignments.
BUG=347904 LOG=y R=hpayer@chromium.org Review URL: https://codereview.chromium.org/184303003 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19594 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
0a93163138
commit
5945f9ebb9
@ -5909,18 +5909,27 @@ void HOptimizedGraphBuilder::HandleGlobalVariableAssignment(
|
||||
Handle<GlobalObject> global(current_info()->global_object());
|
||||
Handle<PropertyCell> cell(global->GetPropertyCell(&lookup));
|
||||
if (cell->type()->IsConstant()) {
|
||||
IfBuilder builder(this);
|
||||
HValue* constant = Add<HConstant>(cell->type()->AsConstant());
|
||||
if (cell->type()->AsConstant()->IsNumber()) {
|
||||
builder.If<HCompareNumericAndBranch>(value, constant, Token::EQ);
|
||||
Handle<Object> constant = cell->type()->AsConstant();
|
||||
if (value->IsConstant()) {
|
||||
HConstant* c_value = HConstant::cast(value);
|
||||
if (!constant.is_identical_to(c_value->handle(isolate()))) {
|
||||
Add<HDeoptimize>("Constant global variable assignment",
|
||||
Deoptimizer::EAGER);
|
||||
}
|
||||
} else {
|
||||
builder.If<HCompareObjectEqAndBranch>(value, constant);
|
||||
HValue* c_constant = Add<HConstant>(constant);
|
||||
IfBuilder builder(this);
|
||||
if (constant->IsNumber()) {
|
||||
builder.If<HCompareNumericAndBranch>(value, c_constant, Token::EQ);
|
||||
} else {
|
||||
builder.If<HCompareObjectEqAndBranch>(value, c_constant);
|
||||
}
|
||||
builder.Then();
|
||||
builder.Else();
|
||||
Add<HDeoptimize>("Constant global variable assignment",
|
||||
Deoptimizer::EAGER);
|
||||
builder.End();
|
||||
}
|
||||
builder.Then();
|
||||
builder.Else();
|
||||
Add<HDeoptimize>("Constant global variable assignment",
|
||||
Deoptimizer::EAGER);
|
||||
builder.End();
|
||||
}
|
||||
HInstruction* instr =
|
||||
Add<HStoreGlobalCell>(value, cell, lookup.GetPropertyDetails());
|
||||
|
12
test/mjsunit/regress/regress-347904.js
Normal file
12
test/mjsunit/regress/regress-347904.js
Normal file
@ -0,0 +1,12 @@
|
||||
// Copyright 2014 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --allow-natives-syntax --stress-runs=2
|
||||
|
||||
var v = /abc/;
|
||||
function f() {
|
||||
v = 1578221999;
|
||||
};
|
||||
%OptimizeFunctionOnNextCall(f);
|
||||
f();
|
Loading…
Reference in New Issue
Block a user