| 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 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1019 // by the previous CheckPrototypes. | 1019 // by the previous CheckPrototypes. |
| 1020 ASSERT(depth2 == kInvalidProtoDepth); | 1020 ASSERT(depth2 == kInvalidProtoDepth); |
| 1021 } | 1021 } |
| 1022 | 1022 |
| 1023 // Invoke function. | 1023 // Invoke function. |
| 1024 if (can_do_fast_api_call) { | 1024 if (can_do_fast_api_call) { |
| 1025 GenerateFastApiDirectCall( | 1025 GenerateFastApiDirectCall( |
| 1026 masm, optimization, arguments_.immediate(), false); | 1026 masm, optimization, arguments_.immediate(), false); |
| 1027 } else { | 1027 } else { |
| 1028 Handle<JSFunction> function = optimization.constant_function(); | 1028 Handle<JSFunction> function = optimization.constant_function(); |
| 1029 stub_compiler_->GenerateJumpFunction(object, function); | 1029 stub_compiler_->GenerateJumpFunctionIgnoreReceiver(function); |
| 1030 } | 1030 } |
| 1031 | 1031 |
| 1032 // Deferred code for fast API call case---clean preallocated space. | 1032 // Deferred code for fast API call case---clean preallocated space. |
| 1033 if (can_do_fast_api_call) { | 1033 if (can_do_fast_api_call) { |
| 1034 __ bind(&miss_cleanup); | 1034 __ bind(&miss_cleanup); |
| 1035 FreeSpaceForFastApiCall(masm); | 1035 FreeSpaceForFastApiCall(masm); |
| 1036 __ Branch(miss_label); | 1036 __ Branch(miss_label); |
| 1037 } | 1037 } |
| 1038 | 1038 |
| 1039 // Invoke a regular function. | 1039 // Invoke a regular function. |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1526 } else { | 1526 } else { |
| 1527 __ Branch(miss, ne, a1, Operand(function)); | 1527 __ Branch(miss, ne, a1, Operand(function)); |
| 1528 } | 1528 } |
| 1529 } | 1529 } |
| 1530 | 1530 |
| 1531 | 1531 |
| 1532 void CallStubCompiler::GenerateMissBranch() { | 1532 void CallStubCompiler::GenerateMissBranch() { |
| 1533 Handle<Code> code = | 1533 Handle<Code> code = |
| 1534 isolate()->stub_cache()->ComputeCallMiss(arguments().immediate(), | 1534 isolate()->stub_cache()->ComputeCallMiss(arguments().immediate(), |
| 1535 kind_, | 1535 kind_, |
| 1536 extra_state_); | 1536 extra_state()); |
| 1537 __ Jump(code, RelocInfo::CODE_TARGET); | 1537 __ Jump(code, RelocInfo::CODE_TARGET); |
| 1538 } | 1538 } |
| 1539 | 1539 |
| 1540 | 1540 |
| 1541 Handle<Code> CallStubCompiler::CompileCallField(Handle<JSObject> object, | 1541 Handle<Code> CallStubCompiler::CompileCallField(Handle<JSObject> object, |
| 1542 Handle<JSObject> holder, | 1542 Handle<JSObject> holder, |
| 1543 PropertyIndex index, | 1543 PropertyIndex index, |
| 1544 Handle<Name> name) { | 1544 Handle<Name> name) { |
| 1545 Label miss; | 1545 Label miss; |
| 1546 | 1546 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1590 } | 1590 } |
| 1591 | 1591 |
| 1592 | 1592 |
| 1593 Handle<Code> CallStubCompiler::CompileArrayPushCall( | 1593 Handle<Code> CallStubCompiler::CompileArrayPushCall( |
| 1594 Handle<Object> object, | 1594 Handle<Object> object, |
| 1595 Handle<JSObject> holder, | 1595 Handle<JSObject> holder, |
| 1596 Handle<Cell> cell, | 1596 Handle<Cell> cell, |
| 1597 Handle<JSFunction> function, | 1597 Handle<JSFunction> function, |
| 1598 Handle<String> name, | 1598 Handle<String> name, |
| 1599 Code::StubType type) { | 1599 Code::StubType type) { |
| 1600 // If object is not an array or is observed, bail out to regular call. | 1600 // If object is not an array or is observed or sealed, bail out to regular |
| 1601 // call. |
| 1601 if (!object->IsJSArray() || | 1602 if (!object->IsJSArray() || |
| 1602 !cell.is_null() || | 1603 !cell.is_null() || |
| 1603 Handle<JSArray>::cast(object)->map()->is_observed()) { | 1604 Handle<JSArray>::cast(object)->map()->is_observed() || |
| 1605 !Handle<JSArray>::cast(object)->map()->is_extensible()) { |
| 1604 return Handle<Code>::null(); | 1606 return Handle<Code>::null(); |
| 1605 } | 1607 } |
| 1606 | 1608 |
| 1607 Label miss; | 1609 Label miss; |
| 1608 HandlerFrontendHeader(object, holder, name, RECEIVER_MAP_CHECK, &miss); | 1610 HandlerFrontendHeader(object, holder, name, RECEIVER_MAP_CHECK, &miss); |
| 1609 Register receiver = a0; | 1611 Register receiver = a0; |
| 1610 Register scratch = a1; | 1612 Register scratch = a1; |
| 1611 | 1613 |
| 1612 const int argc = arguments().immediate(); | 1614 const int argc = arguments().immediate(); |
| 1613 | 1615 |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1832 } | 1834 } |
| 1833 | 1835 |
| 1834 | 1836 |
| 1835 Handle<Code> CallStubCompiler::CompileArrayPopCall( | 1837 Handle<Code> CallStubCompiler::CompileArrayPopCall( |
| 1836 Handle<Object> object, | 1838 Handle<Object> object, |
| 1837 Handle<JSObject> holder, | 1839 Handle<JSObject> holder, |
| 1838 Handle<Cell> cell, | 1840 Handle<Cell> cell, |
| 1839 Handle<JSFunction> function, | 1841 Handle<JSFunction> function, |
| 1840 Handle<String> name, | 1842 Handle<String> name, |
| 1841 Code::StubType type) { | 1843 Code::StubType type) { |
| 1842 // If object is not an array or is observed, bail out to regular call. | 1844 // If object is not an array or is observed or sealed, bail out to regular |
| 1845 // call. |
| 1843 if (!object->IsJSArray() || | 1846 if (!object->IsJSArray() || |
| 1844 !cell.is_null() || | 1847 !cell.is_null() || |
| 1845 Handle<JSArray>::cast(object)->map()->is_observed()) { | 1848 Handle<JSArray>::cast(object)->map()->is_observed() || |
| 1849 !Handle<JSArray>::cast(object)->map()->is_extensible()) { |
| 1846 return Handle<Code>::null(); | 1850 return Handle<Code>::null(); |
| 1847 } | 1851 } |
| 1848 | 1852 |
| 1849 Label miss, return_undefined, call_builtin; | 1853 Label miss, return_undefined, call_builtin; |
| 1850 Register receiver = a0; | 1854 Register receiver = a0; |
| 1851 Register scratch = a1; | 1855 Register scratch = a1; |
| 1852 Register elements = a3; | 1856 Register elements = a3; |
| 1853 HandlerFrontendHeader(object, holder, name, RECEIVER_MAP_CHECK, &miss); | 1857 HandlerFrontendHeader(object, holder, name, RECEIVER_MAP_CHECK, &miss); |
| 1854 | 1858 |
| 1855 // Get the elements array of the object. | 1859 // Get the elements array of the object. |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1912 // If object is not a string, bail out to regular call. | 1916 // If object is not a string, bail out to regular call. |
| 1913 if (!object->IsString() || !cell.is_null()) return Handle<Code>::null(); | 1917 if (!object->IsString() || !cell.is_null()) return Handle<Code>::null(); |
| 1914 | 1918 |
| 1915 Label miss; | 1919 Label miss; |
| 1916 Label name_miss; | 1920 Label name_miss; |
| 1917 Label index_out_of_range; | 1921 Label index_out_of_range; |
| 1918 | 1922 |
| 1919 Label* index_out_of_range_label = &index_out_of_range; | 1923 Label* index_out_of_range_label = &index_out_of_range; |
| 1920 | 1924 |
| 1921 if (kind_ == Code::CALL_IC && | 1925 if (kind_ == Code::CALL_IC && |
| 1922 (CallICBase::StringStubState::decode(extra_state_) == | 1926 (CallICBase::StringStubState::decode(extra_state()) == |
| 1923 DEFAULT_STRING_STUB)) { | 1927 DEFAULT_STRING_STUB)) { |
| 1924 index_out_of_range_label = &miss; | 1928 index_out_of_range_label = &miss; |
| 1925 } | 1929 } |
| 1926 | 1930 |
| 1927 HandlerFrontendHeader(object, holder, name, STRING_CHECK, &name_miss); | 1931 HandlerFrontendHeader(object, holder, name, STRING_CHECK, &name_miss); |
| 1928 | 1932 |
| 1929 Register receiver = a0; | 1933 Register receiver = a0; |
| 1930 Register index = t1; | 1934 Register index = t1; |
| 1931 Register result = a1; | 1935 Register result = a1; |
| 1932 const int argc = arguments().immediate(); | 1936 const int argc = arguments().immediate(); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1976 Code::StubType type) { | 1980 Code::StubType type) { |
| 1977 // If object is not a string, bail out to regular call. | 1981 // If object is not a string, bail out to regular call. |
| 1978 if (!object->IsString() || !cell.is_null()) return Handle<Code>::null(); | 1982 if (!object->IsString() || !cell.is_null()) return Handle<Code>::null(); |
| 1979 | 1983 |
| 1980 const int argc = arguments().immediate(); | 1984 const int argc = arguments().immediate(); |
| 1981 Label miss; | 1985 Label miss; |
| 1982 Label name_miss; | 1986 Label name_miss; |
| 1983 Label index_out_of_range; | 1987 Label index_out_of_range; |
| 1984 Label* index_out_of_range_label = &index_out_of_range; | 1988 Label* index_out_of_range_label = &index_out_of_range; |
| 1985 if (kind_ == Code::CALL_IC && | 1989 if (kind_ == Code::CALL_IC && |
| 1986 (CallICBase::StringStubState::decode(extra_state_) == | 1990 (CallICBase::StringStubState::decode(extra_state()) == |
| 1987 DEFAULT_STRING_STUB)) { | 1991 DEFAULT_STRING_STUB)) { |
| 1988 index_out_of_range_label = &miss; | 1992 index_out_of_range_label = &miss; |
| 1989 } | 1993 } |
| 1990 | 1994 |
| 1991 HandlerFrontendHeader(object, holder, name, STRING_CHECK, &name_miss); | 1995 HandlerFrontendHeader(object, holder, name, STRING_CHECK, &name_miss); |
| 1992 | 1996 |
| 1993 Register receiver = a0; | 1997 Register receiver = a0; |
| 1994 Register index = t1; | 1998 Register index = t1; |
| 1995 Register scratch = a3; | 1999 Register scratch = a3; |
| 1996 Register result = a1; | 2000 Register result = a1; |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2328 // Check that the object is a boolean. | 2332 // Check that the object is a boolean. |
| 2329 __ LoadRoot(at, Heap::kTrueValueRootIndex); | 2333 __ LoadRoot(at, Heap::kTrueValueRootIndex); |
| 2330 __ Branch(&success, eq, object, Operand(at)); | 2334 __ Branch(&success, eq, object, Operand(at)); |
| 2331 __ LoadRoot(at, Heap::kFalseValueRootIndex); | 2335 __ LoadRoot(at, Heap::kFalseValueRootIndex); |
| 2332 __ Branch(miss, ne, object, Operand(at)); | 2336 __ Branch(miss, ne, object, Operand(at)); |
| 2333 __ bind(&success); | 2337 __ bind(&success); |
| 2334 } | 2338 } |
| 2335 | 2339 |
| 2336 | 2340 |
| 2337 void CallStubCompiler::PatchGlobalProxy(Handle<Object> object) { | 2341 void CallStubCompiler::PatchGlobalProxy(Handle<Object> object) { |
| 2338 if (!object.is_null() && object->IsGlobalObject()) { | 2342 if (object->IsGlobalObject()) { |
| 2339 const int argc = arguments().immediate(); | 2343 const int argc = arguments().immediate(); |
| 2340 const int receiver_offset = argc * kPointerSize; | 2344 const int receiver_offset = argc * kPointerSize; |
| 2341 __ lw(a3, FieldMemOperand(a0, GlobalObject::kGlobalReceiverOffset)); | 2345 __ lw(a3, FieldMemOperand(a0, GlobalObject::kGlobalReceiverOffset)); |
| 2342 __ sw(a3, MemOperand(sp, receiver_offset)); | 2346 __ sw(a3, MemOperand(sp, receiver_offset)); |
| 2343 } | 2347 } |
| 2344 } | 2348 } |
| 2345 | 2349 |
| 2346 | 2350 |
| 2347 Register CallStubCompiler::HandlerFrontendHeader(Handle<Object> object, | 2351 Register CallStubCompiler::HandlerFrontendHeader(Handle<Object> object, |
| 2348 Handle<JSObject> holder, | 2352 Handle<JSObject> holder, |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2430 return reg; | 2434 return reg; |
| 2431 } | 2435 } |
| 2432 | 2436 |
| 2433 | 2437 |
| 2434 void CallStubCompiler::GenerateJumpFunction(Handle<Object> object, | 2438 void CallStubCompiler::GenerateJumpFunction(Handle<Object> object, |
| 2435 Register function, | 2439 Register function, |
| 2436 Label* miss) { | 2440 Label* miss) { |
| 2437 ASSERT(function.is(a1)); | 2441 ASSERT(function.is(a1)); |
| 2438 // Check that the function really is a function. | 2442 // Check that the function really is a function. |
| 2439 GenerateFunctionCheck(function, a3, miss); | 2443 GenerateFunctionCheck(function, a3, miss); |
| 2440 if (!function.is(a1)) __ mov(a1, function); | |
| 2441 PatchGlobalProxy(object); | 2444 PatchGlobalProxy(object); |
| 2442 // Invoke the function. | 2445 // Invoke the function. |
| 2443 __ InvokeFunction(a1, arguments(), JUMP_FUNCTION, | 2446 __ InvokeFunction(a1, arguments(), JUMP_FUNCTION, |
| 2444 NullCallWrapper(), call_kind()); | 2447 NullCallWrapper(), call_kind()); |
| 2445 } | 2448 } |
| 2446 | 2449 |
| 2447 | 2450 |
| 2448 Handle<Code> CallStubCompiler::CompileCallInterceptor(Handle<JSObject> object, | 2451 Handle<Code> CallStubCompiler::CompileCallInterceptor(Handle<JSObject> object, |
| 2449 Handle<JSObject> holder, | 2452 Handle<JSObject> holder, |
| 2450 Handle<Name> name) { | 2453 Handle<Name> name) { |
| 2451 Label miss; | 2454 Label miss; |
| 2452 | 2455 |
| 2453 GenerateNameCheck(name, &miss); | 2456 GenerateNameCheck(name, &miss); |
| 2454 | 2457 |
| 2455 // Get the number of arguments. | 2458 // Get the number of arguments. |
| 2456 const int argc = arguments().immediate(); | 2459 const int argc = arguments().immediate(); |
| 2457 LookupResult lookup(isolate()); | 2460 LookupResult lookup(isolate()); |
| 2458 LookupPostInterceptor(holder, name, &lookup); | 2461 LookupPostInterceptor(holder, name, &lookup); |
| 2459 | 2462 |
| 2460 // Get the receiver from the stack. | 2463 // Get the receiver from the stack. |
| 2461 __ lw(a1, MemOperand(sp, argc * kPointerSize)); | 2464 __ lw(a1, MemOperand(sp, argc * kPointerSize)); |
| 2462 | 2465 |
| 2463 CallInterceptorCompiler compiler(this, arguments(), a2, extra_state_); | 2466 CallInterceptorCompiler compiler(this, arguments(), a2, extra_state()); |
| 2464 compiler.Compile(masm(), object, holder, name, &lookup, a1, a3, t0, a0, | 2467 compiler.Compile(masm(), object, holder, name, &lookup, a1, a3, t0, a0, |
| 2465 &miss); | 2468 &miss); |
| 2466 | 2469 |
| 2467 // Move returned value, the function to call, to a1. | 2470 // Move returned value, the function to call, to a1. |
| 2468 __ mov(a1, v0); | 2471 __ mov(a1, v0); |
| 2469 // Restore receiver. | 2472 // Restore receiver. |
| 2470 __ lw(a0, MemOperand(sp, argc * kPointerSize)); | 2473 __ lw(a0, MemOperand(sp, argc * kPointerSize)); |
| 2471 | 2474 |
| 2472 GenerateJumpFunction(object, a1, &miss); | 2475 GenerateJumpFunction(object, a1, &miss); |
| 2473 | 2476 |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2882 // ----------------------------------- | 2885 // ----------------------------------- |
| 2883 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); | 2886 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); |
| 2884 } | 2887 } |
| 2885 | 2888 |
| 2886 | 2889 |
| 2887 #undef __ | 2890 #undef __ |
| 2888 | 2891 |
| 2889 } } // namespace v8::internal | 2892 } } // namespace v8::internal |
| 2890 | 2893 |
| 2891 #endif // V8_TARGET_ARCH_MIPS | 2894 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |