| 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 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 734 // property. | 734 // property. |
| 735 static void GenerateCheckPropertyCell(MacroAssembler* masm, | 735 static void GenerateCheckPropertyCell(MacroAssembler* masm, |
| 736 Handle<GlobalObject> global, | 736 Handle<GlobalObject> global, |
| 737 Handle<Name> name, | 737 Handle<Name> name, |
| 738 Register scratch, | 738 Register scratch, |
| 739 Label* miss) { | 739 Label* miss) { |
| 740 Handle<JSGlobalPropertyCell> cell = | 740 Handle<JSGlobalPropertyCell> cell = |
| 741 GlobalObject::EnsurePropertyCell(global, name); | 741 GlobalObject::EnsurePropertyCell(global, name); |
| 742 ASSERT(cell->value()->IsTheHole()); | 742 ASSERT(cell->value()->IsTheHole()); |
| 743 __ Move(scratch, cell); | 743 __ Move(scratch, cell); |
| 744 __ Cmp(FieldOperand(scratch, JSGlobalPropertyCell::kValueOffset), | 744 __ Cmp(FieldOperand(scratch, Cell::kValueOffset), |
| 745 masm->isolate()->factory()->the_hole_value()); | 745 masm->isolate()->factory()->the_hole_value()); |
| 746 __ j(not_equal, miss); | 746 __ j(not_equal, miss); |
| 747 } | 747 } |
| 748 | 748 |
| 749 | 749 |
| 750 // Both name_reg and receiver_reg are preserved on jumps to miss_label, | 750 // Both name_reg and receiver_reg are preserved on jumps to miss_label, |
| 751 // but may be destroyed if store is successful. | 751 // but may be destroyed if store is successful. |
| 752 void StubCompiler::GenerateStoreTransition(MacroAssembler* masm, | 752 void StubCompiler::GenerateStoreTransition(MacroAssembler* masm, |
| 753 Handle<JSObject> object, | 753 Handle<JSObject> object, |
| 754 LookupResult* lookup, | 754 LookupResult* lookup, |
| (...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1478 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); | 1478 __ movq(rdx, Operand(rsp, (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<JSGlobalPropertyCell> cell, | 1488 Handle<Cell> cell, |
| 1489 Handle<JSFunction> function, | 1489 Handle<JSFunction> function, |
| 1490 Label* miss) { | 1490 Label* miss) { |
| 1491 // Get the value from the cell. | 1491 // Get the value from the cell. |
| 1492 __ Move(rdi, cell); | 1492 __ Move(rdi, cell); |
| 1493 __ movq(rdi, FieldOperand(rdi, JSGlobalPropertyCell::kValueOffset)); | 1493 __ movq(rdi, FieldOperand(rdi, Cell::kValueOffset)); |
| 1494 | 1494 |
| 1495 // Check that the cell contains the same function. | 1495 // Check that the cell contains the same function. |
| 1496 if (heap()->InNewSpace(*function)) { | 1496 if (heap()->InNewSpace(*function)) { |
| 1497 // We can't embed a pointer to a function in new space so we have | 1497 // We can't embed a pointer to a function in new space so we have |
| 1498 // to verify that the shared function info is unchanged. This has | 1498 // to verify that the shared function info is unchanged. This has |
| 1499 // the nice side effect that multiple closures based on the same | 1499 // the nice side effect that multiple closures based on the same |
| 1500 // function can all use this call IC. Before we load through the | 1500 // function can all use this call IC. Before we load through the |
| 1501 // function, we have to verify that it still is a function. | 1501 // function, we have to verify that it still is a function. |
| 1502 __ JumpIfSmi(rdi, miss); | 1502 __ JumpIfSmi(rdi, miss); |
| 1503 __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rax); | 1503 __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rax); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1577 GenerateMissBranch(); | 1577 GenerateMissBranch(); |
| 1578 | 1578 |
| 1579 // Return the generated code. | 1579 // Return the generated code. |
| 1580 return GetCode(Code::FIELD, name); | 1580 return GetCode(Code::FIELD, name); |
| 1581 } | 1581 } |
| 1582 | 1582 |
| 1583 | 1583 |
| 1584 Handle<Code> CallStubCompiler::CompileArrayPushCall( | 1584 Handle<Code> CallStubCompiler::CompileArrayPushCall( |
| 1585 Handle<Object> object, | 1585 Handle<Object> object, |
| 1586 Handle<JSObject> holder, | 1586 Handle<JSObject> holder, |
| 1587 Handle<JSGlobalPropertyCell> cell, | 1587 Handle<Cell> cell, |
| 1588 Handle<JSFunction> function, | 1588 Handle<JSFunction> function, |
| 1589 Handle<String> name) { | 1589 Handle<String> name) { |
| 1590 // ----------- S t a t e ------------- | 1590 // ----------- S t a t e ------------- |
| 1591 // -- rcx : name | 1591 // -- rcx : name |
| 1592 // -- rsp[0] : return address | 1592 // -- rsp[0] : return address |
| 1593 // -- rsp[(argc - n) * 8] : arg[n] (zero-based) | 1593 // -- rsp[(argc - n) * 8] : arg[n] (zero-based) |
| 1594 // -- ... | 1594 // -- ... |
| 1595 // -- rsp[(argc + 1) * 8] : receiver | 1595 // -- rsp[(argc + 1) * 8] : receiver |
| 1596 // ----------------------------------- | 1596 // ----------------------------------- |
| 1597 | 1597 |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1827 GenerateMissBranch(); | 1827 GenerateMissBranch(); |
| 1828 | 1828 |
| 1829 // Return the generated code. | 1829 // Return the generated code. |
| 1830 return GetCode(function); | 1830 return GetCode(function); |
| 1831 } | 1831 } |
| 1832 | 1832 |
| 1833 | 1833 |
| 1834 Handle<Code> CallStubCompiler::CompileArrayPopCall( | 1834 Handle<Code> CallStubCompiler::CompileArrayPopCall( |
| 1835 Handle<Object> object, | 1835 Handle<Object> object, |
| 1836 Handle<JSObject> holder, | 1836 Handle<JSObject> holder, |
| 1837 Handle<JSGlobalPropertyCell> cell, | 1837 Handle<Cell> cell, |
| 1838 Handle<JSFunction> function, | 1838 Handle<JSFunction> function, |
| 1839 Handle<String> name) { | 1839 Handle<String> name) { |
| 1840 // ----------- S t a t e ------------- | 1840 // ----------- S t a t e ------------- |
| 1841 // -- rcx : name | 1841 // -- rcx : name |
| 1842 // -- rsp[0] : return address | 1842 // -- rsp[0] : return address |
| 1843 // -- rsp[(argc - n) * 8] : arg[n] (zero-based) | 1843 // -- rsp[(argc - n) * 8] : arg[n] (zero-based) |
| 1844 // -- ... | 1844 // -- ... |
| 1845 // -- rsp[(argc + 1) * 8] : receiver | 1845 // -- rsp[(argc + 1) * 8] : receiver |
| 1846 // ----------------------------------- | 1846 // ----------------------------------- |
| 1847 | 1847 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1908 GenerateMissBranch(); | 1908 GenerateMissBranch(); |
| 1909 | 1909 |
| 1910 // Return the generated code. | 1910 // Return the generated code. |
| 1911 return GetCode(function); | 1911 return GetCode(function); |
| 1912 } | 1912 } |
| 1913 | 1913 |
| 1914 | 1914 |
| 1915 Handle<Code> CallStubCompiler::CompileStringCharCodeAtCall( | 1915 Handle<Code> CallStubCompiler::CompileStringCharCodeAtCall( |
| 1916 Handle<Object> object, | 1916 Handle<Object> object, |
| 1917 Handle<JSObject> holder, | 1917 Handle<JSObject> holder, |
| 1918 Handle<JSGlobalPropertyCell> cell, | 1918 Handle<Cell> cell, |
| 1919 Handle<JSFunction> function, | 1919 Handle<JSFunction> function, |
| 1920 Handle<String> name) { | 1920 Handle<String> name) { |
| 1921 // ----------- S t a t e ------------- | 1921 // ----------- S t a t e ------------- |
| 1922 // -- rcx : function name | 1922 // -- rcx : function name |
| 1923 // -- rsp[0] : return address | 1923 // -- rsp[0] : return address |
| 1924 // -- rsp[(argc - n) * 8] : arg[n] (zero-based) | 1924 // -- rsp[(argc - n) * 8] : arg[n] (zero-based) |
| 1925 // -- ... | 1925 // -- ... |
| 1926 // -- rsp[(argc + 1) * 8] : receiver | 1926 // -- rsp[(argc + 1) * 8] : receiver |
| 1927 // ----------------------------------- | 1927 // ----------------------------------- |
| 1928 | 1928 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1988 GenerateMissBranch(); | 1988 GenerateMissBranch(); |
| 1989 | 1989 |
| 1990 // Return the generated code. | 1990 // Return the generated code. |
| 1991 return GetCode(function); | 1991 return GetCode(function); |
| 1992 } | 1992 } |
| 1993 | 1993 |
| 1994 | 1994 |
| 1995 Handle<Code> CallStubCompiler::CompileStringCharAtCall( | 1995 Handle<Code> CallStubCompiler::CompileStringCharAtCall( |
| 1996 Handle<Object> object, | 1996 Handle<Object> object, |
| 1997 Handle<JSObject> holder, | 1997 Handle<JSObject> holder, |
| 1998 Handle<JSGlobalPropertyCell> cell, | 1998 Handle<Cell> cell, |
| 1999 Handle<JSFunction> function, | 1999 Handle<JSFunction> function, |
| 2000 Handle<String> name) { | 2000 Handle<String> name) { |
| 2001 // ----------- S t a t e ------------- | 2001 // ----------- S t a t e ------------- |
| 2002 // -- rcx : function name | 2002 // -- rcx : function name |
| 2003 // -- rsp[0] : return address | 2003 // -- rsp[0] : return address |
| 2004 // -- rsp[(argc - n) * 8] : arg[n] (zero-based) | 2004 // -- rsp[(argc - n) * 8] : arg[n] (zero-based) |
| 2005 // -- ... | 2005 // -- ... |
| 2006 // -- rsp[(argc + 1) * 8] : receiver | 2006 // -- rsp[(argc + 1) * 8] : receiver |
| 2007 // ----------------------------------- | 2007 // ----------------------------------- |
| 2008 | 2008 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2068 GenerateMissBranch(); | 2068 GenerateMissBranch(); |
| 2069 | 2069 |
| 2070 // Return the generated code. | 2070 // Return the generated code. |
| 2071 return GetCode(function); | 2071 return GetCode(function); |
| 2072 } | 2072 } |
| 2073 | 2073 |
| 2074 | 2074 |
| 2075 Handle<Code> CallStubCompiler::CompileStringFromCharCodeCall( | 2075 Handle<Code> CallStubCompiler::CompileStringFromCharCodeCall( |
| 2076 Handle<Object> object, | 2076 Handle<Object> object, |
| 2077 Handle<JSObject> holder, | 2077 Handle<JSObject> holder, |
| 2078 Handle<JSGlobalPropertyCell> cell, | 2078 Handle<Cell> cell, |
| 2079 Handle<JSFunction> function, | 2079 Handle<JSFunction> function, |
| 2080 Handle<String> name) { | 2080 Handle<String> name) { |
| 2081 // ----------- S t a t e ------------- | 2081 // ----------- S t a t e ------------- |
| 2082 // -- rcx : function name | 2082 // -- rcx : function name |
| 2083 // -- rsp[0] : return address | 2083 // -- rsp[0] : return address |
| 2084 // -- rsp[(argc - n) * 8] : arg[n] (zero-based) | 2084 // -- rsp[(argc - n) * 8] : arg[n] (zero-based) |
| 2085 // -- ... | 2085 // -- ... |
| 2086 // -- rsp[(argc + 1) * 8] : receiver | 2086 // -- rsp[(argc + 1) * 8] : receiver |
| 2087 // ----------------------------------- | 2087 // ----------------------------------- |
| 2088 | 2088 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2139 GenerateMissBranch(); | 2139 GenerateMissBranch(); |
| 2140 | 2140 |
| 2141 // Return the generated code. | 2141 // Return the generated code. |
| 2142 return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name); | 2142 return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name); |
| 2143 } | 2143 } |
| 2144 | 2144 |
| 2145 | 2145 |
| 2146 Handle<Code> CallStubCompiler::CompileMathFloorCall( | 2146 Handle<Code> CallStubCompiler::CompileMathFloorCall( |
| 2147 Handle<Object> object, | 2147 Handle<Object> object, |
| 2148 Handle<JSObject> holder, | 2148 Handle<JSObject> holder, |
| 2149 Handle<JSGlobalPropertyCell> cell, | 2149 Handle<Cell> cell, |
| 2150 Handle<JSFunction> function, | 2150 Handle<JSFunction> function, |
| 2151 Handle<String> name) { | 2151 Handle<String> name) { |
| 2152 // TODO(872): implement this. | 2152 // TODO(872): implement this. |
| 2153 return Handle<Code>::null(); | 2153 return Handle<Code>::null(); |
| 2154 } | 2154 } |
| 2155 | 2155 |
| 2156 | 2156 |
| 2157 Handle<Code> CallStubCompiler::CompileMathAbsCall( | 2157 Handle<Code> CallStubCompiler::CompileMathAbsCall( |
| 2158 Handle<Object> object, | 2158 Handle<Object> object, |
| 2159 Handle<JSObject> holder, | 2159 Handle<JSObject> holder, |
| 2160 Handle<JSGlobalPropertyCell> cell, | 2160 Handle<Cell> cell, |
| 2161 Handle<JSFunction> function, | 2161 Handle<JSFunction> function, |
| 2162 Handle<String> name) { | 2162 Handle<String> name) { |
| 2163 // ----------- S t a t e ------------- | 2163 // ----------- S t a t e ------------- |
| 2164 // -- rcx : function name | 2164 // -- rcx : function name |
| 2165 // -- rsp[0] : return address | 2165 // -- rsp[0] : return address |
| 2166 // -- rsp[(argc - n) * 8] : arg[n] (zero-based) | 2166 // -- rsp[(argc - n) * 8] : arg[n] (zero-based) |
| 2167 // -- ... | 2167 // -- ... |
| 2168 // -- rsp[(argc + 1) * 8] : receiver | 2168 // -- rsp[(argc + 1) * 8] : receiver |
| 2169 // ----------------------------------- | 2169 // ----------------------------------- |
| 2170 | 2170 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2256 | 2256 |
| 2257 // Return the generated code. | 2257 // Return the generated code. |
| 2258 return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name); | 2258 return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name); |
| 2259 } | 2259 } |
| 2260 | 2260 |
| 2261 | 2261 |
| 2262 Handle<Code> CallStubCompiler::CompileFastApiCall( | 2262 Handle<Code> CallStubCompiler::CompileFastApiCall( |
| 2263 const CallOptimization& optimization, | 2263 const CallOptimization& optimization, |
| 2264 Handle<Object> object, | 2264 Handle<Object> object, |
| 2265 Handle<JSObject> holder, | 2265 Handle<JSObject> holder, |
| 2266 Handle<JSGlobalPropertyCell> cell, | 2266 Handle<Cell> cell, |
| 2267 Handle<JSFunction> function, | 2267 Handle<JSFunction> function, |
| 2268 Handle<String> name) { | 2268 Handle<String> name) { |
| 2269 ASSERT(optimization.is_simple_api_call()); | 2269 ASSERT(optimization.is_simple_api_call()); |
| 2270 // Bail out if object is a global object as we don't want to | 2270 // Bail out if object is a global object as we don't want to |
| 2271 // repatch it to global receiver. | 2271 // repatch it to global receiver. |
| 2272 if (object->IsGlobalObject()) return Handle<Code>::null(); | 2272 if (object->IsGlobalObject()) return Handle<Code>::null(); |
| 2273 if (!cell.is_null()) return Handle<Code>::null(); | 2273 if (!cell.is_null()) return Handle<Code>::null(); |
| 2274 if (!object->IsJSObject()) return Handle<Code>::null(); | 2274 if (!object->IsJSObject()) return Handle<Code>::null(); |
| 2275 int depth = optimization.GetPrototypeDepthOfExpectedType( | 2275 int depth = optimization.GetPrototypeDepthOfExpectedType( |
| 2276 Handle<JSObject>::cast(object), holder); | 2276 Handle<JSObject>::cast(object), holder); |
| (...skipping 1209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3486 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); | 3486 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); |
| 3487 } | 3487 } |
| 3488 } | 3488 } |
| 3489 | 3489 |
| 3490 | 3490 |
| 3491 #undef __ | 3491 #undef __ |
| 3492 | 3492 |
| 3493 } } // namespace v8::internal | 3493 } } // namespace v8::internal |
| 3494 | 3494 |
| 3495 #endif // V8_TARGET_ARCH_X64 | 3495 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |