| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 980 __ bind(&miss); | 980 __ bind(&miss); |
| 981 __ IncrementCounter(&Counters::call_global_inline_miss, 1); | 981 __ IncrementCounter(&Counters::call_global_inline_miss, 1); |
| 982 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); | 982 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); |
| 983 __ Jump(ic, RelocInfo::CODE_TARGET); | 983 __ Jump(ic, RelocInfo::CODE_TARGET); |
| 984 | 984 |
| 985 // Return the generated code. | 985 // Return the generated code. |
| 986 return GetCode(NORMAL, name); | 986 return GetCode(NORMAL, name); |
| 987 } | 987 } |
| 988 | 988 |
| 989 | 989 |
| 990 Object* LoadStubCompiler::CompileLoadCallback(JSObject* object, | 990 Object* LoadStubCompiler::CompileLoadCallback(String* name, |
| 991 JSObject* object, |
| 991 JSObject* holder, | 992 JSObject* holder, |
| 992 AccessorInfo* callback, | 993 AccessorInfo* callback) { |
| 993 String* name) { | |
| 994 // ----------- S t a t e ------------- | 994 // ----------- S t a t e ------------- |
| 995 // -- rcx : name | 995 // -- rcx : name |
| 996 // -- rsp[0] : return address | 996 // -- rsp[0] : return address |
| 997 // -- rsp[8] : receiver | 997 // -- rsp[8] : receiver |
| 998 // ----------------------------------- | 998 // ----------------------------------- |
| 999 Label miss; | 999 Label miss; |
| 1000 | 1000 |
| 1001 __ movq(rax, Operand(rsp, kPointerSize)); | 1001 __ movq(rax, Operand(rsp, kPointerSize)); |
| 1002 GenerateLoadCallback(object, holder, rax, rcx, rbx, rdx, | 1002 Failure* failure = Failure::InternalError(); |
| 1003 callback, name, &miss); | 1003 bool success = GenerateLoadCallback(object, holder, rax, rcx, rbx, rdx, |
| 1004 callback, name, &miss, &failure); |
| 1005 if (!success) return failure; |
| 1006 |
| 1004 __ bind(&miss); | 1007 __ bind(&miss); |
| 1005 GenerateLoadMiss(masm(), Code::LOAD_IC); | 1008 GenerateLoadMiss(masm(), Code::LOAD_IC); |
| 1006 | 1009 |
| 1007 // Return the generated code. | 1010 // Return the generated code. |
| 1008 return GetCode(CALLBACKS, name); | 1011 return GetCode(CALLBACKS, name); |
| 1009 } | 1012 } |
| 1010 | 1013 |
| 1011 | 1014 |
| 1012 Object* LoadStubCompiler::CompileLoadConstant(JSObject* object, | 1015 Object* LoadStubCompiler::CompileLoadConstant(JSObject* object, |
| 1013 JSObject* holder, | 1016 JSObject* holder, |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1147 Label miss; | 1150 Label miss; |
| 1148 | 1151 |
| 1149 __ movq(rax, Operand(rsp, kPointerSize)); | 1152 __ movq(rax, Operand(rsp, kPointerSize)); |
| 1150 __ movq(rcx, Operand(rsp, 2 * kPointerSize)); | 1153 __ movq(rcx, Operand(rsp, 2 * kPointerSize)); |
| 1151 __ IncrementCounter(&Counters::keyed_load_callback, 1); | 1154 __ IncrementCounter(&Counters::keyed_load_callback, 1); |
| 1152 | 1155 |
| 1153 // Check that the name has not changed. | 1156 // Check that the name has not changed. |
| 1154 __ Cmp(rax, Handle<String>(name)); | 1157 __ Cmp(rax, Handle<String>(name)); |
| 1155 __ j(not_equal, &miss); | 1158 __ j(not_equal, &miss); |
| 1156 | 1159 |
| 1157 GenerateLoadCallback(receiver, holder, rcx, rax, rbx, rdx, | 1160 Failure* failure = Failure::InternalError(); |
| 1158 callback, name, &miss); | 1161 bool success = GenerateLoadCallback(receiver, holder, rcx, rax, rbx, rdx, |
| 1162 callback, name, &miss, &failure); |
| 1163 if (!success) return failure; |
| 1164 |
| 1159 __ bind(&miss); | 1165 __ bind(&miss); |
| 1160 __ DecrementCounter(&Counters::keyed_load_callback, 1); | 1166 __ DecrementCounter(&Counters::keyed_load_callback, 1); |
| 1161 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 1167 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
| 1162 | 1168 |
| 1163 // Return the generated code. | 1169 // Return the generated code. |
| 1164 return GetCode(CALLBACKS, name); | 1170 return GetCode(CALLBACKS, name); |
| 1165 } | 1171 } |
| 1166 | 1172 |
| 1167 | 1173 |
| 1168 Object* KeyedLoadStubCompiler::CompileLoadArrayLength(String* name) { | 1174 Object* KeyedLoadStubCompiler::CompileLoadArrayLength(String* name) { |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1603 holder, | 1609 holder, |
| 1604 name, | 1610 name, |
| 1605 lookup, | 1611 lookup, |
| 1606 receiver, | 1612 receiver, |
| 1607 scratch1, | 1613 scratch1, |
| 1608 scratch2, | 1614 scratch2, |
| 1609 miss); | 1615 miss); |
| 1610 } | 1616 } |
| 1611 | 1617 |
| 1612 | 1618 |
| 1613 void StubCompiler::GenerateLoadCallback(JSObject* object, | 1619 bool StubCompiler::GenerateLoadCallback(JSObject* object, |
| 1614 JSObject* holder, | 1620 JSObject* holder, |
| 1615 Register receiver, | 1621 Register receiver, |
| 1616 Register name_reg, | 1622 Register name_reg, |
| 1617 Register scratch1, | 1623 Register scratch1, |
| 1618 Register scratch2, | 1624 Register scratch2, |
| 1619 AccessorInfo* callback, | 1625 AccessorInfo* callback, |
| 1620 String* name, | 1626 String* name, |
| 1621 Label* miss) { | 1627 Label* miss, |
| 1628 Failure** failure) { |
| 1622 // Check that the receiver isn't a smi. | 1629 // Check that the receiver isn't a smi. |
| 1623 __ JumpIfSmi(receiver, miss); | 1630 __ JumpIfSmi(receiver, miss); |
| 1624 | 1631 |
| 1625 // Check that the maps haven't changed. | 1632 // Check that the maps haven't changed. |
| 1626 Register reg = | 1633 Register reg = |
| 1627 CheckPrototypes(object, receiver, holder, | 1634 CheckPrototypes(object, receiver, holder, |
| 1628 scratch1, scratch2, name, miss); | 1635 scratch1, scratch2, name, miss); |
| 1629 | 1636 |
| 1630 // Push the arguments on the JS stack of the caller. | 1637 // Push the arguments on the JS stack of the caller. |
| 1631 __ pop(scratch2); // remove return address | 1638 __ pop(scratch2); // remove return address |
| 1632 __ push(receiver); // receiver | 1639 __ push(receiver); // receiver |
| 1633 __ push(reg); // holder | 1640 __ push(reg); // holder |
| 1634 __ Move(reg, Handle<AccessorInfo>(callback)); // callback data | 1641 __ Move(reg, Handle<AccessorInfo>(callback)); // callback data |
| 1635 __ push(reg); | 1642 __ push(reg); |
| 1636 __ push(FieldOperand(reg, AccessorInfo::kDataOffset)); | 1643 __ push(FieldOperand(reg, AccessorInfo::kDataOffset)); |
| 1637 __ push(name_reg); // name | 1644 __ push(name_reg); // name |
| 1638 __ push(scratch2); // restore return address | 1645 __ push(scratch2); // restore return address |
| 1639 | 1646 |
| 1640 // Do tail-call to the runtime system. | 1647 // Do tail-call to the runtime system. |
| 1641 ExternalReference load_callback_property = | 1648 ExternalReference load_callback_property = |
| 1642 ExternalReference(IC_Utility(IC::kLoadCallbackProperty)); | 1649 ExternalReference(IC_Utility(IC::kLoadCallbackProperty)); |
| 1643 __ TailCallRuntime(load_callback_property, 5, 1); | 1650 __ TailCallRuntime(load_callback_property, 5, 1); |
| 1651 |
| 1652 return true; |
| 1644 } | 1653 } |
| 1645 | 1654 |
| 1646 | 1655 |
| 1647 Register StubCompiler::CheckPrototypes(JSObject* object, | 1656 Register StubCompiler::CheckPrototypes(JSObject* object, |
| 1648 Register object_reg, | 1657 Register object_reg, |
| 1649 JSObject* holder, | 1658 JSObject* holder, |
| 1650 Register holder_reg, | 1659 Register holder_reg, |
| 1651 Register scratch, | 1660 Register scratch, |
| 1652 String* name, | 1661 String* name, |
| 1653 Label* miss) { | 1662 Label* miss) { |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1852 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); | 1861 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); |
| 1853 | 1862 |
| 1854 // Return the generated code. | 1863 // Return the generated code. |
| 1855 return GetCode(); | 1864 return GetCode(); |
| 1856 } | 1865 } |
| 1857 | 1866 |
| 1858 | 1867 |
| 1859 #undef __ | 1868 #undef __ |
| 1860 | 1869 |
| 1861 } } // namespace v8::internal | 1870 } } // namespace v8::internal |
| OLD | NEW |