| 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 1547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1558 __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); | 1558 __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); |
| 1559 | 1559 |
| 1560 | 1560 |
| 1561 // Check that the maps haven't changed. | 1561 // Check that the maps haven't changed. |
| 1562 __ JumpIfSmi(edx, miss); | 1562 __ JumpIfSmi(edx, miss); |
| 1563 CheckPrototypes(object, edx, holder, ebx, eax, edi, name, miss); | 1563 CheckPrototypes(object, edx, holder, ebx, eax, edi, name, miss); |
| 1564 } | 1564 } |
| 1565 | 1565 |
| 1566 | 1566 |
| 1567 void CallStubCompiler::GenerateLoadFunctionFromCell( | 1567 void CallStubCompiler::GenerateLoadFunctionFromCell( |
| 1568 Handle<JSGlobalPropertyCell> cell, | 1568 Handle<Cell> cell, |
| 1569 Handle<JSFunction> function, | 1569 Handle<JSFunction> function, |
| 1570 Label* miss) { | 1570 Label* miss) { |
| 1571 // Get the value from the cell. | 1571 // Get the value from the cell. |
| 1572 if (Serializer::enabled()) { | 1572 if (Serializer::enabled()) { |
| 1573 __ mov(edi, Immediate(cell)); | 1573 __ mov(edi, Immediate(cell)); |
| 1574 __ mov(edi, FieldOperand(edi, JSGlobalPropertyCell::kValueOffset)); | 1574 __ mov(edi, FieldOperand(edi, Cell::kValueOffset)); |
| 1575 } else { | 1575 } else { |
| 1576 __ mov(edi, Operand::Cell(cell)); | 1576 __ mov(edi, Operand::Cell(cell)); |
| 1577 } | 1577 } |
| 1578 | 1578 |
| 1579 // Check that the cell contains the same function. | 1579 // Check that the cell contains the same function. |
| 1580 if (isolate()->heap()->InNewSpace(*function)) { | 1580 if (isolate()->heap()->InNewSpace(*function)) { |
| 1581 // We can't embed a pointer to a function in new space so we have | 1581 // We can't embed a pointer to a function in new space so we have |
| 1582 // to verify that the shared function info is unchanged. This has | 1582 // to verify that the shared function info is unchanged. This has |
| 1583 // the nice side effect that multiple closures based on the same | 1583 // the nice side effect that multiple closures based on the same |
| 1584 // function can all use this call IC. Before we load through the | 1584 // function can all use this call IC. Before we load through the |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1660 GenerateMissBranch(); | 1660 GenerateMissBranch(); |
| 1661 | 1661 |
| 1662 // Return the generated code. | 1662 // Return the generated code. |
| 1663 return GetCode(Code::FIELD, name); | 1663 return GetCode(Code::FIELD, name); |
| 1664 } | 1664 } |
| 1665 | 1665 |
| 1666 | 1666 |
| 1667 Handle<Code> CallStubCompiler::CompileArrayPushCall( | 1667 Handle<Code> CallStubCompiler::CompileArrayPushCall( |
| 1668 Handle<Object> object, | 1668 Handle<Object> object, |
| 1669 Handle<JSObject> holder, | 1669 Handle<JSObject> holder, |
| 1670 Handle<JSGlobalPropertyCell> cell, | 1670 Handle<Cell> cell, |
| 1671 Handle<JSFunction> function, | 1671 Handle<JSFunction> function, |
| 1672 Handle<String> name) { | 1672 Handle<String> name) { |
| 1673 // ----------- S t a t e ------------- | 1673 // ----------- S t a t e ------------- |
| 1674 // -- ecx : name | 1674 // -- ecx : name |
| 1675 // -- esp[0] : return address | 1675 // -- esp[0] : return address |
| 1676 // -- esp[(argc - n) * 4] : arg[n] (zero-based) | 1676 // -- esp[(argc - n) * 4] : arg[n] (zero-based) |
| 1677 // -- ... | 1677 // -- ... |
| 1678 // -- esp[(argc + 1) * 4] : receiver | 1678 // -- esp[(argc + 1) * 4] : receiver |
| 1679 // ----------------------------------- | 1679 // ----------------------------------- |
| 1680 | 1680 |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1918 GenerateMissBranch(); | 1918 GenerateMissBranch(); |
| 1919 | 1919 |
| 1920 // Return the generated code. | 1920 // Return the generated code. |
| 1921 return GetCode(function); | 1921 return GetCode(function); |
| 1922 } | 1922 } |
| 1923 | 1923 |
| 1924 | 1924 |
| 1925 Handle<Code> CallStubCompiler::CompileArrayPopCall( | 1925 Handle<Code> CallStubCompiler::CompileArrayPopCall( |
| 1926 Handle<Object> object, | 1926 Handle<Object> object, |
| 1927 Handle<JSObject> holder, | 1927 Handle<JSObject> holder, |
| 1928 Handle<JSGlobalPropertyCell> cell, | 1928 Handle<Cell> cell, |
| 1929 Handle<JSFunction> function, | 1929 Handle<JSFunction> function, |
| 1930 Handle<String> name) { | 1930 Handle<String> name) { |
| 1931 // ----------- S t a t e ------------- | 1931 // ----------- S t a t e ------------- |
| 1932 // -- ecx : name | 1932 // -- ecx : name |
| 1933 // -- esp[0] : return address | 1933 // -- esp[0] : return address |
| 1934 // -- esp[(argc - n) * 4] : arg[n] (zero-based) | 1934 // -- esp[(argc - n) * 4] : arg[n] (zero-based) |
| 1935 // -- ... | 1935 // -- ... |
| 1936 // -- esp[(argc + 1) * 4] : receiver | 1936 // -- esp[(argc + 1) * 4] : receiver |
| 1937 // ----------------------------------- | 1937 // ----------------------------------- |
| 1938 | 1938 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2000 GenerateMissBranch(); | 2000 GenerateMissBranch(); |
| 2001 | 2001 |
| 2002 // Return the generated code. | 2002 // Return the generated code. |
| 2003 return GetCode(function); | 2003 return GetCode(function); |
| 2004 } | 2004 } |
| 2005 | 2005 |
| 2006 | 2006 |
| 2007 Handle<Code> CallStubCompiler::CompileStringCharCodeAtCall( | 2007 Handle<Code> CallStubCompiler::CompileStringCharCodeAtCall( |
| 2008 Handle<Object> object, | 2008 Handle<Object> object, |
| 2009 Handle<JSObject> holder, | 2009 Handle<JSObject> holder, |
| 2010 Handle<JSGlobalPropertyCell> cell, | 2010 Handle<Cell> cell, |
| 2011 Handle<JSFunction> function, | 2011 Handle<JSFunction> function, |
| 2012 Handle<String> name) { | 2012 Handle<String> name) { |
| 2013 // ----------- S t a t e ------------- | 2013 // ----------- S t a t e ------------- |
| 2014 // -- ecx : function name | 2014 // -- ecx : function name |
| 2015 // -- esp[0] : return address | 2015 // -- esp[0] : return address |
| 2016 // -- esp[(argc - n) * 4] : arg[n] (zero-based) | 2016 // -- esp[(argc - n) * 4] : arg[n] (zero-based) |
| 2017 // -- ... | 2017 // -- ... |
| 2018 // -- esp[(argc + 1) * 4] : receiver | 2018 // -- esp[(argc + 1) * 4] : receiver |
| 2019 // ----------------------------------- | 2019 // ----------------------------------- |
| 2020 | 2020 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2084 GenerateMissBranch(); | 2084 GenerateMissBranch(); |
| 2085 | 2085 |
| 2086 // Return the generated code. | 2086 // Return the generated code. |
| 2087 return GetCode(function); | 2087 return GetCode(function); |
| 2088 } | 2088 } |
| 2089 | 2089 |
| 2090 | 2090 |
| 2091 Handle<Code> CallStubCompiler::CompileStringCharAtCall( | 2091 Handle<Code> CallStubCompiler::CompileStringCharAtCall( |
| 2092 Handle<Object> object, | 2092 Handle<Object> object, |
| 2093 Handle<JSObject> holder, | 2093 Handle<JSObject> holder, |
| 2094 Handle<JSGlobalPropertyCell> cell, | 2094 Handle<Cell> cell, |
| 2095 Handle<JSFunction> function, | 2095 Handle<JSFunction> function, |
| 2096 Handle<String> name) { | 2096 Handle<String> name) { |
| 2097 // ----------- S t a t e ------------- | 2097 // ----------- S t a t e ------------- |
| 2098 // -- ecx : function name | 2098 // -- ecx : function name |
| 2099 // -- esp[0] : return address | 2099 // -- esp[0] : return address |
| 2100 // -- esp[(argc - n) * 4] : arg[n] (zero-based) | 2100 // -- esp[(argc - n) * 4] : arg[n] (zero-based) |
| 2101 // -- ... | 2101 // -- ... |
| 2102 // -- esp[(argc + 1) * 4] : receiver | 2102 // -- esp[(argc + 1) * 4] : receiver |
| 2103 // ----------------------------------- | 2103 // ----------------------------------- |
| 2104 | 2104 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2170 GenerateMissBranch(); | 2170 GenerateMissBranch(); |
| 2171 | 2171 |
| 2172 // Return the generated code. | 2172 // Return the generated code. |
| 2173 return GetCode(function); | 2173 return GetCode(function); |
| 2174 } | 2174 } |
| 2175 | 2175 |
| 2176 | 2176 |
| 2177 Handle<Code> CallStubCompiler::CompileStringFromCharCodeCall( | 2177 Handle<Code> CallStubCompiler::CompileStringFromCharCodeCall( |
| 2178 Handle<Object> object, | 2178 Handle<Object> object, |
| 2179 Handle<JSObject> holder, | 2179 Handle<JSObject> holder, |
| 2180 Handle<JSGlobalPropertyCell> cell, | 2180 Handle<Cell> cell, |
| 2181 Handle<JSFunction> function, | 2181 Handle<JSFunction> function, |
| 2182 Handle<String> name) { | 2182 Handle<String> name) { |
| 2183 // ----------- S t a t e ------------- | 2183 // ----------- S t a t e ------------- |
| 2184 // -- ecx : function name | 2184 // -- ecx : function name |
| 2185 // -- esp[0] : return address | 2185 // -- esp[0] : return address |
| 2186 // -- esp[(argc - n) * 4] : arg[n] (zero-based) | 2186 // -- esp[(argc - n) * 4] : arg[n] (zero-based) |
| 2187 // -- ... | 2187 // -- ... |
| 2188 // -- esp[(argc + 1) * 4] : receiver | 2188 // -- esp[(argc + 1) * 4] : receiver |
| 2189 // ----------------------------------- | 2189 // ----------------------------------- |
| 2190 | 2190 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2246 GenerateMissBranch(); | 2246 GenerateMissBranch(); |
| 2247 | 2247 |
| 2248 // Return the generated code. | 2248 // Return the generated code. |
| 2249 return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name); | 2249 return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name); |
| 2250 } | 2250 } |
| 2251 | 2251 |
| 2252 | 2252 |
| 2253 Handle<Code> CallStubCompiler::CompileMathFloorCall( | 2253 Handle<Code> CallStubCompiler::CompileMathFloorCall( |
| 2254 Handle<Object> object, | 2254 Handle<Object> object, |
| 2255 Handle<JSObject> holder, | 2255 Handle<JSObject> holder, |
| 2256 Handle<JSGlobalPropertyCell> cell, | 2256 Handle<Cell> cell, |
| 2257 Handle<JSFunction> function, | 2257 Handle<JSFunction> function, |
| 2258 Handle<String> name) { | 2258 Handle<String> name) { |
| 2259 // ----------- S t a t e ------------- | 2259 // ----------- S t a t e ------------- |
| 2260 // -- ecx : name | 2260 // -- ecx : name |
| 2261 // -- esp[0] : return address | 2261 // -- esp[0] : return address |
| 2262 // -- esp[(argc - n) * 4] : arg[n] (zero-based) | 2262 // -- esp[(argc - n) * 4] : arg[n] (zero-based) |
| 2263 // -- ... | 2263 // -- ... |
| 2264 // -- esp[(argc + 1) * 4] : receiver | 2264 // -- esp[(argc + 1) * 4] : receiver |
| 2265 // ----------------------------------- | 2265 // ----------------------------------- |
| 2266 | 2266 |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2377 GenerateMissBranch(); | 2377 GenerateMissBranch(); |
| 2378 | 2378 |
| 2379 // Return the generated code. | 2379 // Return the generated code. |
| 2380 return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name); | 2380 return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name); |
| 2381 } | 2381 } |
| 2382 | 2382 |
| 2383 | 2383 |
| 2384 Handle<Code> CallStubCompiler::CompileMathAbsCall( | 2384 Handle<Code> CallStubCompiler::CompileMathAbsCall( |
| 2385 Handle<Object> object, | 2385 Handle<Object> object, |
| 2386 Handle<JSObject> holder, | 2386 Handle<JSObject> holder, |
| 2387 Handle<JSGlobalPropertyCell> cell, | 2387 Handle<Cell> cell, |
| 2388 Handle<JSFunction> function, | 2388 Handle<JSFunction> function, |
| 2389 Handle<String> name) { | 2389 Handle<String> name) { |
| 2390 // ----------- S t a t e ------------- | 2390 // ----------- S t a t e ------------- |
| 2391 // -- ecx : name | 2391 // -- ecx : name |
| 2392 // -- esp[0] : return address | 2392 // -- esp[0] : return address |
| 2393 // -- esp[(argc - n) * 4] : arg[n] (zero-based) | 2393 // -- esp[(argc - n) * 4] : arg[n] (zero-based) |
| 2394 // -- ... | 2394 // -- ... |
| 2395 // -- esp[(argc + 1) * 4] : receiver | 2395 // -- esp[(argc + 1) * 4] : receiver |
| 2396 // ----------------------------------- | 2396 // ----------------------------------- |
| 2397 | 2397 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2484 | 2484 |
| 2485 // Return the generated code. | 2485 // Return the generated code. |
| 2486 return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name); | 2486 return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name); |
| 2487 } | 2487 } |
| 2488 | 2488 |
| 2489 | 2489 |
| 2490 Handle<Code> CallStubCompiler::CompileFastApiCall( | 2490 Handle<Code> CallStubCompiler::CompileFastApiCall( |
| 2491 const CallOptimization& optimization, | 2491 const CallOptimization& optimization, |
| 2492 Handle<Object> object, | 2492 Handle<Object> object, |
| 2493 Handle<JSObject> holder, | 2493 Handle<JSObject> holder, |
| 2494 Handle<JSGlobalPropertyCell> cell, | 2494 Handle<Cell> cell, |
| 2495 Handle<JSFunction> function, | 2495 Handle<JSFunction> function, |
| 2496 Handle<String> name) { | 2496 Handle<String> name) { |
| 2497 ASSERT(optimization.is_simple_api_call()); | 2497 ASSERT(optimization.is_simple_api_call()); |
| 2498 // Bail out if object is a global object as we don't want to | 2498 // Bail out if object is a global object as we don't want to |
| 2499 // repatch it to global receiver. | 2499 // repatch it to global receiver. |
| 2500 if (object->IsGlobalObject()) return Handle<Code>::null(); | 2500 if (object->IsGlobalObject()) return Handle<Code>::null(); |
| 2501 if (!cell.is_null()) return Handle<Code>::null(); | 2501 if (!cell.is_null()) return Handle<Code>::null(); |
| 2502 if (!object->IsJSObject()) return Handle<Code>::null(); | 2502 if (!object->IsJSObject()) return Handle<Code>::null(); |
| 2503 int depth = optimization.GetPrototypeDepthOfExpectedType( | 2503 int depth = optimization.GetPrototypeDepthOfExpectedType( |
| 2504 Handle<JSObject>::cast(object), holder); | 2504 Handle<JSObject>::cast(object), holder); |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2666 | 2666 |
| 2667 Handle<Code> CallStubCompiler::CompileCallConstant( | 2667 Handle<Code> CallStubCompiler::CompileCallConstant( |
| 2668 Handle<Object> object, | 2668 Handle<Object> object, |
| 2669 Handle<JSObject> holder, | 2669 Handle<JSObject> holder, |
| 2670 Handle<Name> name, | 2670 Handle<Name> name, |
| 2671 CheckType check, | 2671 CheckType check, |
| 2672 Handle<JSFunction> function) { | 2672 Handle<JSFunction> function) { |
| 2673 | 2673 |
| 2674 if (HasCustomCallGenerator(function)) { | 2674 if (HasCustomCallGenerator(function)) { |
| 2675 Handle<Code> code = CompileCustomCall(object, holder, | 2675 Handle<Code> code = CompileCustomCall(object, holder, |
| 2676 Handle<JSGlobalPropertyCell>::null(), | 2676 Handle<Cell>::null(), |
| 2677 function, Handle<String>::cast(name)); | 2677 function, Handle<String>::cast(name)); |
| 2678 // A null handle means bail out to the regular compiler code below. | 2678 // A null handle means bail out to the regular compiler code below. |
| 2679 if (!code.is_null()) return code; | 2679 if (!code.is_null()) return code; |
| 2680 } | 2680 } |
| 2681 | 2681 |
| 2682 Label success; | 2682 Label success; |
| 2683 | 2683 |
| 2684 CompileHandlerFrontend(object, holder, name, check, &success); | 2684 CompileHandlerFrontend(object, holder, name, check, &success); |
| 2685 __ bind(&success); | 2685 __ bind(&success); |
| 2686 CompileHandlerBackend(function); | 2686 CompileHandlerBackend(function); |
| (...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3743 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); | 3743 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); |
| 3744 } | 3744 } |
| 3745 } | 3745 } |
| 3746 | 3746 |
| 3747 | 3747 |
| 3748 #undef __ | 3748 #undef __ |
| 3749 | 3749 |
| 3750 } } // namespace v8::internal | 3750 } } // namespace v8::internal |
| 3751 | 3751 |
| 3752 #endif // V8_TARGET_ARCH_IA32 | 3752 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |