| 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 983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 994 STATIC_ASSERT(initial_capacity >= 0); | 994 STATIC_ASSERT(initial_capacity >= 0); |
| 995 | 995 |
| 996 __ LoadInitialArrayMap(array_function, scratch2, scratch1, false); | 996 __ LoadInitialArrayMap(array_function, scratch2, scratch1, false); |
| 997 | 997 |
| 998 // Allocate the JSArray object together with space for a fixed array with the | 998 // Allocate the JSArray object together with space for a fixed array with the |
| 999 // requested elements. | 999 // requested elements. |
| 1000 int size = JSArray::kSize; | 1000 int size = JSArray::kSize; |
| 1001 if (initial_capacity > 0) { | 1001 if (initial_capacity > 0) { |
| 1002 size += FixedArray::SizeFor(initial_capacity); | 1002 size += FixedArray::SizeFor(initial_capacity); |
| 1003 } | 1003 } |
| 1004 __ AllocateInNewSpace(size, | 1004 __ Allocate(size, |
| 1005 result, | 1005 result, |
| 1006 scratch2, | 1006 scratch2, |
| 1007 scratch3, | 1007 scratch3, |
| 1008 gc_required, | 1008 gc_required, |
| 1009 TAG_OBJECT); | 1009 TAG_OBJECT, |
| 1010 MacroAssembler::NEW_SPACE); |
| 1010 | 1011 |
| 1011 // Allocated the JSArray. Now initialize the fields except for the elements | 1012 // Allocated the JSArray. Now initialize the fields except for the elements |
| 1012 // array. | 1013 // array. |
| 1013 // result: JSObject | 1014 // result: JSObject |
| 1014 // scratch1: initial map | 1015 // scratch1: initial map |
| 1015 // scratch2: start of next object | 1016 // scratch2: start of next object |
| 1016 __ mov(FieldOperand(result, JSObject::kMapOffset), scratch1); | 1017 __ mov(FieldOperand(result, JSObject::kMapOffset), scratch1); |
| 1017 Factory* factory = masm->isolate()->factory(); | 1018 Factory* factory = masm->isolate()->factory(); |
| 1018 __ mov(FieldOperand(result, JSArray::kPropertiesOffset), | 1019 __ mov(FieldOperand(result, JSArray::kPropertiesOffset), |
| 1019 factory->empty_fixed_array()); | 1020 factory->empty_fixed_array()); |
| (...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1547 __ IncrementCounter(counters->string_ctor_cached_number(), 1); | 1548 __ IncrementCounter(counters->string_ctor_cached_number(), 1); |
| 1548 __ bind(&argument_is_string); | 1549 __ bind(&argument_is_string); |
| 1549 // ----------- S t a t e ------------- | 1550 // ----------- S t a t e ------------- |
| 1550 // -- ebx : argument converted to string | 1551 // -- ebx : argument converted to string |
| 1551 // -- edi : constructor function | 1552 // -- edi : constructor function |
| 1552 // -- esp[0] : return address | 1553 // -- esp[0] : return address |
| 1553 // ----------------------------------- | 1554 // ----------------------------------- |
| 1554 | 1555 |
| 1555 // Allocate a JSValue and put the tagged pointer into eax. | 1556 // Allocate a JSValue and put the tagged pointer into eax. |
| 1556 Label gc_required; | 1557 Label gc_required; |
| 1557 __ AllocateInNewSpace(JSValue::kSize, | 1558 __ Allocate(JSValue::kSize, |
| 1558 eax, // Result. | 1559 eax, // Result. |
| 1559 ecx, // New allocation top (we ignore it). | 1560 ecx, // New allocation top (we ignore it). |
| 1560 no_reg, | 1561 no_reg, |
| 1561 &gc_required, | 1562 &gc_required, |
| 1562 TAG_OBJECT); | 1563 TAG_OBJECT, |
| 1564 MacroAssembler::NEW_SPACE); |
| 1563 | 1565 |
| 1564 // Set the map. | 1566 // Set the map. |
| 1565 __ LoadGlobalFunctionInitialMap(edi, ecx); | 1567 __ LoadGlobalFunctionInitialMap(edi, ecx); |
| 1566 if (FLAG_debug_code) { | 1568 if (FLAG_debug_code) { |
| 1567 __ cmpb(FieldOperand(ecx, Map::kInstanceSizeOffset), | 1569 __ cmpb(FieldOperand(ecx, Map::kInstanceSizeOffset), |
| 1568 JSValue::kSize >> kPointerSizeLog2); | 1570 JSValue::kSize >> kPointerSizeLog2); |
| 1569 __ Assert(equal, "Unexpected string wrapper instance size"); | 1571 __ Assert(equal, "Unexpected string wrapper instance size"); |
| 1570 __ cmpb(FieldOperand(ecx, Map::kUnusedPropertyFieldsOffset), 0); | 1572 __ cmpb(FieldOperand(ecx, Map::kUnusedPropertyFieldsOffset), 0); |
| 1571 __ Assert(equal, "Unexpected unused properties of string wrapper"); | 1573 __ Assert(equal, "Unexpected unused properties of string wrapper"); |
| 1572 } | 1574 } |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1824 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); | 1826 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); |
| 1825 generator.Generate(); | 1827 generator.Generate(); |
| 1826 } | 1828 } |
| 1827 | 1829 |
| 1828 | 1830 |
| 1829 #undef __ | 1831 #undef __ |
| 1830 } | 1832 } |
| 1831 } // namespace v8::internal | 1833 } // namespace v8::internal |
| 1832 | 1834 |
| 1833 #endif // V8_TARGET_ARCH_IA32 | 1835 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |