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

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

Issue 2629363002: [Ignition/turbo] Add a CallWithSpread bytecode. (Closed)
Patch Set: refactor OnlyLastArgIsSpread Created 3 years, 11 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 2141 matching lines...) Expand 10 before | Expand all | Expand 10 after
2152 Node* native_context = __ LoadNativeContext(context); 2152 Node* native_context = __ LoadNativeContext(context);
2153 Node* function = __ LoadContextElement(native_context, context_index); 2153 Node* function = __ LoadContextElement(native_context, context_index);
2154 2154
2155 // Call the function. 2155 // Call the function.
2156 Node* result = __ CallJS(function, context, first_arg, args_count, 2156 Node* result = __ CallJS(function, context, first_arg, args_count,
2157 TailCallMode::kDisallow); 2157 TailCallMode::kDisallow);
2158 __ SetAccumulator(result); 2158 __ SetAccumulator(result);
2159 __ Dispatch(); 2159 __ Dispatch();
2160 } 2160 }
2161 2161
2162 // CallWithSpread <first_arg> <arg_count>
2163 //
2164 // Call a JSfunction or Callable in |first_arg| with the receiver in
2165 // |first_arg + 1| and |arg_count - 2| arguments in subsequent registers. The
2166 // final argument is always a spread.
2167 //
2168 void Interpreter::DoCallWithSpread(InterpreterAssembler* assembler) {
2169 Node* first_arg_reg = __ BytecodeOperandReg(0);
2170 Node* first_arg = __ RegisterLocation(first_arg_reg);
2171 Node* args_count = __ BytecodeOperandCount(1);
2172 Node* context = __ GetContext();
2173
2174 // Call into Runtime function CallWithSpread which does everything.
2175 Node* runtime_function = __ Int32Constant(Runtime::kCallWithSpread);
2176 Node* result =
2177 __ CallRuntimeN(runtime_function, context, first_arg, args_count);
2178 __ SetAccumulator(result);
2179 __ Dispatch();
2180 }
2181
2162 // NewWithSpread <first_arg> <arg_count> 2182 // NewWithSpread <first_arg> <arg_count>
2163 // 2183 //
2164 // Call the constructor in |first_arg| with the new.target in |first_arg + 1| 2184 // Call the constructor in |first_arg| with the new.target in |first_arg + 1|
2165 // for the |arg_count - 2| following arguments. The final argument is always a 2185 // for the |arg_count - 2| following arguments. The final argument is always a
2166 // spread. 2186 // spread.
2167 // 2187 //
2168 void Interpreter::DoNewWithSpread(InterpreterAssembler* assembler) { 2188 void Interpreter::DoNewWithSpread(InterpreterAssembler* assembler) {
2169 Node* first_arg_reg = __ BytecodeOperandReg(0); 2189 Node* first_arg_reg = __ BytecodeOperandReg(0);
2170 Node* first_arg = __ RegisterLocation(first_arg_reg); 2190 Node* first_arg = __ RegisterLocation(first_arg_reg);
2171 Node* args_count = __ BytecodeOperandCount(1); 2191 Node* args_count = __ BytecodeOperandCount(1);
(...skipping 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after
3259 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, 3279 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset,
3260 __ SmiTag(new_state)); 3280 __ SmiTag(new_state));
3261 __ SetAccumulator(old_state); 3281 __ SetAccumulator(old_state);
3262 3282
3263 __ Dispatch(); 3283 __ Dispatch();
3264 } 3284 }
3265 3285
3266 } // namespace interpreter 3286 } // namespace interpreter
3267 } // namespace internal 3287 } // namespace internal
3268 } // namespace v8 3288 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698