| 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 | 8 |
| 9 #include "src/ast/prettyprinter.h" | 9 #include "src/ast/prettyprinter.h" |
| 10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
| (...skipping 1496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1507 } | 1507 } |
| 1508 | 1508 |
| 1509 // CreateMappedArguments | 1509 // CreateMappedArguments |
| 1510 // | 1510 // |
| 1511 // Creates a new mapped arguments object. | 1511 // Creates a new mapped arguments object. |
| 1512 void Interpreter::DoCreateMappedArguments(InterpreterAssembler* assembler) { | 1512 void Interpreter::DoCreateMappedArguments(InterpreterAssembler* assembler) { |
| 1513 Node* closure = __ LoadRegister(Register::function_closure()); | 1513 Node* closure = __ LoadRegister(Register::function_closure()); |
| 1514 Node* context = __ GetContext(); | 1514 Node* context = __ GetContext(); |
| 1515 | 1515 |
| 1516 Variable result(assembler, MachineRepresentation::kTagged); | 1516 Variable result(assembler, MachineRepresentation::kTagged); |
| 1517 Label end(assembler), if_duplicate_parameters(assembler), | 1517 Label end(assembler), if_duplicate_parameters(assembler, Label::kDeferred), |
| 1518 if_not_duplicate_parameters(assembler); | 1518 if_not_duplicate_parameters(assembler); |
| 1519 | 1519 |
| 1520 // Check if function has duplicate parameters. | 1520 // Check if function has duplicate parameters. |
| 1521 // TODO(rmcilroy): Remove this check when FastNewSloppyArgumentsStub supports | 1521 // TODO(rmcilroy): Remove this check when FastNewSloppyArgumentsStub supports |
| 1522 // duplicate parameters. | 1522 // duplicate parameters. |
| 1523 Node* shared_info = | 1523 Node* shared_info = |
| 1524 __ LoadObjectField(closure, JSFunction::kSharedFunctionInfoOffset); | 1524 __ LoadObjectField(closure, JSFunction::kSharedFunctionInfoOffset); |
| 1525 Node* compiler_hints = __ LoadObjectField( | 1525 Node* compiler_hints = __ LoadObjectField( |
| 1526 shared_info, SharedFunctionInfo::kHasDuplicateParametersByteOffset, | 1526 shared_info, SharedFunctionInfo::kHasDuplicateParametersByteOffset, |
| 1527 MachineType::Uint8()); | 1527 MachineType::Uint8()); |
| 1528 Node* duplicate_parameters_bit = __ Int32Constant( | 1528 Node* duplicate_parameters_bit = __ Int32Constant( |
| 1529 1 << SharedFunctionInfo::kHasDuplicateParametersBitWithinByte); | 1529 1 << SharedFunctionInfo::kHasDuplicateParametersBitWithinByte); |
| 1530 Node* compare = __ Word32And(compiler_hints, duplicate_parameters_bit); | 1530 Node* compare = __ Word32And(compiler_hints, duplicate_parameters_bit); |
| 1531 __ BranchIf(compare, &if_duplicate_parameters, &if_not_duplicate_parameters); | 1531 __ BranchIf(compare, &if_duplicate_parameters, &if_not_duplicate_parameters); |
| 1532 | 1532 |
| 1533 __ Bind(&if_duplicate_parameters); | 1533 __ Bind(&if_duplicate_parameters); |
| 1534 { | 1534 { |
| 1535 result.Bind( | 1535 result.Bind( |
| 1536 __ CallRuntime(Runtime::kNewSloppyArguments_Generic, context, closure)); | 1536 __ CallRuntime(Runtime::kNewSloppyArguments_Generic, context, closure)); |
| 1537 __ Goto(&end); | 1537 __ Goto(&end); |
| 1538 } | 1538 } |
| 1539 | 1539 |
| 1540 __ Bind(&if_not_duplicate_parameters); | 1540 __ Bind(&if_not_duplicate_parameters); |
| 1541 { | 1541 { |
| 1542 Callable callable = CodeFactory::FastNewSloppyArguments(isolate_); | 1542 Callable callable = CodeFactory::FastNewSloppyArguments(isolate_, true); |
| 1543 Node* target = __ HeapConstant(callable.code()); | 1543 Node* target = __ HeapConstant(callable.code()); |
| 1544 result.Bind(__ CallStub(callable.descriptor(), target, context, closure)); | 1544 result.Bind(__ CallStub(callable.descriptor(), target, context, closure)); |
| 1545 __ Goto(&end); | 1545 __ Goto(&end); |
| 1546 } | 1546 } |
| 1547 __ Bind(&end); | 1547 __ Bind(&end); |
| 1548 __ SetAccumulator(result.value()); | 1548 __ SetAccumulator(result.value()); |
| 1549 __ Dispatch(); | 1549 __ Dispatch(); |
| 1550 } | 1550 } |
| 1551 | 1551 |
| 1552 | 1552 |
| 1553 // CreateUnmappedArguments | 1553 // CreateUnmappedArguments |
| 1554 // | 1554 // |
| 1555 // Creates a new unmapped arguments object. | 1555 // Creates a new unmapped arguments object. |
| 1556 void Interpreter::DoCreateUnmappedArguments(InterpreterAssembler* assembler) { | 1556 void Interpreter::DoCreateUnmappedArguments(InterpreterAssembler* assembler) { |
| 1557 Callable callable = CodeFactory::FastNewStrictArguments(isolate_); | 1557 Callable callable = CodeFactory::FastNewStrictArguments(isolate_, true); |
| 1558 Node* target = __ HeapConstant(callable.code()); | 1558 Node* target = __ HeapConstant(callable.code()); |
| 1559 Node* context = __ GetContext(); | 1559 Node* context = __ GetContext(); |
| 1560 Node* closure = __ LoadRegister(Register::function_closure()); | 1560 Node* closure = __ LoadRegister(Register::function_closure()); |
| 1561 Node* result = __ CallStub(callable.descriptor(), target, context, closure); | 1561 Node* result = __ CallStub(callable.descriptor(), target, context, closure); |
| 1562 __ SetAccumulator(result); | 1562 __ SetAccumulator(result); |
| 1563 __ Dispatch(); | 1563 __ Dispatch(); |
| 1564 } | 1564 } |
| 1565 | 1565 |
| 1566 // CreateRestParameter | 1566 // CreateRestParameter |
| 1567 // | 1567 // |
| 1568 // Creates a new rest parameter array. | 1568 // Creates a new rest parameter array. |
| 1569 void Interpreter::DoCreateRestParameter(InterpreterAssembler* assembler) { | 1569 void Interpreter::DoCreateRestParameter(InterpreterAssembler* assembler) { |
| 1570 Callable callable = CodeFactory::FastNewRestParameter(isolate_); | 1570 Callable callable = CodeFactory::FastNewRestParameter(isolate_, true); |
| 1571 Node* target = __ HeapConstant(callable.code()); | 1571 Node* target = __ HeapConstant(callable.code()); |
| 1572 Node* closure = __ LoadRegister(Register::function_closure()); | 1572 Node* closure = __ LoadRegister(Register::function_closure()); |
| 1573 Node* context = __ GetContext(); | 1573 Node* context = __ GetContext(); |
| 1574 Node* result = __ CallStub(callable.descriptor(), target, context, closure); | 1574 Node* result = __ CallStub(callable.descriptor(), target, context, closure); |
| 1575 __ SetAccumulator(result); | 1575 __ SetAccumulator(result); |
| 1576 __ Dispatch(); | 1576 __ Dispatch(); |
| 1577 } | 1577 } |
| 1578 | 1578 |
| 1579 // StackCheck | 1579 // StackCheck |
| 1580 // | 1580 // |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1805 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, | 1805 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, |
| 1806 __ SmiTag(new_state)); | 1806 __ SmiTag(new_state)); |
| 1807 __ SetAccumulator(old_state); | 1807 __ SetAccumulator(old_state); |
| 1808 | 1808 |
| 1809 __ Dispatch(); | 1809 __ Dispatch(); |
| 1810 } | 1810 } |
| 1811 | 1811 |
| 1812 } // namespace interpreter | 1812 } // namespace interpreter |
| 1813 } // namespace internal | 1813 } // namespace internal |
| 1814 } // namespace v8 | 1814 } // namespace v8 |
| OLD | NEW |