Commit 7ef9b6b8 authored by bmeurer's avatar bmeurer Committed by Commit bot

[Interpreter] Use existing type conversion stubs.

We already have stubs for ToName, ToObject and ToNumber, so we can just
use them for Ignition instead of the generic runtime calls.

R=rmcilroy@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#34288}
parent fab25310
......@@ -1224,16 +1224,22 @@ void Interpreter::DoTestInstanceOf(InterpreterAssembler* assembler) {
DoBinaryOp(Runtime::kInstanceOf, assembler);
}
void Interpreter::DoTypeConversionOp(Callable callable,
InterpreterAssembler* assembler) {
Node* target = __ HeapConstant(callable.code());
Node* accumulator = __ GetAccumulator();
Node* context = __ GetContext();
Node* result =
__ CallStub(callable.descriptor(), target, context, accumulator);
__ SetAccumulator(result);
__ Dispatch();
}
// ToName
//
// Cast the object referenced by the accumulator to a name.
void Interpreter::DoToName(InterpreterAssembler* assembler) {
Node* accumulator = __ GetAccumulator();
Node* context = __ GetContext();
Node* result = __ CallRuntime(Runtime::kToName, context, accumulator);
__ SetAccumulator(result);
__ Dispatch();
DoTypeConversionOp(CodeFactory::ToName(isolate_), assembler);
}
......@@ -1241,11 +1247,7 @@ void Interpreter::DoToName(InterpreterAssembler* assembler) {
//
// Cast the object referenced by the accumulator to a number.
void Interpreter::DoToNumber(InterpreterAssembler* assembler) {
Node* accumulator = __ GetAccumulator();
Node* context = __ GetContext();
Node* result = __ CallRuntime(Runtime::kToNumber, context, accumulator);
__ SetAccumulator(result);
__ Dispatch();
DoTypeConversionOp(CodeFactory::ToNumber(isolate_), assembler);
}
......@@ -1253,11 +1255,7 @@ void Interpreter::DoToNumber(InterpreterAssembler* assembler) {
//
// Cast the object referenced by the accumulator to a JSObject.
void Interpreter::DoToObject(InterpreterAssembler* assembler) {
Node* accumulator = __ GetAccumulator();
Node* context = __ GetContext();
Node* result = __ CallRuntime(Runtime::kToObject, context, accumulator);
__ SetAccumulator(result);
__ Dispatch();
DoTypeConversionOp(CodeFactory::ToObject(isolate_), assembler);
}
......
......@@ -103,9 +103,12 @@ class Interpreter {
// Generates code to perform a JS runtime call.
void DoCallJSRuntimeCommon(InterpreterAssembler* assembler);
// Generates code to perform a constructor call..
// Generates code to perform a constructor call.
void DoCallConstruct(InterpreterAssembler* assembler);
// Generates code to perform a type conversion.
void DoTypeConversionOp(Callable callable, InterpreterAssembler* assembler);
// Generates code ro create a literal via |function_id|.
void DoCreateLiteral(Runtime::FunctionId function_id,
InterpreterAssembler* assembler);
......
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