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 397 matching lines...) Loading... | |
408 static void ReserveSpaceForFastApiCall(MacroAssembler* masm, Register scratch) { | 408 static void ReserveSpaceForFastApiCall(MacroAssembler* masm, Register scratch) { |
409 // ----------- S t a t e ------------- | 409 // ----------- S t a t e ------------- |
410 // -- rsp[0] : return address | 410 // -- rsp[0] : return address |
411 // -- rsp[8] : last argument in the internal frame of the caller | 411 // -- rsp[8] : last argument in the internal frame of the caller |
412 // ----------------------------------- | 412 // ----------------------------------- |
413 __ movq(scratch, Operand(rsp, 0)); | 413 __ movq(scratch, Operand(rsp, 0)); |
414 __ subq(rsp, Immediate(kFastApiCallArguments * kPointerSize)); | 414 __ subq(rsp, Immediate(kFastApiCallArguments * kPointerSize)); |
415 __ movq(Operand(rsp, 0), scratch); | 415 __ movq(Operand(rsp, 0), scratch); |
416 __ Move(scratch, Smi::FromInt(0)); | 416 __ Move(scratch, Smi::FromInt(0)); |
417 for (int i = 1; i <= kFastApiCallArguments; i++) { | 417 for (int i = 1; i <= kFastApiCallArguments; i++) { |
418 __ movq(Operand(rsp, i * kPointerSize), scratch); | 418 __ movq(StackArgumentOperand(i * kPointerSize), scratch); |
419 } | 419 } |
420 } | 420 } |
421 | 421 |
422 | 422 |
423 // Undoes the effects of ReserveSpaceForFastApiCall. | 423 // Undoes the effects of ReserveSpaceForFastApiCall. |
424 static void FreeSpaceForFastApiCall(MacroAssembler* masm, Register scratch) { | 424 static void FreeSpaceForFastApiCall(MacroAssembler* masm, Register scratch) { |
425 // ----------- S t a t e ------------- | 425 // ----------- S t a t e ------------- |
426 // -- rsp[0] : return address. | 426 // -- rsp[0] : return address. |
427 // -- rsp[8] : last fast api call extra argument. | 427 // -- rsp[8] : last fast api call extra argument. |
428 // -- ... | 428 // -- ... |
(...skipping 28 matching lines...) Loading... | |
457 // -- ... | 457 // -- ... |
458 // -- rsp[(argc + 6) * 8] : first argument | 458 // -- rsp[(argc + 6) * 8] : first argument |
459 // -- rsp[(argc + 7) * 8] : receiver | 459 // -- rsp[(argc + 7) * 8] : receiver |
460 // ----------------------------------- | 460 // ----------------------------------- |
461 // Get the function and setup the context. | 461 // Get the function and setup the context. |
462 Handle<JSFunction> function = optimization.constant_function(); | 462 Handle<JSFunction> function = optimization.constant_function(); |
463 __ LoadHeapObject(rdi, function); | 463 __ LoadHeapObject(rdi, function); |
464 __ movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); | 464 __ movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); |
465 | 465 |
466 // Pass the additional arguments. | 466 // Pass the additional arguments. |
467 __ movq(Operand(rsp, 2 * kPointerSize), rdi); | 467 __ movq(StackArgumentOperand(2 * kPointerSize), rdi); |
468 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info(); | 468 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info(); |
469 Handle<Object> call_data(api_call_info->data(), masm->isolate()); | 469 Handle<Object> call_data(api_call_info->data(), masm->isolate()); |
470 if (masm->isolate()->heap()->InNewSpace(*call_data)) { | 470 if (masm->isolate()->heap()->InNewSpace(*call_data)) { |
471 __ Move(rcx, api_call_info); | 471 __ Move(rcx, api_call_info); |
472 __ movq(rbx, FieldOperand(rcx, CallHandlerInfo::kDataOffset)); | 472 __ movq(rbx, FieldOperand(rcx, CallHandlerInfo::kDataOffset)); |
473 __ movq(Operand(rsp, 3 * kPointerSize), rbx); | 473 __ movq(StackArgumentOperand(3 * kPointerSize), rbx); |
474 } else { | 474 } else { |
475 __ Move(Operand(rsp, 3 * kPointerSize), call_data); | 475 __ Move(StackArgumentOperand(3 * kPointerSize), call_data); |
476 } | 476 } |
477 __ movq(kScratchRegister, | 477 __ movq(kScratchRegister, |
478 ExternalReference::isolate_address(masm->isolate())); | 478 ExternalReference::isolate_address(masm->isolate())); |
479 __ movq(Operand(rsp, 4 * kPointerSize), kScratchRegister); | 479 __ movq(StackArgumentOperand(4 * kPointerSize), kScratchRegister); |
480 __ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex); | 480 __ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex); |
481 __ movq(Operand(rsp, 5 * kPointerSize), kScratchRegister); | 481 __ movq(StackArgumentOperand(5 * kPointerSize), kScratchRegister); |
482 __ movq(Operand(rsp, 6 * kPointerSize), kScratchRegister); | 482 __ movq(StackArgumentOperand(6 * kPointerSize), kScratchRegister); |
483 | 483 |
484 // Prepare arguments. | 484 // Prepare arguments. |
485 STATIC_ASSERT(kFastApiCallArguments == 6); | 485 STATIC_ASSERT(kFastApiCallArguments == 6); |
486 __ lea(rbx, Operand(rsp, kFastApiCallArguments * kPointerSize)); | 486 __ lea(rbx, Operand(rsp, kFastApiCallArguments * kPointerSize)); |
487 | 487 |
488 // Function address is a foreign pointer outside V8's heap. | 488 // Function address is a foreign pointer outside V8's heap. |
489 Address function_address = v8::ToCData<Address>(api_call_info->callback()); | 489 Address function_address = v8::ToCData<Address>(api_call_info->callback()); |
490 bool returns_handle = | 490 bool returns_handle = |
491 !CallbackTable::ReturnsVoid(masm->isolate(), function_address); | 491 !CallbackTable::ReturnsVoid(masm->isolate(), function_address); |
492 | 492 |
(...skipping 576 matching lines...) Loading... | |
1069 ASSERT(!scratch2.is(object_reg) && !scratch2.is(holder_reg) | 1069 ASSERT(!scratch2.is(object_reg) && !scratch2.is(holder_reg) |
1070 && !scratch2.is(scratch1)); | 1070 && !scratch2.is(scratch1)); |
1071 | 1071 |
1072 // Keep track of the current object in register reg. On the first | 1072 // Keep track of the current object in register reg. On the first |
1073 // iteration, reg is an alias for object_reg, on later iterations, | 1073 // iteration, reg is an alias for object_reg, on later iterations, |
1074 // it is an alias for holder_reg. | 1074 // it is an alias for holder_reg. |
1075 Register reg = object_reg; | 1075 Register reg = object_reg; |
1076 int depth = 0; | 1076 int depth = 0; |
1077 | 1077 |
1078 if (save_at_depth == depth) { | 1078 if (save_at_depth == depth) { |
1079 __ movq(Operand(rsp, kPointerSize), object_reg); | 1079 __ movq(StackArgumentOperand(1 * kPointerSize), object_reg); |
danno
2013/07/24 22:32:52
1 * kPointerSize -> kPointerSize
| |
1080 } | 1080 } |
1081 | 1081 |
1082 // Check the maps in the prototype chain. | 1082 // Check the maps in the prototype chain. |
1083 // Traverse the prototype chain from the object and do map checks. | 1083 // Traverse the prototype chain from the object and do map checks. |
1084 Handle<JSObject> current = object; | 1084 Handle<JSObject> current = object; |
1085 while (!current.is_identical_to(holder)) { | 1085 while (!current.is_identical_to(holder)) { |
1086 ++depth; | 1086 ++depth; |
1087 | 1087 |
1088 // Only global objects and objects that do not require access | 1088 // Only global objects and objects that do not require access |
1089 // checks are allowed in stubs. | 1089 // checks are allowed in stubs. |
(...skipping 39 matching lines...) Loading... | |
1129 // The prototype is in new space; we cannot store a reference to it | 1129 // The prototype is in new space; we cannot store a reference to it |
1130 // in the code. Load it from the map. | 1130 // in the code. Load it from the map. |
1131 __ movq(reg, FieldOperand(scratch1, Map::kPrototypeOffset)); | 1131 __ movq(reg, FieldOperand(scratch1, Map::kPrototypeOffset)); |
1132 } else { | 1132 } else { |
1133 // The prototype is in old space; load it directly. | 1133 // The prototype is in old space; load it directly. |
1134 __ Move(reg, prototype); | 1134 __ Move(reg, prototype); |
1135 } | 1135 } |
1136 } | 1136 } |
1137 | 1137 |
1138 if (save_at_depth == depth) { | 1138 if (save_at_depth == depth) { |
1139 __ movq(Operand(rsp, kPointerSize), reg); | 1139 __ movq(StackArgumentOperand(1 * kPointerSize), reg); |
danno
2013/07/24 22:32:52
1*kPointerSize -> kPointerSize
| |
1140 } | 1140 } |
1141 | 1141 |
1142 // Go to the next object in the prototype chain. | 1142 // Go to the next object in the prototype chain. |
1143 current = prototype; | 1143 current = prototype; |
1144 } | 1144 } |
1145 ASSERT(current.is_identical_to(holder)); | 1145 ASSERT(current.is_identical_to(holder)); |
1146 | 1146 |
1147 // Log the check depth. | 1147 // Log the check depth. |
1148 LOG(isolate(), IntEvent("check-maps-depth", depth + 1)); | 1148 LOG(isolate(), IntEvent("check-maps-depth", depth + 1)); |
1149 | 1149 |
(...skipping 318 matching lines...) Loading... | |
1468 void CallStubCompiler::GenerateGlobalReceiverCheck(Handle<JSObject> object, | 1468 void CallStubCompiler::GenerateGlobalReceiverCheck(Handle<JSObject> object, |
1469 Handle<JSObject> holder, | 1469 Handle<JSObject> holder, |
1470 Handle<Name> name, | 1470 Handle<Name> name, |
1471 Label* miss) { | 1471 Label* miss) { |
1472 ASSERT(holder->IsGlobalObject()); | 1472 ASSERT(holder->IsGlobalObject()); |
1473 | 1473 |
1474 // Get the number of arguments. | 1474 // Get the number of arguments. |
1475 const int argc = arguments().immediate(); | 1475 const int argc = arguments().immediate(); |
1476 | 1476 |
1477 // Get the receiver from the stack. | 1477 // Get the receiver from the stack. |
1478 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); | 1478 __ movq(rdx, StackArgumentOperand((argc + 1) * kPointerSize)); |
1479 | 1479 |
1480 | 1480 |
1481 // Check that the maps haven't changed. | 1481 // Check that the maps haven't changed. |
1482 __ JumpIfSmi(rdx, miss); | 1482 __ JumpIfSmi(rdx, miss); |
1483 CheckPrototypes(object, rdx, holder, rbx, rax, rdi, name, miss); | 1483 CheckPrototypes(object, rdx, holder, rbx, rax, rdi, name, miss); |
1484 } | 1484 } |
1485 | 1485 |
1486 | 1486 |
1487 void CallStubCompiler::GenerateLoadFunctionFromCell( | 1487 void CallStubCompiler::GenerateLoadFunctionFromCell( |
1488 Handle<Cell> cell, | 1488 Handle<Cell> cell, |
(...skipping 45 matching lines...) Loading... | |
1534 // ... | 1534 // ... |
1535 // rsp[argc * 8] : argument 1 | 1535 // rsp[argc * 8] : argument 1 |
1536 // rsp[(argc + 1) * 8] : argument 0 = receiver | 1536 // rsp[(argc + 1) * 8] : argument 0 = receiver |
1537 // ----------------------------------- | 1537 // ----------------------------------- |
1538 Label miss; | 1538 Label miss; |
1539 | 1539 |
1540 GenerateNameCheck(name, &miss); | 1540 GenerateNameCheck(name, &miss); |
1541 | 1541 |
1542 // Get the receiver from the stack. | 1542 // Get the receiver from the stack. |
1543 const int argc = arguments().immediate(); | 1543 const int argc = arguments().immediate(); |
1544 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); | 1544 __ movq(rdx, StackArgumentOperand((argc + 1) * kPointerSize)); |
1545 | 1545 |
1546 // Check that the receiver isn't a smi. | 1546 // Check that the receiver isn't a smi. |
1547 __ JumpIfSmi(rdx, &miss); | 1547 __ JumpIfSmi(rdx, &miss); |
1548 | 1548 |
1549 // Do the right check and compute the holder register. | 1549 // Do the right check and compute the holder register. |
1550 Register reg = CheckPrototypes(object, rdx, holder, rbx, rax, rdi, | 1550 Register reg = CheckPrototypes(object, rdx, holder, rbx, rax, rdi, |
1551 name, &miss); | 1551 name, &miss); |
1552 | 1552 |
1553 GenerateFastPropertyLoad(masm(), rdi, reg, index.is_inobject(holder), | 1553 GenerateFastPropertyLoad(masm(), rdi, reg, index.is_inobject(holder), |
1554 index.translate(holder), Representation::Tagged()); | 1554 index.translate(holder), Representation::Tagged()); |
1555 | 1555 |
1556 // Check that the function really is a function. | 1556 // Check that the function really is a function. |
1557 __ JumpIfSmi(rdi, &miss); | 1557 __ JumpIfSmi(rdi, &miss); |
1558 __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rbx); | 1558 __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rbx); |
1559 __ j(not_equal, &miss); | 1559 __ j(not_equal, &miss); |
1560 | 1560 |
1561 // Patch the receiver on the stack with the global proxy if | 1561 // Patch the receiver on the stack with the global proxy if |
1562 // necessary. | 1562 // necessary. |
1563 if (object->IsGlobalObject()) { | 1563 if (object->IsGlobalObject()) { |
1564 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset)); | 1564 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset)); |
1565 __ movq(Operand(rsp, (argc + 1) * kPointerSize), rdx); | 1565 __ movq(StackArgumentOperand((argc + 1) * kPointerSize), rdx); |
1566 } | 1566 } |
1567 | 1567 |
1568 // Invoke the function. | 1568 // Invoke the function. |
1569 CallKind call_kind = CallICBase::Contextual::decode(extra_state_) | 1569 CallKind call_kind = CallICBase::Contextual::decode(extra_state_) |
1570 ? CALL_AS_FUNCTION | 1570 ? CALL_AS_FUNCTION |
1571 : CALL_AS_METHOD; | 1571 : CALL_AS_METHOD; |
1572 __ InvokeFunction(rdi, arguments(), JUMP_FUNCTION, | 1572 __ InvokeFunction(rdi, arguments(), JUMP_FUNCTION, |
1573 NullCallWrapper(), call_kind); | 1573 NullCallWrapper(), call_kind); |
1574 | 1574 |
1575 // Handle call cache miss. | 1575 // Handle call cache miss. |
(...skipping 13 matching lines...) Loading... | |
1589 Handle<String> name, | 1589 Handle<String> name, |
1590 Code::StubType type) { | 1590 Code::StubType type) { |
1591 Label miss; | 1591 Label miss; |
1592 | 1592 |
1593 // Check that function is still array | 1593 // Check that function is still array |
1594 const int argc = arguments().immediate(); | 1594 const int argc = arguments().immediate(); |
1595 GenerateNameCheck(name, &miss); | 1595 GenerateNameCheck(name, &miss); |
1596 | 1596 |
1597 if (cell.is_null()) { | 1597 if (cell.is_null()) { |
1598 // Get the receiver from the stack. | 1598 // Get the receiver from the stack. |
1599 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); | 1599 __ movq(rdx, StackArgumentOperand((argc + 1) * kPointerSize)); |
1600 | 1600 |
1601 // Check that the receiver isn't a smi. | 1601 // Check that the receiver isn't a smi. |
1602 __ JumpIfSmi(rdx, &miss); | 1602 __ JumpIfSmi(rdx, &miss); |
1603 CheckPrototypes(Handle<JSObject>::cast(object), rdx, holder, rbx, rax, rdi, | 1603 CheckPrototypes(Handle<JSObject>::cast(object), rdx, holder, rbx, rax, rdi, |
1604 name, &miss); | 1604 name, &miss); |
1605 } else { | 1605 } else { |
1606 ASSERT(cell->value() == *function); | 1606 ASSERT(cell->value() == *function); |
1607 GenerateGlobalReceiverCheck(Handle<JSObject>::cast(object), holder, name, | 1607 GenerateGlobalReceiverCheck(Handle<JSObject>::cast(object), holder, name, |
1608 &miss); | 1608 &miss); |
1609 GenerateLoadFunctionFromCell(cell, function, &miss); | 1609 GenerateLoadFunctionFromCell(cell, function, &miss); |
(...skipping 33 matching lines...) Loading... | |
1643 // ----------------------------------- | 1643 // ----------------------------------- |
1644 | 1644 |
1645 // If object is not an array, bail out to regular call. | 1645 // If object is not an array, bail out to regular call. |
1646 if (!object->IsJSArray() || !cell.is_null()) return Handle<Code>::null(); | 1646 if (!object->IsJSArray() || !cell.is_null()) return Handle<Code>::null(); |
1647 | 1647 |
1648 Label miss; | 1648 Label miss; |
1649 GenerateNameCheck(name, &miss); | 1649 GenerateNameCheck(name, &miss); |
1650 | 1650 |
1651 // Get the receiver from the stack. | 1651 // Get the receiver from the stack. |
1652 const int argc = arguments().immediate(); | 1652 const int argc = arguments().immediate(); |
1653 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); | 1653 __ movq(rdx, StackArgumentOperand((argc + 1) * kPointerSize)); |
1654 | 1654 |
1655 // Check that the receiver isn't a smi. | 1655 // Check that the receiver isn't a smi. |
1656 __ JumpIfSmi(rdx, &miss); | 1656 __ JumpIfSmi(rdx, &miss); |
1657 | 1657 |
1658 CheckPrototypes(Handle<JSObject>::cast(object), rdx, holder, rbx, rax, rdi, | 1658 CheckPrototypes(Handle<JSObject>::cast(object), rdx, holder, rbx, rax, rdi, |
1659 name, &miss); | 1659 name, &miss); |
1660 | 1660 |
1661 if (argc == 0) { | 1661 if (argc == 0) { |
1662 // Noop, return the length. | 1662 // Noop, return the length. |
1663 __ movq(rax, FieldOperand(rdx, JSArray::kLengthOffset)); | 1663 __ movq(rax, FieldOperand(rdx, JSArray::kLengthOffset)); |
(...skipping 18 matching lines...) Loading... | |
1682 __ addl(rax, Immediate(argc)); | 1682 __ addl(rax, Immediate(argc)); |
1683 | 1683 |
1684 // Get the elements' length into rcx. | 1684 // Get the elements' length into rcx. |
1685 __ SmiToInteger32(rcx, FieldOperand(rdi, FixedArray::kLengthOffset)); | 1685 __ SmiToInteger32(rcx, FieldOperand(rdi, FixedArray::kLengthOffset)); |
1686 | 1686 |
1687 // Check if we could survive without allocation. | 1687 // Check if we could survive without allocation. |
1688 __ cmpl(rax, rcx); | 1688 __ cmpl(rax, rcx); |
1689 __ j(greater, &attempt_to_grow_elements); | 1689 __ j(greater, &attempt_to_grow_elements); |
1690 | 1690 |
1691 // Check if value is a smi. | 1691 // Check if value is a smi. |
1692 __ movq(rcx, Operand(rsp, argc * kPointerSize)); | 1692 __ movq(rcx, StackArgumentOperand(argc * kPointerSize)); |
1693 __ JumpIfNotSmi(rcx, &with_write_barrier); | 1693 __ JumpIfNotSmi(rcx, &with_write_barrier); |
1694 | 1694 |
1695 // Save new length. | 1695 // Save new length. |
1696 __ Integer32ToSmiField(FieldOperand(rdx, JSArray::kLengthOffset), rax); | 1696 __ Integer32ToSmiField(FieldOperand(rdx, JSArray::kLengthOffset), rax); |
1697 | 1697 |
1698 // Store the value. | 1698 // Store the value. |
1699 __ movq(FieldOperand(rdi, | 1699 __ movq(FieldOperand(rdi, |
1700 rax, | 1700 rax, |
1701 times_pointer_size, | 1701 times_pointer_size, |
1702 FixedArray::kHeaderSize - argc * kPointerSize), | 1702 FixedArray::kHeaderSize - argc * kPointerSize), |
(...skipping 14 matching lines...) Loading... | |
1717 STATIC_ASSERT(FixedArray::kMaxLength < Smi::kMaxValue); | 1717 STATIC_ASSERT(FixedArray::kMaxLength < Smi::kMaxValue); |
1718 __ addl(rax, Immediate(argc)); | 1718 __ addl(rax, Immediate(argc)); |
1719 | 1719 |
1720 // Get the elements' length into rcx. | 1720 // Get the elements' length into rcx. |
1721 __ SmiToInteger32(rcx, FieldOperand(rdi, FixedArray::kLengthOffset)); | 1721 __ SmiToInteger32(rcx, FieldOperand(rdi, FixedArray::kLengthOffset)); |
1722 | 1722 |
1723 // Check if we could survive without allocation. | 1723 // Check if we could survive without allocation. |
1724 __ cmpl(rax, rcx); | 1724 __ cmpl(rax, rcx); |
1725 __ j(greater, &call_builtin); | 1725 __ j(greater, &call_builtin); |
1726 | 1726 |
1727 __ movq(rcx, Operand(rsp, argc * kPointerSize)); | 1727 __ movq(rcx, StackArgumentOperand(argc * kPointerSize)); |
1728 __ StoreNumberToDoubleElements( | 1728 __ StoreNumberToDoubleElements( |
1729 rcx, rdi, rax, xmm0, &call_builtin, argc * kDoubleSize); | 1729 rcx, rdi, rax, xmm0, &call_builtin, argc * kDoubleSize); |
1730 | 1730 |
1731 // Save new length. | 1731 // Save new length. |
1732 __ Integer32ToSmiField(FieldOperand(rdx, JSArray::kLengthOffset), rax); | 1732 __ Integer32ToSmiField(FieldOperand(rdx, JSArray::kLengthOffset), rax); |
1733 __ Integer32ToSmi(rax, rax); // Return new length as smi. | 1733 __ Integer32ToSmi(rax, rax); // Return new length as smi. |
1734 __ ret((argc + 1) * kPointerSize); | 1734 __ ret((argc + 1) * kPointerSize); |
1735 | 1735 |
1736 __ bind(&with_write_barrier); | 1736 __ bind(&with_write_barrier); |
1737 | 1737 |
(...skipping 56 matching lines...) Loading... | |
1794 OMIT_SMI_CHECK); | 1794 OMIT_SMI_CHECK); |
1795 | 1795 |
1796 __ Integer32ToSmi(rax, rax); // Return new length as smi. | 1796 __ Integer32ToSmi(rax, rax); // Return new length as smi. |
1797 __ ret((argc + 1) * kPointerSize); | 1797 __ ret((argc + 1) * kPointerSize); |
1798 | 1798 |
1799 __ bind(&attempt_to_grow_elements); | 1799 __ bind(&attempt_to_grow_elements); |
1800 if (!FLAG_inline_new) { | 1800 if (!FLAG_inline_new) { |
1801 __ jmp(&call_builtin); | 1801 __ jmp(&call_builtin); |
1802 } | 1802 } |
1803 | 1803 |
1804 __ movq(rbx, Operand(rsp, argc * kPointerSize)); | 1804 __ movq(rbx, StackArgumentOperand(argc * kPointerSize)); |
1805 // Growing elements that are SMI-only requires special handling in case | 1805 // Growing elements that are SMI-only requires special handling in case |
1806 // the new element is non-Smi. For now, delegate to the builtin. | 1806 // the new element is non-Smi. For now, delegate to the builtin. |
1807 Label no_fast_elements_check; | 1807 Label no_fast_elements_check; |
1808 __ JumpIfSmi(rbx, &no_fast_elements_check); | 1808 __ JumpIfSmi(rbx, &no_fast_elements_check); |
1809 __ movq(rcx, FieldOperand(rdx, HeapObject::kMapOffset)); | 1809 __ movq(rcx, FieldOperand(rdx, HeapObject::kMapOffset)); |
1810 __ CheckFastObjectElements(rcx, &call_builtin, Label::kFar); | 1810 __ CheckFastObjectElements(rcx, &call_builtin, Label::kFar); |
1811 __ bind(&no_fast_elements_check); | 1811 __ bind(&no_fast_elements_check); |
1812 | 1812 |
1813 ExternalReference new_space_allocation_top = | 1813 ExternalReference new_space_allocation_top = |
1814 ExternalReference::new_space_allocation_top_address(isolate()); | 1814 ExternalReference::new_space_allocation_top_address(isolate()); |
(...skipping 28 matching lines...) Loading... | |
1843 } | 1843 } |
1844 | 1844 |
1845 // We know the elements array is in new space so we don't need the | 1845 // We know the elements array is in new space so we don't need the |
1846 // remembered set, but we just pushed a value onto it so we may have to | 1846 // remembered set, but we just pushed a value onto it so we may have to |
1847 // tell the incremental marker to rescan the object that we just grew. We | 1847 // tell the incremental marker to rescan the object that we just grew. We |
1848 // don't need to worry about the holes because they are in old space and | 1848 // don't need to worry about the holes because they are in old space and |
1849 // already marked black. | 1849 // already marked black. |
1850 __ RecordWrite(rdi, rdx, rbx, kDontSaveFPRegs, OMIT_REMEMBERED_SET); | 1850 __ RecordWrite(rdi, rdx, rbx, kDontSaveFPRegs, OMIT_REMEMBERED_SET); |
1851 | 1851 |
1852 // Restore receiver to rdx as finish sequence assumes it's here. | 1852 // Restore receiver to rdx as finish sequence assumes it's here. |
1853 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); | 1853 __ movq(rdx, StackArgumentOperand((argc + 1) * kPointerSize)); |
1854 | 1854 |
1855 // Increment element's and array's sizes. | 1855 // Increment element's and array's sizes. |
1856 __ SmiAddConstant(FieldOperand(rdi, FixedArray::kLengthOffset), | 1856 __ SmiAddConstant(FieldOperand(rdi, FixedArray::kLengthOffset), |
1857 Smi::FromInt(kAllocationDelta)); | 1857 Smi::FromInt(kAllocationDelta)); |
1858 | 1858 |
1859 // Make new length a smi before returning it. | 1859 // Make new length a smi before returning it. |
1860 __ Integer32ToSmi(rax, rax); | 1860 __ Integer32ToSmi(rax, rax); |
1861 __ movq(FieldOperand(rdx, JSArray::kLengthOffset), rax); | 1861 __ movq(FieldOperand(rdx, JSArray::kLengthOffset), rax); |
1862 | 1862 |
1863 __ ret((argc + 1) * kPointerSize); | 1863 __ ret((argc + 1) * kPointerSize); |
(...skipping 30 matching lines...) Loading... | |
1894 // ----------------------------------- | 1894 // ----------------------------------- |
1895 | 1895 |
1896 // If object is not an array, bail out to regular call. | 1896 // If object is not an array, bail out to regular call. |
1897 if (!object->IsJSArray() || !cell.is_null()) return Handle<Code>::null(); | 1897 if (!object->IsJSArray() || !cell.is_null()) return Handle<Code>::null(); |
1898 | 1898 |
1899 Label miss, return_undefined, call_builtin; | 1899 Label miss, return_undefined, call_builtin; |
1900 GenerateNameCheck(name, &miss); | 1900 GenerateNameCheck(name, &miss); |
1901 | 1901 |
1902 // Get the receiver from the stack. | 1902 // Get the receiver from the stack. |
1903 const int argc = arguments().immediate(); | 1903 const int argc = arguments().immediate(); |
1904 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); | 1904 __ movq(rdx, StackArgumentOperand((argc + 1) * kPointerSize)); |
1905 | 1905 |
1906 // Check that the receiver isn't a smi. | 1906 // Check that the receiver isn't a smi. |
1907 __ JumpIfSmi(rdx, &miss); | 1907 __ JumpIfSmi(rdx, &miss); |
1908 | 1908 |
1909 CheckPrototypes(Handle<JSObject>::cast(object), rdx, holder, rbx, rax, rdi, | 1909 CheckPrototypes(Handle<JSObject>::cast(object), rdx, holder, rbx, rax, rdi, |
1910 name, &miss); | 1910 name, &miss); |
1911 | 1911 |
1912 // Get the elements array of the object. | 1912 // Get the elements array of the object. |
1913 __ movq(rbx, FieldOperand(rdx, JSArray::kElementsOffset)); | 1913 __ movq(rbx, FieldOperand(rdx, JSArray::kElementsOffset)); |
1914 | 1914 |
(...skipping 82 matching lines...) Loading... | |
1997 rax, | 1997 rax, |
1998 &miss); | 1998 &miss); |
1999 ASSERT(!object.is_identical_to(holder)); | 1999 ASSERT(!object.is_identical_to(holder)); |
2000 CheckPrototypes( | 2000 CheckPrototypes( |
2001 Handle<JSObject>(JSObject::cast(object->GetPrototype(isolate()))), | 2001 Handle<JSObject>(JSObject::cast(object->GetPrototype(isolate()))), |
2002 rax, holder, rbx, rdx, rdi, name, &miss); | 2002 rax, holder, rbx, rdx, rdi, name, &miss); |
2003 | 2003 |
2004 Register receiver = rbx; | 2004 Register receiver = rbx; |
2005 Register index = rdi; | 2005 Register index = rdi; |
2006 Register result = rax; | 2006 Register result = rax; |
2007 __ movq(receiver, Operand(rsp, (argc + 1) * kPointerSize)); | 2007 __ movq(receiver, StackArgumentOperand((argc + 1) * kPointerSize)); |
2008 if (argc > 0) { | 2008 if (argc > 0) { |
2009 __ movq(index, Operand(rsp, (argc - 0) * kPointerSize)); | 2009 __ movq(index, StackArgumentOperand((argc - 0) * kPointerSize)); |
2010 } else { | 2010 } else { |
2011 __ LoadRoot(index, Heap::kUndefinedValueRootIndex); | 2011 __ LoadRoot(index, Heap::kUndefinedValueRootIndex); |
2012 } | 2012 } |
2013 | 2013 |
2014 StringCharCodeAtGenerator generator(receiver, | 2014 StringCharCodeAtGenerator generator(receiver, |
2015 index, | 2015 index, |
2016 result, | 2016 result, |
2017 &miss, // When not a string. | 2017 &miss, // When not a string. |
2018 &miss, // When not a number. | 2018 &miss, // When not a number. |
2019 index_out_of_range_label, | 2019 index_out_of_range_label, |
(...skipping 58 matching lines...) Loading... | |
2078 &miss); | 2078 &miss); |
2079 ASSERT(!object.is_identical_to(holder)); | 2079 ASSERT(!object.is_identical_to(holder)); |
2080 CheckPrototypes( | 2080 CheckPrototypes( |
2081 Handle<JSObject>(JSObject::cast(object->GetPrototype(isolate()))), | 2081 Handle<JSObject>(JSObject::cast(object->GetPrototype(isolate()))), |
2082 rax, holder, rbx, rdx, rdi, name, &miss); | 2082 rax, holder, rbx, rdx, rdi, name, &miss); |
2083 | 2083 |
2084 Register receiver = rax; | 2084 Register receiver = rax; |
2085 Register index = rdi; | 2085 Register index = rdi; |
2086 Register scratch = rdx; | 2086 Register scratch = rdx; |
2087 Register result = rax; | 2087 Register result = rax; |
2088 __ movq(receiver, Operand(rsp, (argc + 1) * kPointerSize)); | 2088 __ movq(receiver, StackArgumentOperand((argc + 1) * kPointerSize)); |
2089 if (argc > 0) { | 2089 if (argc > 0) { |
2090 __ movq(index, Operand(rsp, (argc - 0) * kPointerSize)); | 2090 __ movq(index, StackArgumentOperand((argc - 0) * kPointerSize)); |
2091 } else { | 2091 } else { |
2092 __ LoadRoot(index, Heap::kUndefinedValueRootIndex); | 2092 __ LoadRoot(index, Heap::kUndefinedValueRootIndex); |
2093 } | 2093 } |
2094 | 2094 |
2095 StringCharAtGenerator generator(receiver, | 2095 StringCharAtGenerator generator(receiver, |
2096 index, | 2096 index, |
2097 scratch, | 2097 scratch, |
2098 result, | 2098 result, |
2099 &miss, // When not a string. | 2099 &miss, // When not a string. |
2100 &miss, // When not a number. | 2100 &miss, // When not a number. |
(...skipping 38 matching lines...) Loading... | |
2139 | 2139 |
2140 // If the object is not a JSObject or we got an unexpected number of | 2140 // If the object is not a JSObject or we got an unexpected number of |
2141 // arguments, bail out to the regular call. | 2141 // arguments, bail out to the regular call. |
2142 const int argc = arguments().immediate(); | 2142 const int argc = arguments().immediate(); |
2143 if (!object->IsJSObject() || argc != 1) return Handle<Code>::null(); | 2143 if (!object->IsJSObject() || argc != 1) return Handle<Code>::null(); |
2144 | 2144 |
2145 Label miss; | 2145 Label miss; |
2146 GenerateNameCheck(name, &miss); | 2146 GenerateNameCheck(name, &miss); |
2147 | 2147 |
2148 if (cell.is_null()) { | 2148 if (cell.is_null()) { |
2149 __ movq(rdx, Operand(rsp, 2 * kPointerSize)); | 2149 __ movq(rdx, StackArgumentOperand(2 * kPointerSize)); |
2150 __ JumpIfSmi(rdx, &miss); | 2150 __ JumpIfSmi(rdx, &miss); |
2151 CheckPrototypes(Handle<JSObject>::cast(object), rdx, holder, rbx, rax, rdi, | 2151 CheckPrototypes(Handle<JSObject>::cast(object), rdx, holder, rbx, rax, rdi, |
2152 name, &miss); | 2152 name, &miss); |
2153 } else { | 2153 } else { |
2154 ASSERT(cell->value() == *function); | 2154 ASSERT(cell->value() == *function); |
2155 GenerateGlobalReceiverCheck(Handle<JSObject>::cast(object), holder, name, | 2155 GenerateGlobalReceiverCheck(Handle<JSObject>::cast(object), holder, name, |
2156 &miss); | 2156 &miss); |
2157 GenerateLoadFunctionFromCell(cell, function, &miss); | 2157 GenerateLoadFunctionFromCell(cell, function, &miss); |
2158 } | 2158 } |
2159 | 2159 |
2160 // Load the char code argument. | 2160 // Load the char code argument. |
2161 Register code = rbx; | 2161 Register code = rbx; |
2162 __ movq(code, Operand(rsp, 1 * kPointerSize)); | 2162 __ movq(code, StackArgumentOperand(1 * kPointerSize)); |
2163 | 2163 |
2164 // Check the code is a smi. | 2164 // Check the code is a smi. |
2165 Label slow; | 2165 Label slow; |
2166 __ JumpIfNotSmi(code, &slow); | 2166 __ JumpIfNotSmi(code, &slow); |
2167 | 2167 |
2168 // Convert the smi code to uint16. | 2168 // Convert the smi code to uint16. |
2169 __ SmiAndConstant(code, code, Smi::FromInt(0xffff)); | 2169 __ SmiAndConstant(code, code, Smi::FromInt(0xffff)); |
2170 | 2170 |
2171 StringCharFromCodeGenerator generator(code, rax); | 2171 StringCharFromCodeGenerator generator(code, rax); |
2172 generator.GenerateFast(masm()); | 2172 generator.GenerateFast(masm()); |
(...skipping 50 matching lines...) Loading... | |
2223 | 2223 |
2224 // If the object is not a JSObject or we got an unexpected number of | 2224 // If the object is not a JSObject or we got an unexpected number of |
2225 // arguments, bail out to the regular call. | 2225 // arguments, bail out to the regular call. |
2226 const int argc = arguments().immediate(); | 2226 const int argc = arguments().immediate(); |
2227 if (!object->IsJSObject() || argc != 1) return Handle<Code>::null(); | 2227 if (!object->IsJSObject() || argc != 1) return Handle<Code>::null(); |
2228 | 2228 |
2229 Label miss; | 2229 Label miss; |
2230 GenerateNameCheck(name, &miss); | 2230 GenerateNameCheck(name, &miss); |
2231 | 2231 |
2232 if (cell.is_null()) { | 2232 if (cell.is_null()) { |
2233 __ movq(rdx, Operand(rsp, 2 * kPointerSize)); | 2233 __ movq(rdx, StackArgumentOperand(2 * kPointerSize)); |
2234 __ JumpIfSmi(rdx, &miss); | 2234 __ JumpIfSmi(rdx, &miss); |
2235 CheckPrototypes(Handle<JSObject>::cast(object), rdx, holder, rbx, rax, rdi, | 2235 CheckPrototypes(Handle<JSObject>::cast(object), rdx, holder, rbx, rax, rdi, |
2236 name, &miss); | 2236 name, &miss); |
2237 } else { | 2237 } else { |
2238 ASSERT(cell->value() == *function); | 2238 ASSERT(cell->value() == *function); |
2239 GenerateGlobalReceiverCheck(Handle<JSObject>::cast(object), holder, name, | 2239 GenerateGlobalReceiverCheck(Handle<JSObject>::cast(object), holder, name, |
2240 &miss); | 2240 &miss); |
2241 GenerateLoadFunctionFromCell(cell, function, &miss); | 2241 GenerateLoadFunctionFromCell(cell, function, &miss); |
2242 } | 2242 } |
2243 // Load the (only) argument into rax. | 2243 // Load the (only) argument into rax. |
2244 __ movq(rax, Operand(rsp, 1 * kPointerSize)); | 2244 __ movq(rax, StackArgumentOperand(1 * kPointerSize)); |
2245 | 2245 |
2246 // Check if the argument is a smi. | 2246 // Check if the argument is a smi. |
2247 Label not_smi; | 2247 Label not_smi; |
2248 STATIC_ASSERT(kSmiTag == 0); | 2248 STATIC_ASSERT(kSmiTag == 0); |
2249 __ JumpIfNotSmi(rax, ¬_smi); | 2249 __ JumpIfNotSmi(rax, ¬_smi); |
2250 __ SmiToInteger32(rax, rax); | 2250 __ SmiToInteger32(rax, rax); |
2251 | 2251 |
2252 // Set ebx to 1...1 (== -1) if the argument is negative, or to 0...0 | 2252 // Set ebx to 1...1 (== -1) if the argument is negative, or to 0...0 |
2253 // otherwise. | 2253 // otherwise. |
2254 __ movl(rbx, rax); | 2254 __ movl(rbx, rax); |
(...skipping 72 matching lines...) Loading... | |
2327 if (!object->IsJSObject()) return Handle<Code>::null(); | 2327 if (!object->IsJSObject()) return Handle<Code>::null(); |
2328 int depth = optimization.GetPrototypeDepthOfExpectedType( | 2328 int depth = optimization.GetPrototypeDepthOfExpectedType( |
2329 Handle<JSObject>::cast(object), holder); | 2329 Handle<JSObject>::cast(object), holder); |
2330 if (depth == kInvalidProtoDepth) return Handle<Code>::null(); | 2330 if (depth == kInvalidProtoDepth) return Handle<Code>::null(); |
2331 | 2331 |
2332 Label miss, miss_before_stack_reserved; | 2332 Label miss, miss_before_stack_reserved; |
2333 GenerateNameCheck(name, &miss_before_stack_reserved); | 2333 GenerateNameCheck(name, &miss_before_stack_reserved); |
2334 | 2334 |
2335 // Get the receiver from the stack. | 2335 // Get the receiver from the stack. |
2336 const int argc = arguments().immediate(); | 2336 const int argc = arguments().immediate(); |
2337 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); | 2337 __ movq(rdx, StackArgumentOperand((argc + 1) * kPointerSize)); |
2338 | 2338 |
2339 // Check that the receiver isn't a smi. | 2339 // Check that the receiver isn't a smi. |
2340 __ JumpIfSmi(rdx, &miss_before_stack_reserved); | 2340 __ JumpIfSmi(rdx, &miss_before_stack_reserved); |
2341 | 2341 |
2342 Counters* counters = isolate()->counters(); | 2342 Counters* counters = isolate()->counters(); |
2343 __ IncrementCounter(counters->call_const(), 1); | 2343 __ IncrementCounter(counters->call_const(), 1); |
2344 __ IncrementCounter(counters->call_const_fast_api(), 1); | 2344 __ IncrementCounter(counters->call_const_fast_api(), 1); |
2345 | 2345 |
2346 // Allocate space for v8::Arguments implicit values. Must be initialized | 2346 // Allocate space for v8::Arguments implicit values. Must be initialized |
2347 // before calling any runtime function. | 2347 // before calling any runtime function. |
(...skipping 32 matching lines...) Loading... | |
2380 // rsp[16] : argument argc - 1 | 2380 // rsp[16] : argument argc - 1 |
2381 // ... | 2381 // ... |
2382 // rsp[argc * 8] : argument 1 | 2382 // rsp[argc * 8] : argument 1 |
2383 // rsp[(argc + 1) * 8] : argument 0 = receiver | 2383 // rsp[(argc + 1) * 8] : argument 0 = receiver |
2384 // ----------------------------------- | 2384 // ----------------------------------- |
2385 Label miss; | 2385 Label miss; |
2386 GenerateNameCheck(name, &miss); | 2386 GenerateNameCheck(name, &miss); |
2387 | 2387 |
2388 // Get the receiver from the stack. | 2388 // Get the receiver from the stack. |
2389 const int argc = arguments().immediate(); | 2389 const int argc = arguments().immediate(); |
2390 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); | 2390 __ movq(rdx, StackArgumentOperand((argc + 1) * kPointerSize)); |
2391 | 2391 |
2392 // Check that the receiver isn't a smi. | 2392 // Check that the receiver isn't a smi. |
2393 if (check != NUMBER_CHECK) { | 2393 if (check != NUMBER_CHECK) { |
2394 __ JumpIfSmi(rdx, &miss); | 2394 __ JumpIfSmi(rdx, &miss); |
2395 } | 2395 } |
2396 | 2396 |
2397 // Make sure that it's okay not to patch the on stack receiver | 2397 // Make sure that it's okay not to patch the on stack receiver |
2398 // unless we're doing a receiver map check. | 2398 // unless we're doing a receiver map check. |
2399 ASSERT(!object->IsGlobalObject() || check == RECEIVER_MAP_CHECK); | 2399 ASSERT(!object->IsGlobalObject() || check == RECEIVER_MAP_CHECK); |
2400 | 2400 |
2401 Counters* counters = isolate()->counters(); | 2401 Counters* counters = isolate()->counters(); |
2402 switch (check) { | 2402 switch (check) { |
2403 case RECEIVER_MAP_CHECK: | 2403 case RECEIVER_MAP_CHECK: |
2404 __ IncrementCounter(counters->call_const(), 1); | 2404 __ IncrementCounter(counters->call_const(), 1); |
2405 | 2405 |
2406 // Check that the maps haven't changed. | 2406 // Check that the maps haven't changed. |
2407 CheckPrototypes(Handle<JSObject>::cast(object), rdx, holder, rbx, rax, | 2407 CheckPrototypes(Handle<JSObject>::cast(object), rdx, holder, rbx, rax, |
2408 rdi, name, &miss); | 2408 rdi, name, &miss); |
2409 | 2409 |
2410 // Patch the receiver on the stack with the global proxy if | 2410 // Patch the receiver on the stack with the global proxy if |
2411 // necessary. | 2411 // necessary. |
2412 if (object->IsGlobalObject()) { | 2412 if (object->IsGlobalObject()) { |
2413 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset)); | 2413 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset)); |
2414 __ movq(Operand(rsp, (argc + 1) * kPointerSize), rdx); | 2414 __ movq(StackArgumentOperand((argc + 1) * kPointerSize), rdx); |
2415 } | 2415 } |
2416 break; | 2416 break; |
2417 | 2417 |
2418 case STRING_CHECK: | 2418 case STRING_CHECK: |
2419 // Check that the object is a string. | 2419 // Check that the object is a string. |
2420 __ CmpObjectType(rdx, FIRST_NONSTRING_TYPE, rax); | 2420 __ CmpObjectType(rdx, FIRST_NONSTRING_TYPE, rax); |
2421 __ j(above_equal, &miss); | 2421 __ j(above_equal, &miss); |
2422 // Check that the maps starting from the prototype haven't changed. | 2422 // Check that the maps starting from the prototype haven't changed. |
2423 GenerateDirectLoadGlobalFunctionPrototype( | 2423 GenerateDirectLoadGlobalFunctionPrototype( |
2424 masm(), Context::STRING_FUNCTION_INDEX, rax, &miss); | 2424 masm(), Context::STRING_FUNCTION_INDEX, rax, &miss); |
(...skipping 106 matching lines...) Loading... | |
2531 Label miss; | 2531 Label miss; |
2532 GenerateNameCheck(name, &miss); | 2532 GenerateNameCheck(name, &miss); |
2533 | 2533 |
2534 // Get the number of arguments. | 2534 // Get the number of arguments. |
2535 const int argc = arguments().immediate(); | 2535 const int argc = arguments().immediate(); |
2536 | 2536 |
2537 LookupResult lookup(isolate()); | 2537 LookupResult lookup(isolate()); |
2538 LookupPostInterceptor(holder, name, &lookup); | 2538 LookupPostInterceptor(holder, name, &lookup); |
2539 | 2539 |
2540 // Get the receiver from the stack. | 2540 // Get the receiver from the stack. |
2541 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); | 2541 __ movq(rdx, StackArgumentOperand((argc + 1) * kPointerSize)); |
2542 | 2542 |
2543 CallInterceptorCompiler compiler(this, arguments(), rcx, extra_state_); | 2543 CallInterceptorCompiler compiler(this, arguments(), rcx, extra_state_); |
2544 compiler.Compile(masm(), object, holder, name, &lookup, rdx, rbx, rdi, rax, | 2544 compiler.Compile(masm(), object, holder, name, &lookup, rdx, rbx, rdi, rax, |
2545 &miss); | 2545 &miss); |
2546 | 2546 |
2547 // Restore receiver. | 2547 // Restore receiver. |
2548 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); | 2548 __ movq(rdx, StackArgumentOperand((argc + 1) * kPointerSize)); |
2549 | 2549 |
2550 // Check that the function really is a function. | 2550 // Check that the function really is a function. |
2551 __ JumpIfSmi(rax, &miss); | 2551 __ JumpIfSmi(rax, &miss); |
2552 __ CmpObjectType(rax, JS_FUNCTION_TYPE, rbx); | 2552 __ CmpObjectType(rax, JS_FUNCTION_TYPE, rbx); |
2553 __ j(not_equal, &miss); | 2553 __ j(not_equal, &miss); |
2554 | 2554 |
2555 // Patch the receiver on the stack with the global proxy if | 2555 // Patch the receiver on the stack with the global proxy if |
2556 // necessary. | 2556 // necessary. |
2557 if (object->IsGlobalObject()) { | 2557 if (object->IsGlobalObject()) { |
2558 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset)); | 2558 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset)); |
2559 __ movq(Operand(rsp, (argc + 1) * kPointerSize), rdx); | 2559 __ movq(StackArgumentOperand((argc + 1) * kPointerSize), rdx); |
2560 } | 2560 } |
2561 | 2561 |
2562 // Invoke the function. | 2562 // Invoke the function. |
2563 __ movq(rdi, rax); | 2563 __ movq(rdi, rax); |
2564 CallKind call_kind = CallICBase::Contextual::decode(extra_state_) | 2564 CallKind call_kind = CallICBase::Contextual::decode(extra_state_) |
2565 ? CALL_AS_FUNCTION | 2565 ? CALL_AS_FUNCTION |
2566 : CALL_AS_METHOD; | 2566 : CALL_AS_METHOD; |
2567 __ InvokeFunction(rdi, arguments(), JUMP_FUNCTION, | 2567 __ InvokeFunction(rdi, arguments(), JUMP_FUNCTION, |
2568 NullCallWrapper(), call_kind); | 2568 NullCallWrapper(), call_kind); |
2569 | 2569 |
(...skipping 34 matching lines...) Loading... | |
2604 GenerateNameCheck(name, &miss); | 2604 GenerateNameCheck(name, &miss); |
2605 | 2605 |
2606 // Get the number of arguments. | 2606 // Get the number of arguments. |
2607 const int argc = arguments().immediate(); | 2607 const int argc = arguments().immediate(); |
2608 GenerateGlobalReceiverCheck(object, holder, name, &miss); | 2608 GenerateGlobalReceiverCheck(object, holder, name, &miss); |
2609 GenerateLoadFunctionFromCell(cell, function, &miss); | 2609 GenerateLoadFunctionFromCell(cell, function, &miss); |
2610 | 2610 |
2611 // Patch the receiver on the stack with the global proxy. | 2611 // Patch the receiver on the stack with the global proxy. |
2612 if (object->IsGlobalObject()) { | 2612 if (object->IsGlobalObject()) { |
2613 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset)); | 2613 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset)); |
2614 __ movq(Operand(rsp, (argc + 1) * kPointerSize), rdx); | 2614 __ movq(StackArgumentOperand((argc + 1) * kPointerSize), rdx); |
2615 } | 2615 } |
2616 | 2616 |
2617 // Set up the context (function already in rdi). | 2617 // Set up the context (function already in rdi). |
2618 __ movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); | 2618 __ movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); |
2619 | 2619 |
2620 // Jump to the cached code (tail call). | 2620 // Jump to the cached code (tail call). |
2621 Counters* counters = isolate()->counters(); | 2621 Counters* counters = isolate()->counters(); |
2622 __ IncrementCounter(counters->call_global_inline(), 1); | 2622 __ IncrementCounter(counters->call_global_inline(), 1); |
2623 ParameterCount expected(function->shared()->formal_parameter_count()); | 2623 ParameterCount expected(function->shared()->formal_parameter_count()); |
2624 CallKind call_kind = CallICBase::Contextual::decode(extra_state_) | 2624 CallKind call_kind = CallICBase::Contextual::decode(extra_state_) |
(...skipping 889 matching lines...) Loading... | |
3514 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); | 3514 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); |
3515 } | 3515 } |
3516 } | 3516 } |
3517 | 3517 |
3518 | 3518 |
3519 #undef __ | 3519 #undef __ |
3520 | 3520 |
3521 } } // namespace v8::internal | 3521 } } // namespace v8::internal |
3522 | 3522 |
3523 #endif // V8_TARGET_ARCH_X64 | 3523 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |