Commit f1d04af5 authored by mstarzinger's avatar mstarzinger Committed by Commit bot

[interpreter] Prepare for shipping --harmony-instanceof.

R=rmcilroy@chromium.org
TEST=cctest/test-interpreter/InterpreterInstanceOf
BUG=v8:4447
LOG=n

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

Cr-Commit-Position: refs/heads/master@{#34933}
parent 1646d14d
......@@ -2877,6 +2877,7 @@ void AstGraphBuilder::VisitCompareOperation(CompareOperation* expr) {
op = javascript()->GreaterThanOrEqual();
break;
case Token::INSTANCEOF:
DCHECK(!FLAG_harmony_instanceof);
op = javascript()->InstanceOf();
break;
case Token::IN:
......
......@@ -1306,6 +1306,7 @@ void BytecodeGraphBuilder::VisitTestIn() {
}
void BytecodeGraphBuilder::VisitTestInstanceOf() {
DCHECK(!FLAG_harmony_instanceof);
BuildCompareOp(javascript()->InstanceOf());
}
......
......@@ -1433,6 +1433,7 @@ Bytecode BytecodeArrayBuilder::BytecodeForCompareOperation(Token::Value op) {
case Token::Value::GTE:
return Bytecode::kTestGreaterThanOrEqual;
case Token::Value::INSTANCEOF:
DCHECK(!FLAG_harmony_instanceof);
return Bytecode::kTestInstanceOf;
case Token::Value::IN:
return Bytecode::kTestIn;
......
......@@ -1450,6 +1450,11 @@ TEST(InterpreterStrictNotEqual) {
TEST(InterpreterInstanceOf) {
HandleAndZoneScope handles;
// TODO(4447): The new ES6 'instanceof' operator is fully desugared in the
// parser and the Token::INSTANCEOF is not needed anymore. This test only
// makes sense with --no-harmony-instanceof and can be removed once we
// deprecate the ability to switch to old skool ES5 'instanceof' for good.
FLAG_harmony_instanceof = false;
i::Factory* factory = handles.main_isolate()->factory();
Handle<i::String> name = factory->NewStringFromAsciiChecked("cons");
Handle<i::JSFunction> func = factory->NewFunction(name);
......
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