| 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 2890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2911 Node* compiler_hints = __ LoadObjectField( | 2912 Node* compiler_hints = __ LoadObjectField( |
| 2912 shared_info, SharedFunctionInfo::kHasDuplicateParametersByteOffset, | 2913 shared_info, SharedFunctionInfo::kHasDuplicateParametersByteOffset, |
| 2913 MachineType::Uint8()); | 2914 MachineType::Uint8()); |
| 2914 Node* duplicate_parameters_bit = __ Int32Constant( | 2915 Node* duplicate_parameters_bit = __ Int32Constant( |
| 2915 1 << SharedFunctionInfo::kHasDuplicateParametersBitWithinByte); | 2916 1 << SharedFunctionInfo::kHasDuplicateParametersBitWithinByte); |
| 2916 Node* compare = __ Word32And(compiler_hints, duplicate_parameters_bit); | 2917 Node* compare = __ Word32And(compiler_hints, duplicate_parameters_bit); |
| 2917 __ Branch(compare, &if_duplicate_parameters, &if_not_duplicate_parameters); | 2918 __ Branch(compare, &if_duplicate_parameters, &if_not_duplicate_parameters); |
| 2918 | 2919 |
| 2919 __ Bind(&if_not_duplicate_parameters); | 2920 __ Bind(&if_not_duplicate_parameters); |
| 2920 { | 2921 { |
| 2921 // TODO(rmcilroy): Inline FastNewSloppyArguments when it is a TurboFan stub. | 2922 ArgumentsBuiltinsAssembler constructor_assembler(assembler->state()); |
| 2922 Callable callable = CodeFactory::FastNewSloppyArguments(isolate_, true); | 2923 Node* result = |
| 2923 Node* target = __ HeapConstant(callable.code()); | 2924 constructor_assembler.EmitFastNewSloppyArguments(context, closure); |
| 2924 Node* result = __ CallStub(callable.descriptor(), target, context, closure); | |
| 2925 __ SetAccumulator(result); | 2925 __ SetAccumulator(result); |
| 2926 __ Dispatch(); | 2926 __ Dispatch(); |
| 2927 } | 2927 } |
| 2928 | 2928 |
| 2929 __ Bind(&if_duplicate_parameters); | 2929 __ Bind(&if_duplicate_parameters); |
| 2930 { | 2930 { |
| 2931 Node* result = | 2931 Node* result = |
| 2932 __ CallRuntime(Runtime::kNewSloppyArguments_Generic, context, closure); | 2932 __ CallRuntime(Runtime::kNewSloppyArguments_Generic, context, closure); |
| 2933 __ SetAccumulator(result); | 2933 __ SetAccumulator(result); |
| 2934 __ Dispatch(); | 2934 __ Dispatch(); |
| 2935 } | 2935 } |
| 2936 } | 2936 } |
| 2937 | 2937 |
| 2938 // CreateUnmappedArguments | 2938 // CreateUnmappedArguments |
| 2939 // | 2939 // |
| 2940 // Creates a new unmapped arguments object. | 2940 // Creates a new unmapped arguments object. |
| 2941 void Interpreter::DoCreateUnmappedArguments(InterpreterAssembler* assembler) { | 2941 void Interpreter::DoCreateUnmappedArguments(InterpreterAssembler* assembler) { |
| 2942 // TODO(rmcilroy): Inline FastNewStrictArguments when it is a TurboFan stub. | |
| 2943 Callable callable = CodeFactory::FastNewStrictArguments(isolate_, true); | |
| 2944 Node* target = __ HeapConstant(callable.code()); | |
| 2945 Node* context = __ GetContext(); | 2942 Node* context = __ GetContext(); |
| 2946 Node* closure = __ LoadRegister(Register::function_closure()); | 2943 Node* closure = __ LoadRegister(Register::function_closure()); |
| 2947 Node* result = __ CallStub(callable.descriptor(), target, context, closure); | 2944 ArgumentsBuiltinsAssembler builtins_assembler(assembler->state()); |
| 2945 Node* result = |
| 2946 builtins_assembler.EmitFastNewStrictArguments(context, closure); |
| 2948 __ SetAccumulator(result); | 2947 __ SetAccumulator(result); |
| 2949 __ Dispatch(); | 2948 __ Dispatch(); |
| 2950 } | 2949 } |
| 2951 | 2950 |
| 2952 // CreateRestParameter | 2951 // CreateRestParameter |
| 2953 // | 2952 // |
| 2954 // Creates a new rest parameter array. | 2953 // Creates a new rest parameter array. |
| 2955 void Interpreter::DoCreateRestParameter(InterpreterAssembler* assembler) { | 2954 void Interpreter::DoCreateRestParameter(InterpreterAssembler* assembler) { |
| 2956 // TODO(rmcilroy): Inline FastNewRestArguments when it is a TurboFan stub. | |
| 2957 Callable callable = CodeFactory::FastNewRestParameter(isolate_, true); | |
| 2958 Node* target = __ HeapConstant(callable.code()); | |
| 2959 Node* closure = __ LoadRegister(Register::function_closure()); | 2955 Node* closure = __ LoadRegister(Register::function_closure()); |
| 2960 Node* context = __ GetContext(); | 2956 Node* context = __ GetContext(); |
| 2961 Node* result = __ CallStub(callable.descriptor(), target, context, closure); | 2957 ArgumentsBuiltinsAssembler builtins_assembler(assembler->state()); |
| 2958 Node* result = builtins_assembler.EmitFastNewRestParameter(context, closure); |
| 2962 __ SetAccumulator(result); | 2959 __ SetAccumulator(result); |
| 2963 __ Dispatch(); | 2960 __ Dispatch(); |
| 2964 } | 2961 } |
| 2965 | 2962 |
| 2966 // StackCheck | 2963 // StackCheck |
| 2967 // | 2964 // |
| 2968 // Performs a stack guard check. | 2965 // Performs a stack guard check. |
| 2969 void Interpreter::DoStackCheck(InterpreterAssembler* assembler) { | 2966 void Interpreter::DoStackCheck(InterpreterAssembler* assembler) { |
| 2970 Label ok(assembler), stack_check_interrupt(assembler, Label::kDeferred); | 2967 Label ok(assembler), stack_check_interrupt(assembler, Label::kDeferred); |
| 2971 | 2968 |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3311 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, | 3308 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, |
| 3312 __ SmiTag(new_state)); | 3309 __ SmiTag(new_state)); |
| 3313 __ SetAccumulator(old_state); | 3310 __ SetAccumulator(old_state); |
| 3314 | 3311 |
| 3315 __ Dispatch(); | 3312 __ Dispatch(); |
| 3316 } | 3313 } |
| 3317 | 3314 |
| 3318 } // namespace interpreter | 3315 } // namespace interpreter |
| 3319 } // namespace internal | 3316 } // namespace internal |
| 3320 } // namespace v8 | 3317 } // namespace v8 |
| OLD | NEW |