OLD | NEW |
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 2158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2169 Node* native_context = __ LoadNativeContext(context); | 2169 Node* native_context = __ LoadNativeContext(context); |
2170 Node* function = __ LoadContextElement(native_context, context_index); | 2170 Node* function = __ LoadContextElement(native_context, context_index); |
2171 | 2171 |
2172 // Call the function. | 2172 // Call the function. |
2173 Node* result = __ CallJS(function, context, first_arg, args_count, | 2173 Node* result = __ CallJS(function, context, first_arg, args_count, |
2174 TailCallMode::kDisallow); | 2174 TailCallMode::kDisallow); |
2175 __ SetAccumulator(result); | 2175 __ SetAccumulator(result); |
2176 __ Dispatch(); | 2176 __ Dispatch(); |
2177 } | 2177 } |
2178 | 2178 |
2179 // CallWithSpread <first_arg> <arg_count> | 2179 // NewWithSpread <constructor> <first_arg> <arg_count> |
2180 // | |
2181 // Call a JSfunction or Callable in |first_arg| with the receiver in | |
2182 // |first_arg + 1| and |arg_count - 2| arguments in subsequent registers. The | |
2183 // final argument is always a spread. | |
2184 // | |
2185 void Interpreter::DoCallWithSpread(InterpreterAssembler* assembler) { | |
2186 Node* first_arg_reg = __ BytecodeOperandReg(0); | |
2187 Node* first_arg = __ RegisterLocation(first_arg_reg); | |
2188 Node* args_count = __ BytecodeOperandCount(1); | |
2189 Node* context = __ GetContext(); | |
2190 | |
2191 // Call into Runtime function CallWithSpread which does everything. | |
2192 Node* runtime_function = __ Int32Constant(Runtime::kCallWithSpread); | |
2193 Node* result = | |
2194 __ CallRuntimeN(runtime_function, context, first_arg, args_count); | |
2195 __ SetAccumulator(result); | |
2196 __ Dispatch(); | |
2197 } | |
2198 | |
2199 // NewWithSpread <first_arg> <arg_count> | |
2200 // | 2180 // |
2201 // Call the constructor in |constructor| with the first argument in register | 2181 // Call the constructor in |constructor| with the first argument in register |
2202 // |first_arg| and |arg_count| arguments in subsequent registers. The final | 2182 // |first_arg| and |arg_count| arguments in subsequent registers. The final |
2203 // argument is always a spread. The new.target is in the accumulator. | 2183 // argument is always a spread. The new.target is in the accumulator. |
2204 // | 2184 // |
2205 void Interpreter::DoNewWithSpread(InterpreterAssembler* assembler) { | 2185 void Interpreter::DoNewWithSpread(InterpreterAssembler* assembler) { |
2206 Node* new_target = __ GetAccumulator(); | 2186 Node* new_target = __ GetAccumulator(); |
2207 Node* constructor_reg = __ BytecodeOperandReg(0); | 2187 Node* constructor_reg = __ BytecodeOperandReg(0); |
2208 Node* constructor = __ LoadRegister(constructor_reg); | 2188 Node* constructor = __ LoadRegister(constructor_reg); |
2209 Node* first_arg_reg = __ BytecodeOperandReg(1); | 2189 Node* first_arg_reg = __ BytecodeOperandReg(1); |
(...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3296 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, | 3276 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, |
3297 __ SmiTag(new_state)); | 3277 __ SmiTag(new_state)); |
3298 __ SetAccumulator(old_state); | 3278 __ SetAccumulator(old_state); |
3299 | 3279 |
3300 __ Dispatch(); | 3280 __ Dispatch(); |
3301 } | 3281 } |
3302 | 3282 |
3303 } // namespace interpreter | 3283 } // namespace interpreter |
3304 } // namespace internal | 3284 } // namespace internal |
3305 } // namespace v8 | 3285 } // namespace v8 |
OLD | NEW |