Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(137)

Side by Side Diff: src/x64/builtins-x64.cc

Issue 11818021: Allocation Info Tracking, continued. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebase Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 __ bind(&loop); 516 __ bind(&loop);
517 __ movq(kScratchRegister, Operand(rbx, rcx, times_pointer_size, 0)); 517 __ movq(kScratchRegister, Operand(rbx, rcx, times_pointer_size, 0));
518 __ push(Operand(kScratchRegister, 0)); // dereference handle 518 __ push(Operand(kScratchRegister, 0)); // dereference handle
519 __ addq(rcx, Immediate(1)); 519 __ addq(rcx, Immediate(1));
520 __ bind(&entry); 520 __ bind(&entry);
521 __ cmpq(rcx, rax); 521 __ cmpq(rcx, rax);
522 __ j(not_equal, &loop); 522 __ j(not_equal, &loop);
523 523
524 // Invoke the code. 524 // Invoke the code.
525 if (is_construct) { 525 if (is_construct) {
526 // No type feedback cell is available
527 Handle<Object> undefined_sentinel(
528 masm->isolate()->factory()->undefined_value());
529 __ Move(rbx, undefined_sentinel);
526 // Expects rdi to hold function pointer. 530 // Expects rdi to hold function pointer.
527 CallConstructStub stub(NO_CALL_FUNCTION_FLAGS); 531 CallConstructStub stub(NO_CALL_FUNCTION_FLAGS);
528 __ CallStub(&stub); 532 __ CallStub(&stub);
529 } else { 533 } else {
530 ParameterCount actual(rax); 534 ParameterCount actual(rax);
531 // Function must be in rdi. 535 // Function must be in rdi.
532 __ InvokeFunction(rdi, actual, CALL_FUNCTION, 536 __ InvokeFunction(rdi, actual, CALL_FUNCTION,
533 NullCallWrapper(), CALL_AS_METHOD); 537 NullCallWrapper(), CALL_AS_METHOD);
534 } 538 }
535 // Exit the internal frame. Notice that this also removes the empty 539 // Exit the internal frame. Notice that this also removes the empty
(...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after
1496 } 1500 }
1497 1501
1498 1502
1499 void Builtins::Generate_ArrayConstructCode(MacroAssembler* masm) { 1503 void Builtins::Generate_ArrayConstructCode(MacroAssembler* masm) {
1500 // ----------- S t a t e ------------- 1504 // ----------- S t a t e -------------
1501 // -- rax : argc 1505 // -- rax : argc
1502 // -- rdi : constructor 1506 // -- rdi : constructor
1503 // -- rsp[0] : return address 1507 // -- rsp[0] : return address
1504 // -- rsp[8] : last argument 1508 // -- rsp[8] : last argument
1505 // ----------------------------------- 1509 // -----------------------------------
1506 Label generic_constructor;
1507
1508 if (FLAG_debug_code) { 1510 if (FLAG_debug_code) {
1509 // The array construct code is only set for the builtin and internal 1511 // The array construct code is only set for the builtin and internal
1510 // Array functions which always have a map. 1512 // Array functions which always have a map.
1513
1511 // Initial map for the builtin Array function should be a map. 1514 // Initial map for the builtin Array function should be a map.
1512 __ movq(rbx, FieldOperand(rdi, JSFunction::kPrototypeOrInitialMapOffset)); 1515 __ movq(rcx, FieldOperand(rdi, JSFunction::kPrototypeOrInitialMapOffset));
1513 // Will both indicate a NULL and a Smi. 1516 // Will both indicate a NULL and a Smi.
1514 STATIC_ASSERT(kSmiTag == 0); 1517 STATIC_ASSERT(kSmiTag == 0);
1515 Condition not_smi = NegateCondition(masm->CheckSmi(rbx)); 1518 Condition not_smi = NegateCondition(masm->CheckSmi(rcx));
1516 __ Check(not_smi, "Unexpected initial map for Array function"); 1519 __ Check(not_smi, "Unexpected initial map for Array function");
1517 __ CmpObjectType(rbx, MAP_TYPE, rcx); 1520 __ CmpObjectType(rcx, MAP_TYPE, rcx);
1521 __ Check(equal, "Unexpected initial map for Array function");
1522
1523 // We should either have undefined in ebx or a valid jsglobalpropertycell
1524 Label okay_here;
1525 Handle<Object> undefined_sentinel(
1526 masm->isolate()->factory()->undefined_value());
1527 Handle<Map> global_property_cell_map(
1528 masm->isolate()->heap()->global_property_cell_map());
1529 __ Cmp(rbx, undefined_sentinel);
1530 __ j(equal, &okay_here);
1531 __ Cmp(FieldOperand(rbx, 0), global_property_cell_map);
1532 __ Assert(equal, "Expected property cell in register rbx");
1533 __ bind(&okay_here);
1534 }
1535
1536 if (FLAG_optimize_constructed_arrays) {
1537 Label not_zero_case, not_one_case;
1538 __ testq(rax, rax);
1539 __ j(not_zero, &not_zero_case);
1540 ArrayNoArgumentConstructorStub no_argument_stub;
1541 __ TailCallStub(&no_argument_stub);
1542
1543 __ bind(&not_zero_case);
1544 __ cmpq(rax, Immediate(1));
1545 __ j(greater, &not_one_case);
1546 ArraySingleArgumentConstructorStub single_argument_stub;
1547 __ TailCallStub(&single_argument_stub);
1548
1549 __ bind(&not_one_case);
1550 ArrayNArgumentsConstructorStub n_argument_stub;
1551 __ TailCallStub(&n_argument_stub);
1552 } else {
1553 Label generic_constructor;
1554 // Run the native code for the Array function called as constructor.
1555 ArrayNativeCode(masm, &generic_constructor);
1556
1557 // Jump to the generic construct code in case the specialized code cannot
1558 // handle the construction.
1559 __ bind(&generic_constructor);
1560 Handle<Code> generic_construct_stub =
1561 masm->isolate()->builtins()->JSConstructStubGeneric();
1562 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET);
1563 }
1564 }
1565
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);
1518 __ Check(equal, "Unexpected initial map for Array function"); 1585 __ Check(equal, "Unexpected initial map for Array function");
1519 } 1586 }
1520 1587
1588 Label generic_constructor;
1521 // Run the native code for the Array function called as constructor. 1589 // Run the native code for the Array function called as constructor.
1522 ArrayNativeCode(masm, &generic_constructor); 1590 ArrayNativeCode(masm, &generic_constructor);
1523 1591
1524 // Jump to the generic construct code in case the specialized code cannot 1592 // Jump to the generic construct code in case the specialized code cannot
1525 // handle the construction. 1593 // handle the construction.
1526 __ bind(&generic_constructor); 1594 __ bind(&generic_constructor);
1527 Handle<Code> generic_construct_stub = 1595 Handle<Code> generic_construct_stub =
1528 masm->isolate()->builtins()->JSConstructStubGeneric(); 1596 masm->isolate()->builtins()->JSConstructStubGeneric();
1529 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); 1597 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET);
1530 } 1598 }
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
1835 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); 1903 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR);
1836 generator.Generate(); 1904 generator.Generate();
1837 } 1905 }
1838 1906
1839 1907
1840 #undef __ 1908 #undef __
1841 1909
1842 } } // namespace v8::internal 1910 } } // namespace v8::internal
1843 1911
1844 #endif // V8_TARGET_ARCH_X64 1912 #endif // V8_TARGET_ARCH_X64
OLDNEW
« src/objects.cc ('K') | « src/type-info.cc ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698