Commit 99a5aa1b authored by cbruni's avatar cbruni Committed by Commit bot

[crankshaft] Fix IsClassOfTest helper method

Drive-by-fix: Add AstNode::Print() and improve printing of CallRuntime
              Expression.

BUG=v8:5749

Review-Url: https://codereview.chromium.org/2586933002
Cr-Commit-Position: refs/heads/master@{#41803}
parent 3ab3b626
......@@ -28,6 +28,8 @@ namespace internal {
#ifdef DEBUG
void AstNode::Print() { Print(Isolate::Current()); }
void AstNode::Print(Isolate* isolate) {
AstPrinter::PrintOut(isolate, this);
}
......
......@@ -191,6 +191,7 @@ class AstNode: public ZoneObject {
int position() const { return position_; }
#ifdef DEBUG
void Print();
void Print(Isolate* isolate);
#endif // DEBUG
......
......@@ -1142,7 +1142,14 @@ void AstPrinter::VisitCallNew(CallNew* node) {
void AstPrinter::VisitCallRuntime(CallRuntime* node) {
EmbeddedVector<char, 128> buf;
SNPrintF(buf, "CALL RUNTIME %s", node->debug_name());
if (node->is_jsruntime()) {
SNPrintF(
buf, "CALL RUNTIME %s code = %p", node->debug_name(),
static_cast<void*>(isolate_->context()->get(node->context_index())));
} else {
SNPrintF(buf, "CALL RUNTIME %s", node->debug_name());
}
IndentedScope indent(this, buf.start(), node->position());
PrintArguments(node->arguments());
}
......
......@@ -10924,15 +10924,12 @@ static bool IsClassOfTest(CompareOperation* expr) {
Literal* literal = expr->right()->AsLiteral();
if (literal == NULL) return false;
if (!literal->value()->IsString()) return false;
if (!call->is_jsruntime() &&
call->function()->function_id != Runtime::kInlineClassOf) {
return false;
}
DCHECK(call->arguments()->length() == 1);
if (call->is_jsruntime()) return false;
if (call->function()->function_id != Runtime::kInlineClassOf) return false;
DCHECK_EQ(call->arguments()->length(), 1);
return true;
}
void HOptimizedGraphBuilder::VisitBinaryOperation(BinaryOperation* expr) {
DCHECK(!HasStackOverflow());
DCHECK(current_block() != NULL);
......
// Copyright 2016 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 f(x) {
(x ** 1) === '';
}
f();
f();
f();
%OptimizeFunctionOnNextCall(f);
f();
function g(x) {
'' === (x ** 1);
}
g();
g();
g();
%OptimizeFunctionOnNextCall(g);
g();
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