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 1993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2004 Node* closure = __ LoadRegister(Register::function_closure()); | 2004 Node* closure = __ LoadRegister(Register::function_closure()); |
2005 Node* context = __ GetContext(); | 2005 Node* context = __ GetContext(); |
2006 Node* result = FastCloneRegExpStub::Generate( | 2006 Node* result = FastCloneRegExpStub::Generate( |
2007 assembler, closure, literal_index, pattern, flags, context); | 2007 assembler, closure, literal_index, pattern, flags, context); |
2008 __ SetAccumulator(result); | 2008 __ SetAccumulator(result); |
2009 __ Dispatch(); | 2009 __ Dispatch(); |
2010 } | 2010 } |
2011 | 2011 |
2012 // CreateArrayLiteral <element_idx> <literal_idx> <flags> | 2012 // CreateArrayLiteral <element_idx> <literal_idx> <flags> |
2013 // | 2013 // |
2014 // Creates an array literal for literal index <literal_idx> with flags <flags> | 2014 // Creates an array literal for literal index <literal_idx> with |
2015 // and constant elements in <element_idx>. | 2015 // CreateArrayLiteral flags <flags> and constant elements in <element_idx>. |
2016 void Interpreter::DoCreateArrayLiteral(InterpreterAssembler* assembler) { | 2016 void Interpreter::DoCreateArrayLiteral(InterpreterAssembler* assembler) { |
2017 Node* index = __ BytecodeOperandIdx(0); | |
2018 Node* constant_elements = __ LoadConstantPoolEntry(index); | |
2019 Node* literal_index_raw = __ BytecodeOperandIdx(1); | 2017 Node* literal_index_raw = __ BytecodeOperandIdx(1); |
2020 Node* literal_index = __ SmiTag(literal_index_raw); | 2018 Node* literal_index = __ SmiTag(literal_index_raw); |
2021 Node* flags_raw = __ BytecodeOperandFlag(2); | |
2022 Node* flags = __ SmiTag(flags_raw); | |
2023 Node* closure = __ LoadRegister(Register::function_closure()); | 2019 Node* closure = __ LoadRegister(Register::function_closure()); |
2024 Node* context = __ GetContext(); | 2020 Node* context = __ GetContext(); |
2025 Node* result = __ CallRuntime(Runtime::kCreateArrayLiteral, context, closure, | 2021 Node* bytecode_flags = __ BytecodeOperandFlag(2); |
2026 literal_index, constant_elements, flags); | 2022 |
2027 __ SetAccumulator(result); | 2023 Label fast_shallow_clone(assembler), |
2028 __ Dispatch(); | 2024 call_runtime(assembler, Label::kDeferred); |
| 2025 Node* use_fast_shallow_clone = __ Word32And( |
| 2026 bytecode_flags, |
| 2027 __ Int32Constant(CreateArrayLiteralFlags::FastShallowCloneBit::kMask)); |
| 2028 __ BranchIf(use_fast_shallow_clone, &fast_shallow_clone, &call_runtime); |
| 2029 |
| 2030 __ Bind(&fast_shallow_clone); |
| 2031 { |
| 2032 DCHECK(FLAG_allocation_site_pretenuring); |
| 2033 Node* result = FastCloneShallowArrayStub::Generate( |
| 2034 assembler, closure, literal_index, context, &call_runtime, |
| 2035 TRACK_ALLOCATION_SITE); |
| 2036 __ SetAccumulator(result); |
| 2037 __ Dispatch(); |
| 2038 } |
| 2039 |
| 2040 __ Bind(&call_runtime); |
| 2041 { |
| 2042 STATIC_ASSERT(CreateArrayLiteralFlags::FlagsBits::kShift == 0); |
| 2043 Node* flags_raw = __ Word32And( |
| 2044 bytecode_flags, |
| 2045 __ Int32Constant(CreateArrayLiteralFlags::FlagsBits::kMask)); |
| 2046 Node* flags = __ SmiTag(flags_raw); |
| 2047 Node* index = __ BytecodeOperandIdx(0); |
| 2048 Node* constant_elements = __ LoadConstantPoolEntry(index); |
| 2049 Node* result = |
| 2050 __ CallRuntime(Runtime::kCreateArrayLiteral, context, closure, |
| 2051 literal_index, constant_elements, flags); |
| 2052 __ SetAccumulator(result); |
| 2053 __ Dispatch(); |
| 2054 } |
2029 } | 2055 } |
2030 | 2056 |
2031 // CreateObjectLiteral <element_idx> <literal_idx> <flags> | 2057 // CreateObjectLiteral <element_idx> <literal_idx> <flags> |
2032 // | 2058 // |
2033 // Creates an object literal for literal index <literal_idx> with | 2059 // Creates an object literal for literal index <literal_idx> with |
2034 // CreateObjectLiteralFlags <flags> and constant elements in <element_idx>. | 2060 // CreateObjectLiteralFlags <flags> and constant elements in <element_idx>. |
2035 void Interpreter::DoCreateObjectLiteral(InterpreterAssembler* assembler) { | 2061 void Interpreter::DoCreateObjectLiteral(InterpreterAssembler* assembler) { |
2036 Node* literal_index_raw = __ BytecodeOperandIdx(1); | 2062 Node* literal_index_raw = __ BytecodeOperandIdx(1); |
2037 Node* literal_index = __ SmiTag(literal_index_raw); | 2063 Node* literal_index = __ SmiTag(literal_index_raw); |
2038 Node* bytecode_flags = __ BytecodeOperandFlag(2); | 2064 Node* bytecode_flags = __ BytecodeOperandFlag(2); |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2573 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, | 2599 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, |
2574 __ SmiTag(new_state)); | 2600 __ SmiTag(new_state)); |
2575 __ SetAccumulator(old_state); | 2601 __ SetAccumulator(old_state); |
2576 | 2602 |
2577 __ Dispatch(); | 2603 __ Dispatch(); |
2578 } | 2604 } |
2579 | 2605 |
2580 } // namespace interpreter | 2606 } // namespace interpreter |
2581 } // namespace internal | 2607 } // namespace internal |
2582 } // namespace v8 | 2608 } // namespace v8 |
OLD | NEW |