| 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 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1076 STATIC_ASSERT(initial_capacity >= 0); | 1076 STATIC_ASSERT(initial_capacity >= 0); |
| 1077 | 1077 |
| 1078 __ LoadInitialArrayMap(array_function, scratch2, scratch1, false); | 1078 __ LoadInitialArrayMap(array_function, scratch2, scratch1, false); |
| 1079 | 1079 |
| 1080 // Allocate the JSArray object together with space for a fixed array with the | 1080 // Allocate the JSArray object together with space for a fixed array with the |
| 1081 // requested elements. | 1081 // requested elements. |
| 1082 int size = JSArray::kSize; | 1082 int size = JSArray::kSize; |
| 1083 if (initial_capacity > 0) { | 1083 if (initial_capacity > 0) { |
| 1084 size += FixedArray::SizeFor(initial_capacity); | 1084 size += FixedArray::SizeFor(initial_capacity); |
| 1085 } | 1085 } |
| 1086 __ AllocateInNewSpace(size, | 1086 __ Allocate(size, result, scratch2, scratch3, gc_required, TAG_OBJECT, |
| 1087 result, | 1087 MacroAssembler::NEW_SPACE); |
| 1088 scratch2, | |
| 1089 scratch3, | |
| 1090 gc_required, | |
| 1091 TAG_OBJECT); | |
| 1092 | 1088 |
| 1093 // Allocated the JSArray. Now initialize the fields except for the elements | 1089 // Allocated the JSArray. Now initialize the fields except for the elements |
| 1094 // array. | 1090 // array. |
| 1095 // result: JSObject | 1091 // result: JSObject |
| 1096 // scratch1: initial map | 1092 // scratch1: initial map |
| 1097 // scratch2: start of next object | 1093 // scratch2: start of next object |
| 1098 Factory* factory = masm->isolate()->factory(); | 1094 Factory* factory = masm->isolate()->factory(); |
| 1099 __ movq(FieldOperand(result, JSObject::kMapOffset), scratch1); | 1095 __ movq(FieldOperand(result, JSObject::kMapOffset), scratch1); |
| 1100 __ Move(FieldOperand(result, JSArray::kPropertiesOffset), | 1096 __ Move(FieldOperand(result, JSArray::kPropertiesOffset), |
| 1101 factory->empty_fixed_array()); | 1097 factory->empty_fixed_array()); |
| (...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1572 __ bind(&argument_is_string); | 1568 __ bind(&argument_is_string); |
| 1573 | 1569 |
| 1574 // ----------- S t a t e ------------- | 1570 // ----------- S t a t e ------------- |
| 1575 // -- rbx : argument converted to string | 1571 // -- rbx : argument converted to string |
| 1576 // -- rdi : constructor function | 1572 // -- rdi : constructor function |
| 1577 // -- rsp[0] : return address | 1573 // -- rsp[0] : return address |
| 1578 // ----------------------------------- | 1574 // ----------------------------------- |
| 1579 | 1575 |
| 1580 // Allocate a JSValue and put the tagged pointer into rax. | 1576 // Allocate a JSValue and put the tagged pointer into rax. |
| 1581 Label gc_required; | 1577 Label gc_required; |
| 1582 __ AllocateInNewSpace(JSValue::kSize, | 1578 __ Allocate(JSValue::kSize, |
| 1583 rax, // Result. | 1579 rax, // Result. |
| 1584 rcx, // New allocation top (we ignore it). | 1580 rcx, // New allocation top (we ignore it). |
| 1585 no_reg, | 1581 no_reg, |
| 1586 &gc_required, | 1582 &gc_required, |
| 1587 TAG_OBJECT); | 1583 TAG_OBJECT, |
| 1584 MacroAssembler::NEW_SPACE); |
| 1588 | 1585 |
| 1589 // Set the map. | 1586 // Set the map. |
| 1590 __ LoadGlobalFunctionInitialMap(rdi, rcx); | 1587 __ LoadGlobalFunctionInitialMap(rdi, rcx); |
| 1591 if (FLAG_debug_code) { | 1588 if (FLAG_debug_code) { |
| 1592 __ cmpb(FieldOperand(rcx, Map::kInstanceSizeOffset), | 1589 __ cmpb(FieldOperand(rcx, Map::kInstanceSizeOffset), |
| 1593 Immediate(JSValue::kSize >> kPointerSizeLog2)); | 1590 Immediate(JSValue::kSize >> kPointerSizeLog2)); |
| 1594 __ Assert(equal, "Unexpected string wrapper instance size"); | 1591 __ Assert(equal, "Unexpected string wrapper instance size"); |
| 1595 __ cmpb(FieldOperand(rcx, Map::kUnusedPropertyFieldsOffset), Immediate(0)); | 1592 __ cmpb(FieldOperand(rcx, Map::kUnusedPropertyFieldsOffset), Immediate(0)); |
| 1596 __ Assert(equal, "Unexpected unused properties of string wrapper"); | 1593 __ Assert(equal, "Unexpected unused properties of string wrapper"); |
| 1597 } | 1594 } |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1835 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); | 1832 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); |
| 1836 generator.Generate(); | 1833 generator.Generate(); |
| 1837 } | 1834 } |
| 1838 | 1835 |
| 1839 | 1836 |
| 1840 #undef __ | 1837 #undef __ |
| 1841 | 1838 |
| 1842 } } // namespace v8::internal | 1839 } } // namespace v8::internal |
| 1843 | 1840 |
| 1844 #endif // V8_TARGET_ARCH_X64 | 1841 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |