| 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 2141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 // NewWithSpread <first_arg> <arg_count> | 2162 // NewWithSpread <constructor> <first_arg> <arg_count> |
| 2163 // | 2163 // |
| 2164 // Call the constructor in |first_arg| with the new.target in |first_arg + 1| | 2164 // Call the constructor in |constructor| with the first argument in register |
| 2165 // for the |arg_count - 2| following arguments. The final argument is always a | 2165 // |first_arg| and |arg_count| arguments in subsequent registers. The final |
| 2166 // spread. | 2166 // argument is always a spread. The new.target is in the accumulator. |
| 2167 // | 2167 // |
| 2168 void Interpreter::DoNewWithSpread(InterpreterAssembler* assembler) { | 2168 void Interpreter::DoNewWithSpread(InterpreterAssembler* assembler) { |
| 2169 Node* first_arg_reg = __ BytecodeOperandReg(0); | 2169 Node* new_target = __ GetAccumulator(); |
| 2170 Node* constructor_reg = __ BytecodeOperandReg(0); |
| 2171 Node* constructor = __ LoadRegister(constructor_reg); |
| 2172 Node* first_arg_reg = __ BytecodeOperandReg(1); |
| 2170 Node* first_arg = __ RegisterLocation(first_arg_reg); | 2173 Node* first_arg = __ RegisterLocation(first_arg_reg); |
| 2171 Node* args_count = __ BytecodeOperandCount(1); | 2174 Node* args_count = __ BytecodeOperandCount(2); |
| 2172 Node* context = __ GetContext(); | 2175 Node* context = __ GetContext(); |
| 2173 | 2176 Node* result = __ CallConstructWithSpread(constructor, context, new_target, |
| 2174 // Call into Runtime function NewWithSpread which does everything. | 2177 first_arg, args_count); |
| 2175 Node* runtime_function = __ Int32Constant(Runtime::kNewWithSpread); | |
| 2176 Node* result = | |
| 2177 __ CallRuntimeN(runtime_function, context, first_arg, args_count); | |
| 2178 __ SetAccumulator(result); | 2178 __ SetAccumulator(result); |
| 2179 __ Dispatch(); | 2179 __ Dispatch(); |
| 2180 } | 2180 } |
| 2181 | 2181 |
| 2182 // New <constructor> <first_arg> <arg_count> | 2182 // New <constructor> <first_arg> <arg_count> |
| 2183 // | 2183 // |
| 2184 // Call operator new with |constructor| and the first argument in | 2184 // Call operator new with |constructor| and the first argument in |
| 2185 // register |first_arg| and |arg_count| arguments in subsequent | 2185 // register |first_arg| and |arg_count| arguments in subsequent |
| 2186 // registers. The new.target is in the accumulator. | 2186 // registers. The new.target is in the accumulator. |
| 2187 // | 2187 // |
| (...skipping 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3259 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, | 3259 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, |
| 3260 __ SmiTag(new_state)); | 3260 __ SmiTag(new_state)); |
| 3261 __ SetAccumulator(old_state); | 3261 __ SetAccumulator(old_state); |
| 3262 | 3262 |
| 3263 __ Dispatch(); | 3263 __ Dispatch(); |
| 3264 } | 3264 } |
| 3265 | 3265 |
| 3266 } // namespace interpreter | 3266 } // namespace interpreter |
| 3267 } // namespace internal | 3267 } // namespace internal |
| 3268 } // namespace v8 | 3268 } // namespace v8 |
| OLD | NEW |