| 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 2533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2544 // | 2544 // |
| 2545 // Creates a regular expression literal for literal index <literal_idx> with | 2545 // Creates a regular expression literal for literal index <literal_idx> with |
| 2546 // <flags> and the pattern in <pattern_idx>. | 2546 // <flags> and the pattern in <pattern_idx>. |
| 2547 void Interpreter::DoCreateRegExpLiteral(InterpreterAssembler* assembler) { | 2547 void Interpreter::DoCreateRegExpLiteral(InterpreterAssembler* assembler) { |
| 2548 Node* index = __ BytecodeOperandIdx(0); | 2548 Node* index = __ BytecodeOperandIdx(0); |
| 2549 Node* pattern = __ LoadConstantPoolEntry(index); | 2549 Node* pattern = __ LoadConstantPoolEntry(index); |
| 2550 Node* literal_index = __ BytecodeOperandIdxSmi(1); | 2550 Node* literal_index = __ BytecodeOperandIdxSmi(1); |
| 2551 Node* flags = __ SmiFromWord32(__ BytecodeOperandFlag(2)); | 2551 Node* flags = __ SmiFromWord32(__ BytecodeOperandFlag(2)); |
| 2552 Node* closure = __ LoadRegister(Register::function_closure()); | 2552 Node* closure = __ LoadRegister(Register::function_closure()); |
| 2553 Node* context = __ GetContext(); | 2553 Node* context = __ GetContext(); |
| 2554 Node* result = FastCloneRegExpStub::Generate( | 2554 ConstructorBuiltinsAssembler constructor_assembler(assembler->state()); |
| 2555 assembler, closure, literal_index, pattern, flags, context); | 2555 Node* result = constructor_assembler.EmitFastCloneRegExp( |
| 2556 closure, literal_index, pattern, flags, context); |
| 2556 __ SetAccumulator(result); | 2557 __ SetAccumulator(result); |
| 2557 __ Dispatch(); | 2558 __ Dispatch(); |
| 2558 } | 2559 } |
| 2559 | 2560 |
| 2560 // CreateArrayLiteral <element_idx> <literal_idx> <flags> | 2561 // CreateArrayLiteral <element_idx> <literal_idx> <flags> |
| 2561 // | 2562 // |
| 2562 // Creates an array literal for literal index <literal_idx> with | 2563 // Creates an array literal for literal index <literal_idx> with |
| 2563 // CreateArrayLiteral flags <flags> and constant elements in <element_idx>. | 2564 // CreateArrayLiteral flags <flags> and constant elements in <element_idx>. |
| 2564 void Interpreter::DoCreateArrayLiteral(InterpreterAssembler* assembler) { | 2565 void Interpreter::DoCreateArrayLiteral(InterpreterAssembler* assembler) { |
| 2565 Node* literal_index = __ BytecodeOperandIdxSmi(1); | 2566 Node* literal_index = __ BytecodeOperandIdxSmi(1); |
| 2566 Node* closure = __ LoadRegister(Register::function_closure()); | 2567 Node* closure = __ LoadRegister(Register::function_closure()); |
| 2567 Node* context = __ GetContext(); | 2568 Node* context = __ GetContext(); |
| 2568 Node* bytecode_flags = __ BytecodeOperandFlag(2); | 2569 Node* bytecode_flags = __ BytecodeOperandFlag(2); |
| 2569 | 2570 |
| 2570 Label fast_shallow_clone(assembler), | 2571 Label fast_shallow_clone(assembler), |
| 2571 call_runtime(assembler, Label::kDeferred); | 2572 call_runtime(assembler, Label::kDeferred); |
| 2572 __ Branch(__ IsSetWord32<CreateArrayLiteralFlags::FastShallowCloneBit>( | 2573 __ Branch(__ IsSetWord32<CreateArrayLiteralFlags::FastShallowCloneBit>( |
| 2573 bytecode_flags), | 2574 bytecode_flags), |
| 2574 &fast_shallow_clone, &call_runtime); | 2575 &fast_shallow_clone, &call_runtime); |
| 2575 | 2576 |
| 2576 __ Bind(&fast_shallow_clone); | 2577 __ Bind(&fast_shallow_clone); |
| 2577 { | 2578 { |
| 2578 DCHECK(FLAG_allocation_site_pretenuring); | 2579 DCHECK(FLAG_allocation_site_pretenuring); |
| 2579 Node* result = FastCloneShallowArrayStub::Generate( | 2580 ConstructorBuiltinsAssembler constructor_assembler(assembler->state()); |
| 2580 assembler, closure, literal_index, context, &call_runtime, | 2581 Node* result = constructor_assembler.EmitFastCloneShallowArray( |
| 2581 TRACK_ALLOCATION_SITE); | 2582 closure, literal_index, context, &call_runtime, TRACK_ALLOCATION_SITE); |
| 2582 __ SetAccumulator(result); | 2583 __ SetAccumulator(result); |
| 2583 __ Dispatch(); | 2584 __ Dispatch(); |
| 2584 } | 2585 } |
| 2585 | 2586 |
| 2586 __ Bind(&call_runtime); | 2587 __ Bind(&call_runtime); |
| 2587 { | 2588 { |
| 2588 Node* flags_raw = | 2589 Node* flags_raw = |
| 2589 __ DecodeWordFromWord32<CreateArrayLiteralFlags::FlagsBits>( | 2590 __ DecodeWordFromWord32<CreateArrayLiteralFlags::FlagsBits>( |
| 2590 bytecode_flags); | 2591 bytecode_flags); |
| 2591 Node* flags = __ SmiTag(flags_raw); | 2592 Node* flags = __ SmiTag(flags_raw); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 2612 Label if_fast_clone(assembler), | 2613 Label if_fast_clone(assembler), |
| 2613 if_not_fast_clone(assembler, Label::kDeferred); | 2614 if_not_fast_clone(assembler, Label::kDeferred); |
| 2614 Node* fast_clone_properties_count = __ DecodeWordFromWord32< | 2615 Node* fast_clone_properties_count = __ DecodeWordFromWord32< |
| 2615 CreateObjectLiteralFlags::FastClonePropertiesCountBits>(bytecode_flags); | 2616 CreateObjectLiteralFlags::FastClonePropertiesCountBits>(bytecode_flags); |
| 2616 __ Branch(__ WordNotEqual(fast_clone_properties_count, __ IntPtrConstant(0)), | 2617 __ Branch(__ WordNotEqual(fast_clone_properties_count, __ IntPtrConstant(0)), |
| 2617 &if_fast_clone, &if_not_fast_clone); | 2618 &if_fast_clone, &if_not_fast_clone); |
| 2618 | 2619 |
| 2619 __ Bind(&if_fast_clone); | 2620 __ Bind(&if_fast_clone); |
| 2620 { | 2621 { |
| 2621 // If we can do a fast clone do the fast-path in FastCloneShallowObjectStub. | 2622 // If we can do a fast clone do the fast-path in FastCloneShallowObjectStub. |
| 2622 Node* result = FastCloneShallowObjectStub::GenerateFastPath( | 2623 ConstructorBuiltinsAssembler constructor_assembler(assembler->state()); |
| 2623 assembler, &if_not_fast_clone, closure, literal_index, | 2624 Node* result = constructor_assembler.EmitFastCloneShallowObject( |
| 2625 &if_not_fast_clone, closure, literal_index, |
| 2624 fast_clone_properties_count); | 2626 fast_clone_properties_count); |
| 2625 __ StoreRegister(result, __ BytecodeOperandReg(3)); | 2627 __ StoreRegister(result, __ BytecodeOperandReg(3)); |
| 2626 __ Dispatch(); | 2628 __ Dispatch(); |
| 2627 } | 2629 } |
| 2628 | 2630 |
| 2629 __ Bind(&if_not_fast_clone); | 2631 __ Bind(&if_not_fast_clone); |
| 2630 { | 2632 { |
| 2631 // If we can't do a fast clone, call into the runtime. | 2633 // If we can't do a fast clone, call into the runtime. |
| 2632 Node* index = __ BytecodeOperandIdx(0); | 2634 Node* index = __ BytecodeOperandIdx(0); |
| 2633 Node* constant_elements = __ LoadConstantPoolEntry(index); | 2635 Node* constant_elements = __ LoadConstantPoolEntry(index); |
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3170 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, | 3172 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, |
| 3171 __ SmiTag(new_state)); | 3173 __ SmiTag(new_state)); |
| 3172 __ SetAccumulator(old_state); | 3174 __ SetAccumulator(old_state); |
| 3173 | 3175 |
| 3174 __ Dispatch(); | 3176 __ Dispatch(); |
| 3175 } | 3177 } |
| 3176 | 3178 |
| 3177 } // namespace interpreter | 3179 } // namespace interpreter |
| 3178 } // namespace internal | 3180 } // namespace internal |
| 3179 } // namespace v8 | 3181 } // namespace v8 |
| OLD | NEW |