Commit 5bcddae7 authored by yangguo's avatar yangguo Committed by Commit bot

[crankshaft] only compile string index access with element key.

R=bmeurer@chromium.org
BUG=chromium:554831
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#32084}
parent e90a0b3c
......@@ -7876,7 +7876,7 @@ void HOptimizedGraphBuilder::PushLoad(Property* expr,
void HOptimizedGraphBuilder::BuildLoad(Property* expr,
BailoutId ast_id) {
HInstruction* instr = NULL;
if (expr->IsStringAccess()) {
if (expr->IsStringAccess() && expr->GetKeyType() == ELEMENT) {
HValue* index = Pop();
HValue* string = Pop();
HInstruction* char_code = BuildStringCharCodeAt(string, index);
......
// Copyright 2015 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
(function() {
var key = "s";
function f(object) { return object[key]; };
f("");
f("");
%OptimizeFunctionOnNextCall(f);
f("");
assertOptimized(f);
})();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment