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

Unified Diff: src/interpreter/interpreter.cc

Issue 2165953002: [interpreter] Add a register operand to ToNumber (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: regenerate bytecode expectations Created 4 years, 5 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
Index: src/interpreter/interpreter.cc
diff --git a/src/interpreter/interpreter.cc b/src/interpreter/interpreter.cc
index b461264c22863fcf3c73c3768da8ad0d43696e82..c4e285d03b55d0ed5f2242c313efb16c4c203a54 100644
--- a/src/interpreter/interpreter.cc
+++ b/src/interpreter/interpreter.cc
@@ -997,14 +997,19 @@ void Interpreter::DoShiftRightSmi(InterpreterAssembler* assembler) {
__ Dispatch();
}
-void Interpreter::DoUnaryOp(Callable callable,
- InterpreterAssembler* assembler) {
+void Interpreter::DoUnaryOp(Callable callable, InterpreterAssembler* assembler,
+ Bytecode bytecode) {
Node* target = __ HeapConstant(callable.code());
Node* accumulator = __ GetAccumulator();
Node* context = __ GetContext();
Node* result =
__ CallStub(callable.descriptor(), target, context, accumulator);
- __ SetAccumulator(result);
+ if (Bytecodes::NumberOfOperands(bytecode) == 1 &&
rmcilroy 2016/07/21 09:31:48 Let's not do this in an if here. Split out BuildUn
klaasb 2016/07/21 10:55:19 Done.
+ Bytecodes::GetOperandType(bytecode, 0) == OperandType::kRegOut) {
+ __ StoreRegister(result, __ BytecodeOperandReg(0));
+ } else {
+ __ SetAccumulator(result);
+ }
__ Dispatch();
}
@@ -1021,21 +1026,21 @@ void Interpreter::DoUnaryOp(InterpreterAssembler* assembler) {
//
// Cast the object referenced by the accumulator to a name.
void Interpreter::DoToName(InterpreterAssembler* assembler) {
- DoUnaryOp(CodeFactory::ToName(isolate_), assembler);
+ DoUnaryOp(CodeFactory::ToName(isolate_), assembler, Bytecode::kToName);
}
// ToNumber
//
// Cast the object referenced by the accumulator to a number.
void Interpreter::DoToNumber(InterpreterAssembler* assembler) {
- DoUnaryOp(CodeFactory::ToNumber(isolate_), assembler);
+ DoUnaryOp(CodeFactory::ToNumber(isolate_), assembler, Bytecode::kToNumber);
}
// ToObject
//
// Cast the object referenced by the accumulator to a JSObject.
void Interpreter::DoToObject(InterpreterAssembler* assembler) {
- DoUnaryOp(CodeFactory::ToObject(isolate_), assembler);
+ DoUnaryOp(CodeFactory::ToObject(isolate_), assembler, Bytecode::kToObject);
}
// Inc
@@ -1114,7 +1119,7 @@ void Interpreter::DoLogicalNot(InterpreterAssembler* assembler) {
// Load the accumulator with the string representating type of the
// object in the accumulator.
void Interpreter::DoTypeOf(InterpreterAssembler* assembler) {
- DoUnaryOp(CodeFactory::Typeof(isolate_), assembler);
+ DoUnaryOp(CodeFactory::Typeof(isolate_), assembler, Bytecode::kTypeOf);
}
void Interpreter::DoDelete(Runtime::FunctionId function_id,

Powered by Google App Engine
This is Rietveld 408576698