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

Side by Side Diff: src/interpreter/interpreter.cc

Issue 2673833003: [interpreter] Create custom call opcodes for specific argument counts (Closed)
Patch Set: 32- and 64-bit ports Created 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/interpreter/interpreter.h" 5 #include "src/interpreter/interpreter.h"
6 6
7 #include <fstream> 7 #include <fstream>
8 #include <memory> 8 #include <memory>
9 9
10 #include "src/ast/prettyprinter.h" 10 #include "src/ast/prettyprinter.h"
(...skipping 2066 matching lines...) Expand 10 before | Expand all | Expand 10 after
2077 // 2077 //
2078 // Call a JSfunction or Callable in |callable| with the |receiver| and 2078 // Call a JSfunction or Callable in |callable| with the |receiver| and
2079 // |arg_count| arguments in subsequent registers. Collect type feedback into 2079 // |arg_count| arguments in subsequent registers. Collect type feedback into
2080 // |feedback_slot_id|. The callable is known to be a property of the receiver. 2080 // |feedback_slot_id|. The callable is known to be a property of the receiver.
2081 void Interpreter::DoCallProperty(InterpreterAssembler* assembler) { 2081 void Interpreter::DoCallProperty(InterpreterAssembler* assembler) {
2082 // TODO(leszeks): Look into making the interpreter use the fact that the 2082 // TODO(leszeks): Look into making the interpreter use the fact that the
2083 // receiver is non-null. 2083 // receiver is non-null.
2084 DoJSCall(assembler, TailCallMode::kDisallow); 2084 DoJSCall(assembler, TailCallMode::kDisallow);
2085 } 2085 }
2086 2086
2087 void Interpreter::DoCall0(InterpreterAssembler* assembler) {
2088 Node* function_reg = __ BytecodeOperandReg(0);
2089 Node* function = __ LoadRegister(function_reg);
2090 Node* receiver_reg = __ BytecodeOperandReg(1);
2091 Node* receiver_arg = __ RegisterLocation(receiver_reg);
2092 Node* receiver = __ Load(MachineType::TaggedPointer(), receiver_arg);
2093 Node* slot_id = __ BytecodeOperandIdxInt32(2);
2094 Node* type_feedback_vector = __ LoadTypeFeedbackVector();
2095 Node* context = __ GetContext();
2096 Callable call_ic = CodeFactory::CallIC(isolate_);
2097 Node* result = __ CallStub(call_ic, context, function, __ Int32Constant(0),
2098 slot_id, type_feedback_vector, receiver);
rmcilroy 2017/02/06 12:20:01 Could we pull the shared logic out to a common hel
2099 __ SetAccumulator(result);
2100 __ Dispatch();
2101 }
2102
2103 void Interpreter::DoCall1(InterpreterAssembler* assembler) {
2104 Node* function_reg = __ BytecodeOperandReg(0);
2105 Node* function = __ LoadRegister(function_reg);
2106 Node* receiver_reg = __ BytecodeOperandReg(1);
2107 Node* receiver_arg = __ RegisterLocation(receiver_reg);
2108 Node* receiver = __ Load(MachineType::TaggedPointer(), receiver_arg);
2109 Node* arg0_reg = __ BytecodeOperandReg(2);
2110 Node* arg0 = __ LoadRegister(arg0_reg);
2111 Node* slot_id = __ BytecodeOperandIdxInt32(3);
2112 Node* type_feedback_vector = __ LoadTypeFeedbackVector();
2113 Node* context = __ GetContext();
2114 Callable call_ic = CodeFactory::CallIC(isolate_);
2115 Node* result = __ CallStub(call_ic, context, function, __ Int32Constant(1),
2116 slot_id, type_feedback_vector, receiver, arg0);
2117 __ SetAccumulator(result);
2118 __ Dispatch();
2119 }
2120
2121 void Interpreter::DoCall2(InterpreterAssembler* assembler) {
2122 Node* function_reg = __ BytecodeOperandReg(0);
2123 Node* function = __ LoadRegister(function_reg);
2124 Node* receiver_reg = __ BytecodeOperandReg(1);
2125 Node* receiver = __ LoadRegister(receiver_reg);
2126 Node* arg0_reg = __ BytecodeOperandReg(2);
2127 Node* arg0 = __ LoadRegister(arg0_reg);
2128 Node* arg1_reg = __ BytecodeOperandReg(3);
2129 Node* arg1 = __ LoadRegister(arg1_reg);
2130 Node* slot_id = __ BytecodeOperandIdxInt32(4);
2131 Node* type_feedback_vector = __ LoadTypeFeedbackVector();
2132 Node* context = __ GetContext();
2133 Callable call_ic = CodeFactory::CallIC(isolate_);
2134 Node* result =
2135 __ CallStub(call_ic, context, function, __ Int32Constant(2), slot_id,
2136 type_feedback_vector, receiver, arg0, arg1);
2137 __ Comment("SetAccumulator");
rmcilroy 2017/02/06 12:20:01 unintended comment?
2138 __ SetAccumulator(result);
2139 __ Dispatch();
2140 }
2141
2087 // TailCall <callable> <receiver> <arg_count> <feedback_slot_id> 2142 // TailCall <callable> <receiver> <arg_count> <feedback_slot_id>
2088 // 2143 //
2089 // Tail call a JSfunction or Callable in |callable| with the |receiver| and 2144 // Tail call a JSfunction or Callable in |callable| with the |receiver| and
2090 // |arg_count| arguments in subsequent registers. Collect type feedback 2145 // |arg_count| arguments in subsequent registers. Collect type feedback
2091 // into |feedback_slot_id| 2146 // into |feedback_slot_id|
2092 void Interpreter::DoTailCall(InterpreterAssembler* assembler) { 2147 void Interpreter::DoTailCall(InterpreterAssembler* assembler) {
2093 DoJSCall(assembler, TailCallMode::kAllow); 2148 DoJSCall(assembler, TailCallMode::kAllow);
2094 } 2149 }
2095 2150
2096 // CallRuntime <function_id> <first_arg> <arg_count> 2151 // CallRuntime <function_id> <first_arg> <arg_count>
(...skipping 1202 matching lines...) Expand 10 before | Expand all | Expand 10 after
3299 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, 3354 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset,
3300 __ SmiTag(new_state)); 3355 __ SmiTag(new_state));
3301 __ SetAccumulator(old_state); 3356 __ SetAccumulator(old_state);
3302 3357
3303 __ Dispatch(); 3358 __ Dispatch();
3304 } 3359 }
3305 3360
3306 } // namespace interpreter 3361 } // namespace interpreter
3307 } // namespace internal 3362 } // namespace internal
3308 } // namespace v8 3363 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698