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" |
| 11 #include "src/builtins/builtins-arguments.h" |
11 #include "src/builtins/builtins-constructor.h" | 12 #include "src/builtins/builtins-constructor.h" |
12 #include "src/code-factory.h" | 13 #include "src/code-factory.h" |
13 #include "src/compilation-info.h" | 14 #include "src/compilation-info.h" |
14 #include "src/compiler.h" | 15 #include "src/compiler.h" |
15 #include "src/factory.h" | 16 #include "src/factory.h" |
16 #include "src/interpreter/bytecode-flags.h" | 17 #include "src/interpreter/bytecode-flags.h" |
17 #include "src/interpreter/bytecode-generator.h" | 18 #include "src/interpreter/bytecode-generator.h" |
18 #include "src/interpreter/bytecodes.h" | 19 #include "src/interpreter/bytecodes.h" |
19 #include "src/interpreter/interpreter-assembler.h" | 20 #include "src/interpreter/interpreter-assembler.h" |
20 #include "src/interpreter/interpreter-intrinsics.h" | 21 #include "src/interpreter/interpreter-intrinsics.h" |
(...skipping 2878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2899 Node* compiler_hints = __ LoadObjectField( | 2900 Node* compiler_hints = __ LoadObjectField( |
2900 shared_info, SharedFunctionInfo::kHasDuplicateParametersByteOffset, | 2901 shared_info, SharedFunctionInfo::kHasDuplicateParametersByteOffset, |
2901 MachineType::Uint8()); | 2902 MachineType::Uint8()); |
2902 Node* duplicate_parameters_bit = __ Int32Constant( | 2903 Node* duplicate_parameters_bit = __ Int32Constant( |
2903 1 << SharedFunctionInfo::kHasDuplicateParametersBitWithinByte); | 2904 1 << SharedFunctionInfo::kHasDuplicateParametersBitWithinByte); |
2904 Node* compare = __ Word32And(compiler_hints, duplicate_parameters_bit); | 2905 Node* compare = __ Word32And(compiler_hints, duplicate_parameters_bit); |
2905 __ Branch(compare, &if_duplicate_parameters, &if_not_duplicate_parameters); | 2906 __ Branch(compare, &if_duplicate_parameters, &if_not_duplicate_parameters); |
2906 | 2907 |
2907 __ Bind(&if_not_duplicate_parameters); | 2908 __ Bind(&if_not_duplicate_parameters); |
2908 { | 2909 { |
2909 // TODO(rmcilroy): Inline FastNewSloppyArguments when it is a TurboFan stub. | 2910 ArgumentsBuiltinsAssembler constructor_assembler(assembler->state()); |
2910 Callable callable = CodeFactory::FastNewSloppyArguments(isolate_, true); | 2911 Node* result = |
2911 Node* target = __ HeapConstant(callable.code()); | 2912 constructor_assembler.EmitFastNewSloppyArguments(context, closure); |
2912 Node* result = __ CallStub(callable.descriptor(), target, context, closure); | |
2913 __ SetAccumulator(result); | 2913 __ SetAccumulator(result); |
2914 __ Dispatch(); | 2914 __ Dispatch(); |
2915 } | 2915 } |
2916 | 2916 |
2917 __ Bind(&if_duplicate_parameters); | 2917 __ Bind(&if_duplicate_parameters); |
2918 { | 2918 { |
2919 Node* result = | 2919 Node* result = |
2920 __ CallRuntime(Runtime::kNewSloppyArguments_Generic, context, closure); | 2920 __ CallRuntime(Runtime::kNewSloppyArguments_Generic, context, closure); |
2921 __ SetAccumulator(result); | 2921 __ SetAccumulator(result); |
2922 __ Dispatch(); | 2922 __ Dispatch(); |
2923 } | 2923 } |
2924 } | 2924 } |
2925 | 2925 |
2926 // CreateUnmappedArguments | 2926 // CreateUnmappedArguments |
2927 // | 2927 // |
2928 // Creates a new unmapped arguments object. | 2928 // Creates a new unmapped arguments object. |
2929 void Interpreter::DoCreateUnmappedArguments(InterpreterAssembler* assembler) { | 2929 void Interpreter::DoCreateUnmappedArguments(InterpreterAssembler* assembler) { |
2930 // TODO(rmcilroy): Inline FastNewStrictArguments when it is a TurboFan stub. | |
2931 Callable callable = CodeFactory::FastNewStrictArguments(isolate_, true); | |
2932 Node* target = __ HeapConstant(callable.code()); | |
2933 Node* context = __ GetContext(); | 2930 Node* context = __ GetContext(); |
2934 Node* closure = __ LoadRegister(Register::function_closure()); | 2931 Node* closure = __ LoadRegister(Register::function_closure()); |
2935 Node* result = __ CallStub(callable.descriptor(), target, context, closure); | 2932 ArgumentsBuiltinsAssembler builtins_assembler(assembler->state()); |
| 2933 Node* result = |
| 2934 builtins_assembler.EmitFastNewStrictArguments(context, closure); |
2936 __ SetAccumulator(result); | 2935 __ SetAccumulator(result); |
2937 __ Dispatch(); | 2936 __ Dispatch(); |
2938 } | 2937 } |
2939 | 2938 |
2940 // CreateRestParameter | 2939 // CreateRestParameter |
2941 // | 2940 // |
2942 // Creates a new rest parameter array. | 2941 // Creates a new rest parameter array. |
2943 void Interpreter::DoCreateRestParameter(InterpreterAssembler* assembler) { | 2942 void Interpreter::DoCreateRestParameter(InterpreterAssembler* assembler) { |
2944 // TODO(rmcilroy): Inline FastNewRestArguments when it is a TurboFan stub. | |
2945 Callable callable = CodeFactory::FastNewRestParameter(isolate_, true); | |
2946 Node* target = __ HeapConstant(callable.code()); | |
2947 Node* closure = __ LoadRegister(Register::function_closure()); | 2943 Node* closure = __ LoadRegister(Register::function_closure()); |
2948 Node* context = __ GetContext(); | 2944 Node* context = __ GetContext(); |
2949 Node* result = __ CallStub(callable.descriptor(), target, context, closure); | 2945 ArgumentsBuiltinsAssembler builtins_assembler(assembler->state()); |
| 2946 Node* result = builtins_assembler.EmitFastNewRestParameter(context, closure); |
2950 __ SetAccumulator(result); | 2947 __ SetAccumulator(result); |
2951 __ Dispatch(); | 2948 __ Dispatch(); |
2952 } | 2949 } |
2953 | 2950 |
2954 // StackCheck | 2951 // StackCheck |
2955 // | 2952 // |
2956 // Performs a stack guard check. | 2953 // Performs a stack guard check. |
2957 void Interpreter::DoStackCheck(InterpreterAssembler* assembler) { | 2954 void Interpreter::DoStackCheck(InterpreterAssembler* assembler) { |
2958 Label ok(assembler), stack_check_interrupt(assembler, Label::kDeferred); | 2955 Label ok(assembler), stack_check_interrupt(assembler, Label::kDeferred); |
2959 | 2956 |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3299 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, | 3296 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, |
3300 __ SmiTag(new_state)); | 3297 __ SmiTag(new_state)); |
3301 __ SetAccumulator(old_state); | 3298 __ SetAccumulator(old_state); |
3302 | 3299 |
3303 __ Dispatch(); | 3300 __ Dispatch(); |
3304 } | 3301 } |
3305 | 3302 |
3306 } // namespace interpreter | 3303 } // namespace interpreter |
3307 } // namespace internal | 3304 } // namespace internal |
3308 } // namespace v8 | 3305 } // namespace v8 |
OLD | NEW |