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

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

Issue 2541113004: [Ignition/turbo] Add a NewWithSpread bytecode. (Closed)
Patch Set: Add todo Created 4 years 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
« no previous file with comments | « src/interpreter/bytecodes.h ('k') | src/objects.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1816 matching lines...) Expand 10 before | Expand all | Expand 10 after
1827 Node* native_context = __ LoadNativeContext(context); 1827 Node* native_context = __ LoadNativeContext(context);
1828 Node* function = __ LoadContextElement(native_context, context_index); 1828 Node* function = __ LoadContextElement(native_context, context_index);
1829 1829
1830 // Call the function. 1830 // Call the function.
1831 Node* result = __ CallJS(function, context, first_arg, args_count, 1831 Node* result = __ CallJS(function, context, first_arg, args_count,
1832 TailCallMode::kDisallow); 1832 TailCallMode::kDisallow);
1833 __ SetAccumulator(result); 1833 __ SetAccumulator(result);
1834 __ Dispatch(); 1834 __ Dispatch();
1835 } 1835 }
1836 1836
1837 // NewWithSpread <first_arg> <arg_count>
1838 //
1839 // Call the constructor in |first_arg| with the new.target in |first_arg + 1|
1840 // for the |arg_count - 2| following arguments. The final argument is always a
1841 // spread.
1842 //
1843 void Interpreter::DoNewWithSpread(InterpreterAssembler* assembler) {
1844 Node* first_arg_reg = __ BytecodeOperandReg(0);
1845 Node* first_arg = __ RegisterLocation(first_arg_reg);
1846 Node* args_count = __ BytecodeOperandCount(1);
1847 Node* context = __ GetContext();
1848
1849 // Call into Runtime function NewWithSpread which does everything.
1850 Node* runtime_function = __ Int32Constant(Runtime::kNewWithSpread);
1851 Node* result =
1852 __ CallRuntimeN(runtime_function, context, first_arg, args_count);
1853 __ SetAccumulator(result);
1854 __ Dispatch();
1855 }
1856
1837 // New <constructor> <first_arg> <arg_count> 1857 // New <constructor> <first_arg> <arg_count>
1838 // 1858 //
1839 // Call operator new with |constructor| and the first argument in 1859 // Call operator new with |constructor| and the first argument in
1840 // register |first_arg| and |arg_count| arguments in subsequent 1860 // register |first_arg| and |arg_count| arguments in subsequent
1841 // registers. The new.target is in the accumulator. 1861 // registers. The new.target is in the accumulator.
1842 // 1862 //
1843 void Interpreter::DoNew(InterpreterAssembler* assembler) { 1863 void Interpreter::DoNew(InterpreterAssembler* assembler) {
1844 Callable ic = CodeFactory::InterpreterPushArgsAndConstruct(isolate_); 1864 Callable ic = CodeFactory::InterpreterPushArgsAndConstruct(isolate_);
1845 Node* new_target = __ GetAccumulator(); 1865 Node* new_target = __ GetAccumulator();
1846 Node* constructor_reg = __ BytecodeOperandReg(0); 1866 Node* constructor_reg = __ BytecodeOperandReg(0);
(...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after
2777 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, 2797 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset,
2778 __ SmiTag(new_state)); 2798 __ SmiTag(new_state));
2779 __ SetAccumulator(old_state); 2799 __ SetAccumulator(old_state);
2780 2800
2781 __ Dispatch(); 2801 __ Dispatch();
2782 } 2802 }
2783 2803
2784 } // namespace interpreter 2804 } // namespace interpreter
2785 } // namespace internal 2805 } // namespace internal
2786 } // namespace v8 2806 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecodes.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698