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 2140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2151 Node* native_context = __ LoadNativeContext(context); | 2151 Node* native_context = __ LoadNativeContext(context); |
2152 Node* function = __ LoadContextElement(native_context, context_index); | 2152 Node* function = __ LoadContextElement(native_context, context_index); |
2153 | 2153 |
2154 // Call the function. | 2154 // Call the function. |
2155 Node* result = __ CallJS(function, context, first_arg, args_count, | 2155 Node* result = __ CallJS(function, context, first_arg, args_count, |
2156 TailCallMode::kDisallow); | 2156 TailCallMode::kDisallow); |
2157 __ SetAccumulator(result); | 2157 __ SetAccumulator(result); |
2158 __ Dispatch(); | 2158 __ Dispatch(); |
2159 } | 2159 } |
2160 | 2160 |
2161 // NewWithSpread <first_arg> <arg_count> | 2161 // NewWithSpread <first_arg> <arg_count> |
rmcilroy
2017/01/11 15:24:45
Please update the comment and description.
| |
2162 // | 2162 // |
2163 // Call the constructor in |first_arg| with the new.target in |first_arg + 1| | 2163 // Call the constructor in |first_arg| with the new.target in |first_arg + 1| |
2164 // for the |arg_count - 2| following arguments. The final argument is always a | 2164 // for the |arg_count - 2| following arguments. The final argument is always a |
2165 // spread. | 2165 // spread. |
2166 // | 2166 // |
2167 void Interpreter::DoNewWithSpread(InterpreterAssembler* assembler) { | 2167 void Interpreter::DoNewWithSpread(InterpreterAssembler* assembler) { |
2168 Node* first_arg_reg = __ BytecodeOperandReg(0); | 2168 // Callable ic = CodeFactory::ConstructWithSpread(isolate_); |
rmcilroy
2017/01/11 15:24:45
leftover code?
petermarshall
2017/01/11 16:50:03
Yeah not needed, there is a similar line left in I
| |
2169 Node* new_target = __ GetAccumulator(); | |
2170 Node* constructor_reg = __ BytecodeOperandReg(0); | |
2171 Node* constructor = __ LoadRegister(constructor_reg); | |
2172 Node* first_arg_reg = __ BytecodeOperandReg(1); | |
2169 Node* first_arg = __ RegisterLocation(first_arg_reg); | 2173 Node* first_arg = __ RegisterLocation(first_arg_reg); |
2170 Node* args_count = __ BytecodeOperandCount(1); | 2174 Node* args_count = __ BytecodeOperandCount(2); |
2171 Node* context = __ GetContext(); | 2175 Node* context = __ GetContext(); |
2172 | 2176 Node* result = __ CallConstructWithSpread(constructor, context, new_target, |
2173 // Call into Runtime function NewWithSpread which does everything. | 2177 first_arg, args_count); |
2174 Node* runtime_function = __ Int32Constant(Runtime::kNewWithSpread); | |
2175 Node* result = | |
2176 __ CallRuntimeN(runtime_function, context, first_arg, args_count); | |
2177 __ SetAccumulator(result); | 2178 __ SetAccumulator(result); |
2178 __ Dispatch(); | 2179 __ Dispatch(); |
2179 } | 2180 } |
2180 | 2181 |
2181 // New <constructor> <first_arg> <arg_count> | 2182 // New <constructor> <first_arg> <arg_count> |
2182 // | 2183 // |
2183 // Call operator new with |constructor| and the first argument in | 2184 // Call operator new with |constructor| and the first argument in |
2184 // register |first_arg| and |arg_count| arguments in subsequent | 2185 // register |first_arg| and |arg_count| arguments in subsequent |
2185 // registers. The new.target is in the accumulator. | 2186 // registers. The new.target is in the accumulator. |
2186 // | 2187 // |
(...skipping 1064 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3251 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, | 3252 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, |
3252 __ SmiTag(new_state)); | 3253 __ SmiTag(new_state)); |
3253 __ SetAccumulator(old_state); | 3254 __ SetAccumulator(old_state); |
3254 | 3255 |
3255 __ Dispatch(); | 3256 __ Dispatch(); |
3256 } | 3257 } |
3257 | 3258 |
3258 } // namespace interpreter | 3259 } // namespace interpreter |
3259 } // namespace internal | 3260 } // namespace internal |
3260 } // namespace v8 | 3261 } // namespace v8 |
OLD | NEW |