Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Unified Diff: src/interpreter/interpreter.cc

Issue 1736643003: [Interpreter] Use existing type conversion stubs. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/interpreter/interpreter.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/interpreter.cc
diff --git a/src/interpreter/interpreter.cc b/src/interpreter/interpreter.cc
index d58771107e27d3727d88bd16b62f5c371f8a49dd..4eb4253de03e9e40b4cf5bc2e0c0b71fc7b1ed7e 100644
--- a/src/interpreter/interpreter.cc
+++ b/src/interpreter/interpreter.cc
@@ -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);
}
« no previous file with comments | « src/interpreter/interpreter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698