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 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 // These arguments are set by CheckPrototypes and GenerateFastApiCall. | 407 // These arguments are set by CheckPrototypes and GenerateFastApiCall. |
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, StackOperandForReturnAddress(0)); | 413 __ movq(scratch, StackOperandForReturnAddress(0)); |
414 __ subq(rsp, Immediate(kFastApiCallArguments * kPointerSize)); | 414 __ subq(rsp, Immediate(kFastApiCallArguments * kPointerSize)); |
415 __ movq(StackOperandForReturnAddress(0), scratch); | 415 __ movq(StackOperandForReturnAddress(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 = 0; i < kFastApiCallArguments; i++) { |
418 __ movq(Operand(rsp, i * kPointerSize), scratch); | 418 __ movq(StackOperandForReversedArgument(i), 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 29 matching lines...) Expand all Loading... |
458 // -- ... | 458 // -- ... |
459 // -- rsp[(argc + 6) * 8] : first argument | 459 // -- rsp[(argc + 6) * 8] : first argument |
460 // -- rsp[(argc + 7) * 8] : receiver | 460 // -- rsp[(argc + 7) * 8] : receiver |
461 // ----------------------------------- | 461 // ----------------------------------- |
462 // Get the function and setup the context. | 462 // Get the function and setup the context. |
463 Handle<JSFunction> function = optimization.constant_function(); | 463 Handle<JSFunction> function = optimization.constant_function(); |
464 __ LoadHeapObject(rdi, function); | 464 __ LoadHeapObject(rdi, function); |
465 __ movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); | 465 __ movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); |
466 | 466 |
467 // Pass the additional arguments. | 467 // Pass the additional arguments. |
468 __ movq(Operand(rsp, 2 * kPointerSize), rdi); | 468 __ movq(StackOperandForReversedArgument(1), rdi); |
469 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info(); | 469 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info(); |
470 Handle<Object> call_data(api_call_info->data(), masm->isolate()); | 470 Handle<Object> call_data(api_call_info->data(), masm->isolate()); |
471 if (masm->isolate()->heap()->InNewSpace(*call_data)) { | 471 if (masm->isolate()->heap()->InNewSpace(*call_data)) { |
472 __ Move(rcx, api_call_info); | 472 __ Move(rcx, api_call_info); |
473 __ movq(rbx, FieldOperand(rcx, CallHandlerInfo::kDataOffset)); | 473 __ movq(rbx, FieldOperand(rcx, CallHandlerInfo::kDataOffset)); |
474 __ movq(Operand(rsp, 3 * kPointerSize), rbx); | 474 __ movq(StackOperandForReversedArgument(2), rbx); |
475 } else { | 475 } else { |
476 __ Move(Operand(rsp, 3 * kPointerSize), call_data); | 476 __ Move(StackOperandForReversedArgument(2), call_data); |
477 } | 477 } |
478 __ movq(kScratchRegister, | 478 __ movq(kScratchRegister, |
479 ExternalReference::isolate_address(masm->isolate())); | 479 ExternalReference::isolate_address(masm->isolate())); |
480 __ movq(Operand(rsp, 4 * kPointerSize), kScratchRegister); | 480 __ movq(StackOperandForReversedArgument(3), kScratchRegister); |
481 __ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex); | 481 __ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex); |
482 __ movq(Operand(rsp, 5 * kPointerSize), kScratchRegister); | 482 __ movq(StackOperandForReversedArgument(4), kScratchRegister); |
483 __ movq(Operand(rsp, 6 * kPointerSize), kScratchRegister); | 483 __ movq(StackOperandForReversedArgument(5), kScratchRegister); |
484 | 484 |
485 // Prepare arguments. | 485 // Prepare arguments. |
486 STATIC_ASSERT(kFastApiCallArguments == 6); | 486 STATIC_ASSERT(kFastApiCallArguments == 6); |
487 __ lea(rbx, Operand(rsp, kFastApiCallArguments * kPointerSize)); | 487 __ lea(rbx, Operand(rsp, kFastApiCallArguments * kPointerSize)); |
488 | 488 |
489 // Function address is a foreign pointer outside V8's heap. | 489 // Function address is a foreign pointer outside V8's heap. |
490 Address function_address = v8::ToCData<Address>(api_call_info->callback()); | 490 Address function_address = v8::ToCData<Address>(api_call_info->callback()); |
491 bool returns_handle = | 491 bool returns_handle = |
492 !CallbackTable::ReturnsVoid(masm->isolate(), function_address); | 492 !CallbackTable::ReturnsVoid(masm->isolate(), function_address); |
493 | 493 |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1068 ASSERT(!scratch2.is(object_reg) && !scratch2.is(holder_reg) | 1068 ASSERT(!scratch2.is(object_reg) && !scratch2.is(holder_reg) |
1069 && !scratch2.is(scratch1)); | 1069 && !scratch2.is(scratch1)); |
1070 | 1070 |
1071 // Keep track of the current object in register reg. On the first | 1071 // Keep track of the current object in register reg. On the first |
1072 // iteration, reg is an alias for object_reg, on later iterations, | 1072 // iteration, reg is an alias for object_reg, on later iterations, |
1073 // it is an alias for holder_reg. | 1073 // it is an alias for holder_reg. |
1074 Register reg = object_reg; | 1074 Register reg = object_reg; |
1075 int depth = 0; | 1075 int depth = 0; |
1076 | 1076 |
1077 if (save_at_depth == depth) { | 1077 if (save_at_depth == depth) { |
1078 __ movq(Operand(rsp, kPointerSize), object_reg); | 1078 __ movq(Operand(rsp, kPCOnStackSize), object_reg); |
1079 } | 1079 } |
1080 | 1080 |
1081 // Check the maps in the prototype chain. | 1081 // Check the maps in the prototype chain. |
1082 // Traverse the prototype chain from the object and do map checks. | 1082 // Traverse the prototype chain from the object and do map checks. |
1083 Handle<JSObject> current = object; | 1083 Handle<JSObject> current = object; |
1084 while (!current.is_identical_to(holder)) { | 1084 while (!current.is_identical_to(holder)) { |
1085 ++depth; | 1085 ++depth; |
1086 | 1086 |
1087 // Only global objects and objects that do not require access | 1087 // Only global objects and objects that do not require access |
1088 // checks are allowed in stubs. | 1088 // checks are allowed in stubs. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1128 // The prototype is in new space; we cannot store a reference to it | 1128 // The prototype is in new space; we cannot store a reference to it |
1129 // in the code. Load it from the map. | 1129 // in the code. Load it from the map. |
1130 __ movq(reg, FieldOperand(scratch1, Map::kPrototypeOffset)); | 1130 __ movq(reg, FieldOperand(scratch1, Map::kPrototypeOffset)); |
1131 } else { | 1131 } else { |
1132 // The prototype is in old space; load it directly. | 1132 // The prototype is in old space; load it directly. |
1133 __ Move(reg, prototype); | 1133 __ Move(reg, prototype); |
1134 } | 1134 } |
1135 } | 1135 } |
1136 | 1136 |
1137 if (save_at_depth == depth) { | 1137 if (save_at_depth == depth) { |
1138 __ movq(Operand(rsp, kPointerSize), reg); | 1138 __ movq(Operand(rsp, kPCOnStackSize), reg); |
1139 } | 1139 } |
1140 | 1140 |
1141 // Go to the next object in the prototype chain. | 1141 // Go to the next object in the prototype chain. |
1142 current = prototype; | 1142 current = prototype; |
1143 } | 1143 } |
1144 ASSERT(current.is_identical_to(holder)); | 1144 ASSERT(current.is_identical_to(holder)); |
1145 | 1145 |
1146 // Log the check depth. | 1146 // Log the check depth. |
1147 LOG(isolate(), IntEvent("check-maps-depth", depth + 1)); | 1147 LOG(isolate(), IntEvent("check-maps-depth", depth + 1)); |
1148 | 1148 |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1467 void CallStubCompiler::GenerateGlobalReceiverCheck(Handle<JSObject> object, | 1467 void CallStubCompiler::GenerateGlobalReceiverCheck(Handle<JSObject> object, |
1468 Handle<JSObject> holder, | 1468 Handle<JSObject> holder, |
1469 Handle<Name> name, | 1469 Handle<Name> name, |
1470 Label* miss) { | 1470 Label* miss) { |
1471 ASSERT(holder->IsGlobalObject()); | 1471 ASSERT(holder->IsGlobalObject()); |
1472 | 1472 |
1473 // Get the number of arguments. | 1473 // Get the number of arguments. |
1474 const int argc = arguments().immediate(); | 1474 const int argc = arguments().immediate(); |
1475 | 1475 |
1476 // Get the receiver from the stack. | 1476 // Get the receiver from the stack. |
1477 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); | 1477 __ movq(rdx, StackOperandForReceiver(argc)); |
1478 | 1478 |
1479 | 1479 |
1480 // Check that the maps haven't changed. | 1480 // Check that the maps haven't changed. |
1481 __ JumpIfSmi(rdx, miss); | 1481 __ JumpIfSmi(rdx, miss); |
1482 CheckPrototypes(object, rdx, holder, rbx, rax, rdi, name, miss); | 1482 CheckPrototypes(object, rdx, holder, rbx, rax, rdi, name, miss); |
1483 } | 1483 } |
1484 | 1484 |
1485 | 1485 |
1486 void CallStubCompiler::GenerateLoadFunctionFromCell( | 1486 void CallStubCompiler::GenerateLoadFunctionFromCell( |
1487 Handle<Cell> cell, | 1487 Handle<Cell> cell, |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1533 // ... | 1533 // ... |
1534 // rsp[argc * 8] : argument 1 | 1534 // rsp[argc * 8] : argument 1 |
1535 // rsp[(argc + 1) * 8] : argument 0 = receiver | 1535 // rsp[(argc + 1) * 8] : argument 0 = receiver |
1536 // ----------------------------------- | 1536 // ----------------------------------- |
1537 Label miss; | 1537 Label miss; |
1538 | 1538 |
1539 GenerateNameCheck(name, &miss); | 1539 GenerateNameCheck(name, &miss); |
1540 | 1540 |
1541 // Get the receiver from the stack. | 1541 // Get the receiver from the stack. |
1542 const int argc = arguments().immediate(); | 1542 const int argc = arguments().immediate(); |
1543 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); | 1543 __ movq(rdx, StackOperandForReceiver(argc)); |
1544 | 1544 |
1545 // Check that the receiver isn't a smi. | 1545 // Check that the receiver isn't a smi. |
1546 __ JumpIfSmi(rdx, &miss); | 1546 __ JumpIfSmi(rdx, &miss); |
1547 | 1547 |
1548 // Do the right check and compute the holder register. | 1548 // Do the right check and compute the holder register. |
1549 Register reg = CheckPrototypes(object, rdx, holder, rbx, rax, rdi, | 1549 Register reg = CheckPrototypes(object, rdx, holder, rbx, rax, rdi, |
1550 name, &miss); | 1550 name, &miss); |
1551 | 1551 |
1552 GenerateFastPropertyLoad(masm(), rdi, reg, index.is_inobject(holder), | 1552 GenerateFastPropertyLoad(masm(), rdi, reg, index.is_inobject(holder), |
1553 index.translate(holder), Representation::Tagged()); | 1553 index.translate(holder), Representation::Tagged()); |
1554 | 1554 |
1555 // Check that the function really is a function. | 1555 // Check that the function really is a function. |
1556 __ JumpIfSmi(rdi, &miss); | 1556 __ JumpIfSmi(rdi, &miss); |
1557 __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rbx); | 1557 __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rbx); |
1558 __ j(not_equal, &miss); | 1558 __ j(not_equal, &miss); |
1559 | 1559 |
1560 // Patch the receiver on the stack with the global proxy if | 1560 // Patch the receiver on the stack with the global proxy if |
1561 // necessary. | 1561 // necessary. |
1562 if (object->IsGlobalObject()) { | 1562 if (object->IsGlobalObject()) { |
1563 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset)); | 1563 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset)); |
1564 __ movq(Operand(rsp, (argc + 1) * kPointerSize), rdx); | 1564 __ movq(StackOperandForReceiver(argc), rdx); |
1565 } | 1565 } |
1566 | 1566 |
1567 // Invoke the function. | 1567 // Invoke the function. |
1568 CallKind call_kind = CallICBase::Contextual::decode(extra_state_) | 1568 CallKind call_kind = CallICBase::Contextual::decode(extra_state_) |
1569 ? CALL_AS_FUNCTION | 1569 ? CALL_AS_FUNCTION |
1570 : CALL_AS_METHOD; | 1570 : CALL_AS_METHOD; |
1571 __ InvokeFunction(rdi, arguments(), JUMP_FUNCTION, | 1571 __ InvokeFunction(rdi, arguments(), JUMP_FUNCTION, |
1572 NullCallWrapper(), call_kind); | 1572 NullCallWrapper(), call_kind); |
1573 | 1573 |
1574 // Handle call cache miss. | 1574 // Handle call cache miss. |
(...skipping 13 matching lines...) Expand all Loading... |
1588 Handle<String> name, | 1588 Handle<String> name, |
1589 Code::StubType type) { | 1589 Code::StubType type) { |
1590 Label miss; | 1590 Label miss; |
1591 | 1591 |
1592 // Check that function is still array | 1592 // Check that function is still array |
1593 const int argc = arguments().immediate(); | 1593 const int argc = arguments().immediate(); |
1594 GenerateNameCheck(name, &miss); | 1594 GenerateNameCheck(name, &miss); |
1595 | 1595 |
1596 if (cell.is_null()) { | 1596 if (cell.is_null()) { |
1597 // Get the receiver from the stack. | 1597 // Get the receiver from the stack. |
1598 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); | 1598 __ movq(rdx, StackOperandForReceiver(argc)); |
1599 | 1599 |
1600 // Check that the receiver isn't a smi. | 1600 // Check that the receiver isn't a smi. |
1601 __ JumpIfSmi(rdx, &miss); | 1601 __ JumpIfSmi(rdx, &miss); |
1602 CheckPrototypes(Handle<JSObject>::cast(object), rdx, holder, rbx, rax, rdi, | 1602 CheckPrototypes(Handle<JSObject>::cast(object), rdx, holder, rbx, rax, rdi, |
1603 name, &miss); | 1603 name, &miss); |
1604 } else { | 1604 } else { |
1605 ASSERT(cell->value() == *function); | 1605 ASSERT(cell->value() == *function); |
1606 GenerateGlobalReceiverCheck(Handle<JSObject>::cast(object), holder, name, | 1606 GenerateGlobalReceiverCheck(Handle<JSObject>::cast(object), holder, name, |
1607 &miss); | 1607 &miss); |
1608 GenerateLoadFunctionFromCell(cell, function, &miss); | 1608 GenerateLoadFunctionFromCell(cell, function, &miss); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1642 // ----------------------------------- | 1642 // ----------------------------------- |
1643 | 1643 |
1644 // If object is not an array, bail out to regular call. | 1644 // If object is not an array, bail out to regular call. |
1645 if (!object->IsJSArray() || !cell.is_null()) return Handle<Code>::null(); | 1645 if (!object->IsJSArray() || !cell.is_null()) return Handle<Code>::null(); |
1646 | 1646 |
1647 Label miss; | 1647 Label miss; |
1648 GenerateNameCheck(name, &miss); | 1648 GenerateNameCheck(name, &miss); |
1649 | 1649 |
1650 // Get the receiver from the stack. | 1650 // Get the receiver from the stack. |
1651 const int argc = arguments().immediate(); | 1651 const int argc = arguments().immediate(); |
1652 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); | 1652 __ movq(rdx, StackOperandForReceiver(argc)); |
1653 | 1653 |
1654 // Check that the receiver isn't a smi. | 1654 // Check that the receiver isn't a smi. |
1655 __ JumpIfSmi(rdx, &miss); | 1655 __ JumpIfSmi(rdx, &miss); |
1656 | 1656 |
1657 CheckPrototypes(Handle<JSObject>::cast(object), rdx, holder, rbx, rax, rdi, | 1657 CheckPrototypes(Handle<JSObject>::cast(object), rdx, holder, rbx, rax, rdi, |
1658 name, &miss); | 1658 name, &miss); |
1659 | 1659 |
1660 if (argc == 0) { | 1660 if (argc == 0) { |
1661 // Noop, return the length. | 1661 // Noop, return the length. |
1662 __ movq(rax, FieldOperand(rdx, JSArray::kLengthOffset)); | 1662 __ movq(rax, FieldOperand(rdx, JSArray::kLengthOffset)); |
(...skipping 18 matching lines...) Expand all Loading... |
1681 __ addl(rax, Immediate(argc)); | 1681 __ addl(rax, Immediate(argc)); |
1682 | 1682 |
1683 // Get the elements' length into rcx. | 1683 // Get the elements' length into rcx. |
1684 __ SmiToInteger32(rcx, FieldOperand(rdi, FixedArray::kLengthOffset)); | 1684 __ SmiToInteger32(rcx, FieldOperand(rdi, FixedArray::kLengthOffset)); |
1685 | 1685 |
1686 // Check if we could survive without allocation. | 1686 // Check if we could survive without allocation. |
1687 __ cmpl(rax, rcx); | 1687 __ cmpl(rax, rcx); |
1688 __ j(greater, &attempt_to_grow_elements); | 1688 __ j(greater, &attempt_to_grow_elements); |
1689 | 1689 |
1690 // Check if value is a smi. | 1690 // Check if value is a smi. |
1691 __ movq(rcx, Operand(rsp, argc * kPointerSize)); | 1691 __ movq(rcx, StackOperandForArgument(0, 1)); |
1692 __ JumpIfNotSmi(rcx, &with_write_barrier); | 1692 __ JumpIfNotSmi(rcx, &with_write_barrier); |
1693 | 1693 |
1694 // Save new length. | 1694 // Save new length. |
1695 __ Integer32ToSmiField(FieldOperand(rdx, JSArray::kLengthOffset), rax); | 1695 __ Integer32ToSmiField(FieldOperand(rdx, JSArray::kLengthOffset), rax); |
1696 | 1696 |
1697 // Store the value. | 1697 // Store the value. |
1698 __ movq(FieldOperand(rdi, | 1698 __ movq(FieldOperand(rdi, |
1699 rax, | 1699 rax, |
1700 times_pointer_size, | 1700 times_pointer_size, |
1701 FixedArray::kHeaderSize - argc * kPointerSize), | 1701 FixedArray::kHeaderSize - argc * kPointerSize), |
(...skipping 14 matching lines...) Expand all Loading... |
1716 STATIC_ASSERT(FixedArray::kMaxLength < Smi::kMaxValue); | 1716 STATIC_ASSERT(FixedArray::kMaxLength < Smi::kMaxValue); |
1717 __ addl(rax, Immediate(argc)); | 1717 __ addl(rax, Immediate(argc)); |
1718 | 1718 |
1719 // Get the elements' length into rcx. | 1719 // Get the elements' length into rcx. |
1720 __ SmiToInteger32(rcx, FieldOperand(rdi, FixedArray::kLengthOffset)); | 1720 __ SmiToInteger32(rcx, FieldOperand(rdi, FixedArray::kLengthOffset)); |
1721 | 1721 |
1722 // Check if we could survive without allocation. | 1722 // Check if we could survive without allocation. |
1723 __ cmpl(rax, rcx); | 1723 __ cmpl(rax, rcx); |
1724 __ j(greater, &call_builtin); | 1724 __ j(greater, &call_builtin); |
1725 | 1725 |
1726 __ movq(rcx, Operand(rsp, argc * kPointerSize)); | 1726 __ movq(rcx, StackOperandForArgument(0, 1)); |
1727 __ StoreNumberToDoubleElements( | 1727 __ StoreNumberToDoubleElements( |
1728 rcx, rdi, rax, xmm0, &call_builtin, argc * kDoubleSize); | 1728 rcx, rdi, rax, xmm0, &call_builtin, argc * kDoubleSize); |
1729 | 1729 |
1730 // Save new length. | 1730 // Save new length. |
1731 __ Integer32ToSmiField(FieldOperand(rdx, JSArray::kLengthOffset), rax); | 1731 __ Integer32ToSmiField(FieldOperand(rdx, JSArray::kLengthOffset), rax); |
1732 __ Integer32ToSmi(rax, rax); // Return new length as smi. | 1732 __ Integer32ToSmi(rax, rax); // Return new length as smi. |
1733 __ ret((argc + 1) * kPointerSize); | 1733 __ ret((argc + 1) * kPointerSize); |
1734 | 1734 |
1735 __ bind(&with_write_barrier); | 1735 __ bind(&with_write_barrier); |
1736 | 1736 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1793 OMIT_SMI_CHECK); | 1793 OMIT_SMI_CHECK); |
1794 | 1794 |
1795 __ Integer32ToSmi(rax, rax); // Return new length as smi. | 1795 __ Integer32ToSmi(rax, rax); // Return new length as smi. |
1796 __ ret((argc + 1) * kPointerSize); | 1796 __ ret((argc + 1) * kPointerSize); |
1797 | 1797 |
1798 __ bind(&attempt_to_grow_elements); | 1798 __ bind(&attempt_to_grow_elements); |
1799 if (!FLAG_inline_new) { | 1799 if (!FLAG_inline_new) { |
1800 __ jmp(&call_builtin); | 1800 __ jmp(&call_builtin); |
1801 } | 1801 } |
1802 | 1802 |
1803 __ movq(rbx, Operand(rsp, argc * kPointerSize)); | 1803 __ movq(rbx, StackOperandForArgument(0, 1)); |
1804 // Growing elements that are SMI-only requires special handling in case | 1804 // Growing elements that are SMI-only requires special handling in case |
1805 // the new element is non-Smi. For now, delegate to the builtin. | 1805 // the new element is non-Smi. For now, delegate to the builtin. |
1806 Label no_fast_elements_check; | 1806 Label no_fast_elements_check; |
1807 __ JumpIfSmi(rbx, &no_fast_elements_check); | 1807 __ JumpIfSmi(rbx, &no_fast_elements_check); |
1808 __ movq(rcx, FieldOperand(rdx, HeapObject::kMapOffset)); | 1808 __ movq(rcx, FieldOperand(rdx, HeapObject::kMapOffset)); |
1809 __ CheckFastObjectElements(rcx, &call_builtin, Label::kFar); | 1809 __ CheckFastObjectElements(rcx, &call_builtin, Label::kFar); |
1810 __ bind(&no_fast_elements_check); | 1810 __ bind(&no_fast_elements_check); |
1811 | 1811 |
1812 ExternalReference new_space_allocation_top = | 1812 ExternalReference new_space_allocation_top = |
1813 ExternalReference::new_space_allocation_top_address(isolate()); | 1813 ExternalReference::new_space_allocation_top_address(isolate()); |
(...skipping 28 matching lines...) Expand all Loading... |
1842 } | 1842 } |
1843 | 1843 |
1844 // We know the elements array is in new space so we don't need the | 1844 // We know the elements array is in new space so we don't need the |
1845 // remembered set, but we just pushed a value onto it so we may have to | 1845 // remembered set, but we just pushed a value onto it so we may have to |
1846 // tell the incremental marker to rescan the object that we just grew. We | 1846 // tell the incremental marker to rescan the object that we just grew. We |
1847 // don't need to worry about the holes because they are in old space and | 1847 // don't need to worry about the holes because they are in old space and |
1848 // already marked black. | 1848 // already marked black. |
1849 __ RecordWrite(rdi, rdx, rbx, kDontSaveFPRegs, OMIT_REMEMBERED_SET); | 1849 __ RecordWrite(rdi, rdx, rbx, kDontSaveFPRegs, OMIT_REMEMBERED_SET); |
1850 | 1850 |
1851 // Restore receiver to rdx as finish sequence assumes it's here. | 1851 // Restore receiver to rdx as finish sequence assumes it's here. |
1852 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); | 1852 __ movq(rdx, StackOperandForReceiver(argc)); |
1853 | 1853 |
1854 // Increment element's and array's sizes. | 1854 // Increment element's and array's sizes. |
1855 __ SmiAddConstant(FieldOperand(rdi, FixedArray::kLengthOffset), | 1855 __ SmiAddConstant(FieldOperand(rdi, FixedArray::kLengthOffset), |
1856 Smi::FromInt(kAllocationDelta)); | 1856 Smi::FromInt(kAllocationDelta)); |
1857 | 1857 |
1858 // Make new length a smi before returning it. | 1858 // Make new length a smi before returning it. |
1859 __ Integer32ToSmi(rax, rax); | 1859 __ Integer32ToSmi(rax, rax); |
1860 __ movq(FieldOperand(rdx, JSArray::kLengthOffset), rax); | 1860 __ movq(FieldOperand(rdx, JSArray::kLengthOffset), rax); |
1861 | 1861 |
1862 __ ret((argc + 1) * kPointerSize); | 1862 __ ret((argc + 1) * kPointerSize); |
(...skipping 30 matching lines...) Expand all Loading... |
1893 // ----------------------------------- | 1893 // ----------------------------------- |
1894 | 1894 |
1895 // If object is not an array, bail out to regular call. | 1895 // If object is not an array, bail out to regular call. |
1896 if (!object->IsJSArray() || !cell.is_null()) return Handle<Code>::null(); | 1896 if (!object->IsJSArray() || !cell.is_null()) return Handle<Code>::null(); |
1897 | 1897 |
1898 Label miss, return_undefined, call_builtin; | 1898 Label miss, return_undefined, call_builtin; |
1899 GenerateNameCheck(name, &miss); | 1899 GenerateNameCheck(name, &miss); |
1900 | 1900 |
1901 // Get the receiver from the stack. | 1901 // Get the receiver from the stack. |
1902 const int argc = arguments().immediate(); | 1902 const int argc = arguments().immediate(); |
1903 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); | 1903 __ movq(rdx, StackOperandForReceiver(argc)); |
1904 | 1904 |
1905 // Check that the receiver isn't a smi. | 1905 // Check that the receiver isn't a smi. |
1906 __ JumpIfSmi(rdx, &miss); | 1906 __ JumpIfSmi(rdx, &miss); |
1907 | 1907 |
1908 CheckPrototypes(Handle<JSObject>::cast(object), rdx, holder, rbx, rax, rdi, | 1908 CheckPrototypes(Handle<JSObject>::cast(object), rdx, holder, rbx, rax, rdi, |
1909 name, &miss); | 1909 name, &miss); |
1910 | 1910 |
1911 // Get the elements array of the object. | 1911 // Get the elements array of the object. |
1912 __ movq(rbx, FieldOperand(rdx, JSArray::kElementsOffset)); | 1912 __ movq(rbx, FieldOperand(rdx, JSArray::kElementsOffset)); |
1913 | 1913 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1996 rax, | 1996 rax, |
1997 &miss); | 1997 &miss); |
1998 ASSERT(!object.is_identical_to(holder)); | 1998 ASSERT(!object.is_identical_to(holder)); |
1999 CheckPrototypes( | 1999 CheckPrototypes( |
2000 Handle<JSObject>(JSObject::cast(object->GetPrototype(isolate()))), | 2000 Handle<JSObject>(JSObject::cast(object->GetPrototype(isolate()))), |
2001 rax, holder, rbx, rdx, rdi, name, &miss); | 2001 rax, holder, rbx, rdx, rdi, name, &miss); |
2002 | 2002 |
2003 Register receiver = rbx; | 2003 Register receiver = rbx; |
2004 Register index = rdi; | 2004 Register index = rdi; |
2005 Register result = rax; | 2005 Register result = rax; |
2006 __ movq(receiver, Operand(rsp, (argc + 1) * kPointerSize)); | 2006 __ movq(receiver, StackOperandForReceiver(argc)); |
2007 if (argc > 0) { | 2007 if (argc > 0) { |
2008 __ movq(index, Operand(rsp, (argc - 0) * kPointerSize)); | 2008 __ movq(index, StackOperandForArgument(1, argc + 1)); |
2009 } else { | 2009 } else { |
2010 __ LoadRoot(index, Heap::kUndefinedValueRootIndex); | 2010 __ LoadRoot(index, Heap::kUndefinedValueRootIndex); |
2011 } | 2011 } |
2012 | 2012 |
2013 StringCharCodeAtGenerator generator(receiver, | 2013 StringCharCodeAtGenerator generator(receiver, |
2014 index, | 2014 index, |
2015 result, | 2015 result, |
2016 &miss, // When not a string. | 2016 &miss, // When not a string. |
2017 &miss, // When not a number. | 2017 &miss, // When not a number. |
2018 index_out_of_range_label, | 2018 index_out_of_range_label, |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2077 &miss); | 2077 &miss); |
2078 ASSERT(!object.is_identical_to(holder)); | 2078 ASSERT(!object.is_identical_to(holder)); |
2079 CheckPrototypes( | 2079 CheckPrototypes( |
2080 Handle<JSObject>(JSObject::cast(object->GetPrototype(isolate()))), | 2080 Handle<JSObject>(JSObject::cast(object->GetPrototype(isolate()))), |
2081 rax, holder, rbx, rdx, rdi, name, &miss); | 2081 rax, holder, rbx, rdx, rdi, name, &miss); |
2082 | 2082 |
2083 Register receiver = rax; | 2083 Register receiver = rax; |
2084 Register index = rdi; | 2084 Register index = rdi; |
2085 Register scratch = rdx; | 2085 Register scratch = rdx; |
2086 Register result = rax; | 2086 Register result = rax; |
2087 __ movq(receiver, Operand(rsp, (argc + 1) * kPointerSize)); | 2087 __ movq(receiver, StackOperandForReceiver(argc)); |
2088 if (argc > 0) { | 2088 if (argc > 0) { |
2089 __ movq(index, Operand(rsp, (argc - 0) * kPointerSize)); | 2089 __ movq(index, StackOperandForArgument(1, argc + 1)); |
2090 } else { | 2090 } else { |
2091 __ LoadRoot(index, Heap::kUndefinedValueRootIndex); | 2091 __ LoadRoot(index, Heap::kUndefinedValueRootIndex); |
2092 } | 2092 } |
2093 | 2093 |
2094 StringCharAtGenerator generator(receiver, | 2094 StringCharAtGenerator generator(receiver, |
2095 index, | 2095 index, |
2096 scratch, | 2096 scratch, |
2097 result, | 2097 result, |
2098 &miss, // When not a string. | 2098 &miss, // When not a string. |
2099 &miss, // When not a number. | 2099 &miss, // When not a number. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2138 | 2138 |
2139 // If the object is not a JSObject or we got an unexpected number of | 2139 // If the object is not a JSObject or we got an unexpected number of |
2140 // arguments, bail out to the regular call. | 2140 // arguments, bail out to the regular call. |
2141 const int argc = arguments().immediate(); | 2141 const int argc = arguments().immediate(); |
2142 if (!object->IsJSObject() || argc != 1) return Handle<Code>::null(); | 2142 if (!object->IsJSObject() || argc != 1) return Handle<Code>::null(); |
2143 | 2143 |
2144 Label miss; | 2144 Label miss; |
2145 GenerateNameCheck(name, &miss); | 2145 GenerateNameCheck(name, &miss); |
2146 | 2146 |
2147 if (cell.is_null()) { | 2147 if (cell.is_null()) { |
2148 __ movq(rdx, Operand(rsp, 2 * kPointerSize)); | 2148 __ movq(rdx, StackOperandForReversedArgument(1)); |
2149 __ JumpIfSmi(rdx, &miss); | 2149 __ JumpIfSmi(rdx, &miss); |
2150 CheckPrototypes(Handle<JSObject>::cast(object), rdx, holder, rbx, rax, rdi, | 2150 CheckPrototypes(Handle<JSObject>::cast(object), rdx, holder, rbx, rax, rdi, |
2151 name, &miss); | 2151 name, &miss); |
2152 } else { | 2152 } else { |
2153 ASSERT(cell->value() == *function); | 2153 ASSERT(cell->value() == *function); |
2154 GenerateGlobalReceiverCheck(Handle<JSObject>::cast(object), holder, name, | 2154 GenerateGlobalReceiverCheck(Handle<JSObject>::cast(object), holder, name, |
2155 &miss); | 2155 &miss); |
2156 GenerateLoadFunctionFromCell(cell, function, &miss); | 2156 GenerateLoadFunctionFromCell(cell, function, &miss); |
2157 } | 2157 } |
2158 | 2158 |
2159 // Load the char code argument. | 2159 // Load the char code argument. |
2160 Register code = rbx; | 2160 Register code = rbx; |
2161 __ movq(code, Operand(rsp, 1 * kPointerSize)); | 2161 __ movq(code, StackOperandForReversedArgument(0)); |
2162 | 2162 |
2163 // Check the code is a smi. | 2163 // Check the code is a smi. |
2164 Label slow; | 2164 Label slow; |
2165 __ JumpIfNotSmi(code, &slow); | 2165 __ JumpIfNotSmi(code, &slow); |
2166 | 2166 |
2167 // Convert the smi code to uint16. | 2167 // Convert the smi code to uint16. |
2168 __ SmiAndConstant(code, code, Smi::FromInt(0xffff)); | 2168 __ SmiAndConstant(code, code, Smi::FromInt(0xffff)); |
2169 | 2169 |
2170 StringCharFromCodeGenerator generator(code, rax); | 2170 StringCharFromCodeGenerator generator(code, rax); |
2171 generator.GenerateFast(masm()); | 2171 generator.GenerateFast(masm()); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2222 | 2222 |
2223 // If the object is not a JSObject or we got an unexpected number of | 2223 // If the object is not a JSObject or we got an unexpected number of |
2224 // arguments, bail out to the regular call. | 2224 // arguments, bail out to the regular call. |
2225 const int argc = arguments().immediate(); | 2225 const int argc = arguments().immediate(); |
2226 if (!object->IsJSObject() || argc != 1) return Handle<Code>::null(); | 2226 if (!object->IsJSObject() || argc != 1) return Handle<Code>::null(); |
2227 | 2227 |
2228 Label miss; | 2228 Label miss; |
2229 GenerateNameCheck(name, &miss); | 2229 GenerateNameCheck(name, &miss); |
2230 | 2230 |
2231 if (cell.is_null()) { | 2231 if (cell.is_null()) { |
2232 __ movq(rdx, Operand(rsp, 2 * kPointerSize)); | 2232 __ movq(rdx, StackOperandForReversedArgument(1)); |
2233 __ JumpIfSmi(rdx, &miss); | 2233 __ JumpIfSmi(rdx, &miss); |
2234 CheckPrototypes(Handle<JSObject>::cast(object), rdx, holder, rbx, rax, rdi, | 2234 CheckPrototypes(Handle<JSObject>::cast(object), rdx, holder, rbx, rax, rdi, |
2235 name, &miss); | 2235 name, &miss); |
2236 } else { | 2236 } else { |
2237 ASSERT(cell->value() == *function); | 2237 ASSERT(cell->value() == *function); |
2238 GenerateGlobalReceiverCheck(Handle<JSObject>::cast(object), holder, name, | 2238 GenerateGlobalReceiverCheck(Handle<JSObject>::cast(object), holder, name, |
2239 &miss); | 2239 &miss); |
2240 GenerateLoadFunctionFromCell(cell, function, &miss); | 2240 GenerateLoadFunctionFromCell(cell, function, &miss); |
2241 } | 2241 } |
2242 // Load the (only) argument into rax. | 2242 // Load the (only) argument into rax. |
2243 __ movq(rax, Operand(rsp, 1 * kPointerSize)); | 2243 __ movq(rax, StackOperandForReversedArgument(0)); |
2244 | 2244 |
2245 // Check if the argument is a smi. | 2245 // Check if the argument is a smi. |
2246 Label not_smi; | 2246 Label not_smi; |
2247 STATIC_ASSERT(kSmiTag == 0); | 2247 STATIC_ASSERT(kSmiTag == 0); |
2248 __ JumpIfNotSmi(rax, ¬_smi); | 2248 __ JumpIfNotSmi(rax, ¬_smi); |
2249 __ SmiToInteger32(rax, rax); | 2249 __ SmiToInteger32(rax, rax); |
2250 | 2250 |
2251 // Set ebx to 1...1 (== -1) if the argument is negative, or to 0...0 | 2251 // Set ebx to 1...1 (== -1) if the argument is negative, or to 0...0 |
2252 // otherwise. | 2252 // otherwise. |
2253 __ movl(rbx, rax); | 2253 __ movl(rbx, rax); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2326 if (!object->IsJSObject()) return Handle<Code>::null(); | 2326 if (!object->IsJSObject()) return Handle<Code>::null(); |
2327 int depth = optimization.GetPrototypeDepthOfExpectedType( | 2327 int depth = optimization.GetPrototypeDepthOfExpectedType( |
2328 Handle<JSObject>::cast(object), holder); | 2328 Handle<JSObject>::cast(object), holder); |
2329 if (depth == kInvalidProtoDepth) return Handle<Code>::null(); | 2329 if (depth == kInvalidProtoDepth) return Handle<Code>::null(); |
2330 | 2330 |
2331 Label miss, miss_before_stack_reserved; | 2331 Label miss, miss_before_stack_reserved; |
2332 GenerateNameCheck(name, &miss_before_stack_reserved); | 2332 GenerateNameCheck(name, &miss_before_stack_reserved); |
2333 | 2333 |
2334 // Get the receiver from the stack. | 2334 // Get the receiver from the stack. |
2335 const int argc = arguments().immediate(); | 2335 const int argc = arguments().immediate(); |
2336 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); | 2336 __ movq(rdx, StackOperandForReceiver(argc)); |
2337 | 2337 |
2338 // Check that the receiver isn't a smi. | 2338 // Check that the receiver isn't a smi. |
2339 __ JumpIfSmi(rdx, &miss_before_stack_reserved); | 2339 __ JumpIfSmi(rdx, &miss_before_stack_reserved); |
2340 | 2340 |
2341 Counters* counters = isolate()->counters(); | 2341 Counters* counters = isolate()->counters(); |
2342 __ IncrementCounter(counters->call_const(), 1); | 2342 __ IncrementCounter(counters->call_const(), 1); |
2343 __ IncrementCounter(counters->call_const_fast_api(), 1); | 2343 __ IncrementCounter(counters->call_const_fast_api(), 1); |
2344 | 2344 |
2345 // Allocate space for v8::Arguments implicit values. Must be initialized | 2345 // Allocate space for v8::Arguments implicit values. Must be initialized |
2346 // before calling any runtime function. | 2346 // before calling any runtime function. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after 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, StackOperandForReceiver(argc)); |
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(StackOperandForReceiver(argc), 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...) Expand 10 before | Expand all | Expand 10 after 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, StackOperandForReceiver(argc)); |
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, StackOperandForReceiver(argc)); |
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(StackOperandForReceiver(argc), 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...) Expand 10 before | Expand all | Expand 10 after 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(StackOperandForReceiver(argc), 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...) Expand 10 before | Expand all | Expand 10 after 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 |