| 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 1477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1488 __ mov(ecx, FieldOperand(edi, JSFunction::kPrototypeOrInitialMapOffset)); | 1488 __ mov(ecx, FieldOperand(edi, JSFunction::kPrototypeOrInitialMapOffset)); |
| 1489 // Will both indicate a NULL and a Smi. | 1489 // Will both indicate a NULL and a Smi. |
| 1490 __ test(ecx, Immediate(kSmiTagMask)); | 1490 __ test(ecx, Immediate(kSmiTagMask)); |
| 1491 __ Assert(not_zero, "Unexpected initial map for Array function"); | 1491 __ Assert(not_zero, "Unexpected initial map for Array function"); |
| 1492 __ CmpObjectType(ecx, MAP_TYPE, ecx); | 1492 __ CmpObjectType(ecx, MAP_TYPE, ecx); |
| 1493 __ Assert(equal, "Unexpected initial map for Array function"); | 1493 __ Assert(equal, "Unexpected initial map for Array function"); |
| 1494 | 1494 |
| 1495 // We should either have undefined in ebx or a valid jsglobalpropertycell | 1495 // We should either have undefined in ebx or a valid jsglobalpropertycell |
| 1496 Label okay_here; | 1496 Label okay_here; |
| 1497 Handle<Object> undefined_sentinel( | 1497 Handle<Object> undefined_sentinel( |
| 1498 masm->isolate()->heap()->undefined_value()); | 1498 masm->isolate()->heap()->undefined_value(), masm->isolate()); |
| 1499 Handle<Map> global_property_cell_map( | 1499 Handle<Map> global_property_cell_map( |
| 1500 masm->isolate()->heap()->global_property_cell_map()); | 1500 masm->isolate()->heap()->global_property_cell_map()); |
| 1501 __ cmp(ebx, Immediate(undefined_sentinel)); | 1501 __ cmp(ebx, Immediate(undefined_sentinel)); |
| 1502 __ j(equal, &okay_here); | 1502 __ j(equal, &okay_here); |
| 1503 __ cmp(FieldOperand(ebx, 0), Immediate(global_property_cell_map)); | 1503 __ cmp(FieldOperand(ebx, 0), Immediate(global_property_cell_map)); |
| 1504 __ Assert(equal, "Expected property cell in register ebx"); | 1504 __ Assert(equal, "Expected property cell in register ebx"); |
| 1505 __ bind(&okay_here); | 1505 __ bind(&okay_here); |
| 1506 } | 1506 } |
| 1507 | 1507 |
| 1508 if (FLAG_optimize_constructed_arrays) { | 1508 if (FLAG_optimize_constructed_arrays) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1529 // Jump to the generic construct code in case the specialized code cannot | 1529 // Jump to the generic construct code in case the specialized code cannot |
| 1530 // handle the construction. | 1530 // handle the construction. |
| 1531 __ bind(&generic_constructor); | 1531 __ bind(&generic_constructor); |
| 1532 Handle<Code> generic_construct_stub = | 1532 Handle<Code> generic_construct_stub = |
| 1533 masm->isolate()->builtins()->JSConstructStubGeneric(); | 1533 masm->isolate()->builtins()->JSConstructStubGeneric(); |
| 1534 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET); | 1534 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET); |
| 1535 } | 1535 } |
| 1536 } | 1536 } |
| 1537 | 1537 |
| 1538 | 1538 |
| 1539 void Builtins::Generate_InternalArrayConstructCode(MacroAssembler* masm) { | |
| 1540 // ----------- S t a t e ------------- | |
| 1541 // -- eax : argc | |
| 1542 // -- edi : constructor | |
| 1543 // -- esp[0] : return address | |
| 1544 // -- esp[4] : last argument | |
| 1545 // ----------------------------------- | |
| 1546 Label generic_constructor; | |
| 1547 | |
| 1548 if (FLAG_debug_code) { | |
| 1549 // The array construct code is only set for the global and natives | |
| 1550 // builtin Array functions which always have maps. | |
| 1551 | |
| 1552 // Initial map for the builtin Array function should be a map. | |
| 1553 __ mov(ebx, FieldOperand(edi, JSFunction::kPrototypeOrInitialMapOffset)); | |
| 1554 // Will both indicate a NULL and a Smi. | |
| 1555 __ test(ebx, Immediate(kSmiTagMask)); | |
| 1556 __ Assert(not_zero, "Unexpected initial map for Array function"); | |
| 1557 __ CmpObjectType(ebx, MAP_TYPE, ecx); | |
| 1558 __ Assert(equal, "Unexpected initial map for Array function"); | |
| 1559 } | |
| 1560 | |
| 1561 // Run the native code for the Array function called as constructor. | |
| 1562 ArrayNativeCode(masm, true, &generic_constructor); | |
| 1563 | |
| 1564 // Jump to the generic construct code in case the specialized code cannot | |
| 1565 // handle the construction. | |
| 1566 __ bind(&generic_constructor); | |
| 1567 Handle<Code> generic_construct_stub = | |
| 1568 masm->isolate()->builtins()->JSConstructStubGeneric(); | |
| 1569 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET); | |
| 1570 } | |
| 1571 | |
| 1572 | |
| 1573 void Builtins::Generate_StringConstructCode(MacroAssembler* masm) { | 1539 void Builtins::Generate_StringConstructCode(MacroAssembler* masm) { |
| 1574 // ----------- S t a t e ------------- | 1540 // ----------- S t a t e ------------- |
| 1575 // -- eax : number of arguments | 1541 // -- eax : number of arguments |
| 1576 // -- edi : constructor function | 1542 // -- edi : constructor function |
| 1577 // -- esp[0] : return address | 1543 // -- esp[0] : return address |
| 1578 // -- esp[(argc - n) * 4] : arg[n] (zero-based) | 1544 // -- esp[(argc - n) * 4] : arg[n] (zero-based) |
| 1579 // -- esp[(argc + 1) * 4] : receiver | 1545 // -- esp[(argc + 1) * 4] : receiver |
| 1580 // ----------------------------------- | 1546 // ----------------------------------- |
| 1581 Counters* counters = masm->isolate()->counters(); | 1547 Counters* counters = masm->isolate()->counters(); |
| 1582 __ IncrementCounter(counters->string_ctor_calls(), 1); | 1548 __ IncrementCounter(counters->string_ctor_calls(), 1); |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1888 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); | 1854 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); |
| 1889 generator.Generate(); | 1855 generator.Generate(); |
| 1890 } | 1856 } |
| 1891 | 1857 |
| 1892 | 1858 |
| 1893 #undef __ | 1859 #undef __ |
| 1894 } | 1860 } |
| 1895 } // namespace v8::internal | 1861 } // namespace v8::internal |
| 1896 | 1862 |
| 1897 #endif // V8_TARGET_ARCH_IA32 | 1863 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |