| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 1546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1557 // Jump to the generic construct code in case the specialized code cannot | 1557 // Jump to the generic construct code in case the specialized code cannot |
| 1558 // handle the construction. | 1558 // handle the construction. |
| 1559 __ bind(&generic_constructor); | 1559 __ bind(&generic_constructor); |
| 1560 Handle<Code> generic_construct_stub = | 1560 Handle<Code> generic_construct_stub = |
| 1561 masm->isolate()->builtins()->JSConstructStubGeneric(); | 1561 masm->isolate()->builtins()->JSConstructStubGeneric(); |
| 1562 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); | 1562 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); |
| 1563 } | 1563 } |
| 1564 } | 1564 } |
| 1565 | 1565 |
| 1566 | 1566 |
| 1567 void Builtins::Generate_InternalArrayConstructCode(MacroAssembler* masm) { | |
| 1568 // ----------- S t a t e ------------- | |
| 1569 // -- rax : argc | |
| 1570 // -- rdi : constructor | |
| 1571 // -- rsp[0] : return address | |
| 1572 // -- rsp[8] : last argument | |
| 1573 // ----------------------------------- | |
| 1574 if (FLAG_debug_code) { | |
| 1575 // The array construct code is only set for the builtin and internal | |
| 1576 // Array functions which always have a map. | |
| 1577 | |
| 1578 // Initial map for the builtin Array function should be a map. | |
| 1579 __ movq(rcx, FieldOperand(rdi, JSFunction::kPrototypeOrInitialMapOffset)); | |
| 1580 // Will both indicate a NULL and a Smi. | |
| 1581 STATIC_ASSERT(kSmiTag == 0); | |
| 1582 Condition not_smi = NegateCondition(masm->CheckSmi(rcx)); | |
| 1583 __ Check(not_smi, "Unexpected initial map for Array function"); | |
| 1584 __ CmpObjectType(rcx, MAP_TYPE, rcx); | |
| 1585 __ Check(equal, "Unexpected initial map for Array function"); | |
| 1586 } | |
| 1587 | |
| 1588 Label generic_constructor; | |
| 1589 // Run the native code for the Array function called as constructor. | |
| 1590 ArrayNativeCode(masm, &generic_constructor); | |
| 1591 | |
| 1592 // Jump to the generic construct code in case the specialized code cannot | |
| 1593 // handle the construction. | |
| 1594 __ bind(&generic_constructor); | |
| 1595 Handle<Code> generic_construct_stub = | |
| 1596 masm->isolate()->builtins()->JSConstructStubGeneric(); | |
| 1597 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); | |
| 1598 } | |
| 1599 | |
| 1600 | |
| 1601 void Builtins::Generate_StringConstructCode(MacroAssembler* masm) { | 1567 void Builtins::Generate_StringConstructCode(MacroAssembler* masm) { |
| 1602 // ----------- S t a t e ------------- | 1568 // ----------- S t a t e ------------- |
| 1603 // -- rax : number of arguments | 1569 // -- rax : number of arguments |
| 1604 // -- rdi : constructor function | 1570 // -- rdi : constructor function |
| 1605 // -- rsp[0] : return address | 1571 // -- rsp[0] : return address |
| 1606 // -- rsp[(argc - n) * 8] : arg[n] (zero-based) | 1572 // -- rsp[(argc - n) * 8] : arg[n] (zero-based) |
| 1607 // -- rsp[(argc + 1) * 8] : receiver | 1573 // -- rsp[(argc + 1) * 8] : receiver |
| 1608 // ----------------------------------- | 1574 // ----------------------------------- |
| 1609 Counters* counters = masm->isolate()->counters(); | 1575 Counters* counters = masm->isolate()->counters(); |
| 1610 __ IncrementCounter(counters->string_ctor_calls(), 1); | 1576 __ IncrementCounter(counters->string_ctor_calls(), 1); |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1903 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); | 1869 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); |
| 1904 generator.Generate(); | 1870 generator.Generate(); |
| 1905 } | 1871 } |
| 1906 | 1872 |
| 1907 | 1873 |
| 1908 #undef __ | 1874 #undef __ |
| 1909 | 1875 |
| 1910 } } // namespace v8::internal | 1876 } } // namespace v8::internal |
| 1911 | 1877 |
| 1912 #endif // V8_TARGET_ARCH_X64 | 1878 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |