Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Side by Side Diff: src/mips/stub-cache-mips.cc

Issue 14305011: MIPS: Disallow dereferencing deferred handles when generating optimized code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/mips/macro-assembler-mips.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 933 matching lines...) Expand 10 before | Expand all | Expand 10 after
944 ASSERT(depth2 == kInvalidProtoDepth); 944 ASSERT(depth2 == kInvalidProtoDepth);
945 } 945 }
946 946
947 // Invoke function. 947 // Invoke function.
948 if (can_do_fast_api_call) { 948 if (can_do_fast_api_call) {
949 GenerateFastApiDirectCall(masm, optimization, arguments_.immediate()); 949 GenerateFastApiDirectCall(masm, optimization, arguments_.immediate());
950 } else { 950 } else {
951 CallKind call_kind = CallICBase::Contextual::decode(extra_ic_state_) 951 CallKind call_kind = CallICBase::Contextual::decode(extra_ic_state_)
952 ? CALL_AS_FUNCTION 952 ? CALL_AS_FUNCTION
953 : CALL_AS_METHOD; 953 : CALL_AS_METHOD;
954 __ InvokeFunction(optimization.constant_function(), arguments_, 954 Handle<JSFunction> function = optimization.constant_function();
955 ParameterCount expected(function);
956 __ InvokeFunction(function, expected, arguments_,
955 JUMP_FUNCTION, NullCallWrapper(), call_kind); 957 JUMP_FUNCTION, NullCallWrapper(), call_kind);
956 } 958 }
957 959
958 // Deferred code for fast API call case---clean preallocated space. 960 // Deferred code for fast API call case---clean preallocated space.
959 if (can_do_fast_api_call) { 961 if (can_do_fast_api_call) {
960 __ bind(&miss_cleanup); 962 __ bind(&miss_cleanup);
961 FreeSpaceForFastApiCall(masm); 963 FreeSpaceForFastApiCall(masm);
962 __ Branch(miss_label); 964 __ Branch(miss_label);
963 } 965 }
964 966
(...skipping 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after
2084 generator.GenerateFast(masm()); 2086 generator.GenerateFast(masm());
2085 __ Drop(argc + 1); 2087 __ Drop(argc + 1);
2086 __ Ret(); 2088 __ Ret();
2087 2089
2088 StubRuntimeCallHelper call_helper; 2090 StubRuntimeCallHelper call_helper;
2089 generator.GenerateSlow(masm(), call_helper); 2091 generator.GenerateSlow(masm(), call_helper);
2090 2092
2091 // Tail call the full function. We do not have to patch the receiver 2093 // Tail call the full function. We do not have to patch the receiver
2092 // because the function makes no use of it. 2094 // because the function makes no use of it.
2093 __ bind(&slow); 2095 __ bind(&slow);
2094 __ InvokeFunction( 2096 ParameterCount expected(function);
2095 function, arguments(), JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); 2097 __ InvokeFunction(function, expected, arguments(),
2098 JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD);
2096 2099
2097 __ bind(&miss); 2100 __ bind(&miss);
2098 // a2: function name. 2101 // a2: function name.
2099 GenerateMissBranch(); 2102 GenerateMissBranch();
2100 2103
2101 // Return the generated code. 2104 // Return the generated code.
2102 return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name); 2105 return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name);
2103 } 2106 }
2104 2107
2105 2108
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
2214 __ Drop(argc + 1); 2217 __ Drop(argc + 1);
2215 __ Ret(); 2218 __ Ret();
2216 2219
2217 __ bind(&wont_fit_smi); 2220 __ bind(&wont_fit_smi);
2218 // Restore FCSR and fall to slow case. 2221 // Restore FCSR and fall to slow case.
2219 __ ctc1(a3, FCSR); 2222 __ ctc1(a3, FCSR);
2220 2223
2221 __ bind(&slow); 2224 __ bind(&slow);
2222 // Tail call the full function. We do not have to patch the receiver 2225 // Tail call the full function. We do not have to patch the receiver
2223 // because the function makes no use of it. 2226 // because the function makes no use of it.
2224 __ InvokeFunction( 2227 ParameterCount expected(function);
2225 function, arguments(), JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); 2228 __ InvokeFunction(function, expected, arguments(),
2229 JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD);
2226 2230
2227 __ bind(&miss); 2231 __ bind(&miss);
2228 // a2: function name. 2232 // a2: function name.
2229 GenerateMissBranch(); 2233 GenerateMissBranch();
2230 2234
2231 // Return the generated code. 2235 // Return the generated code.
2232 return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name); 2236 return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name);
2233 } 2237 }
2234 2238
2235 2239
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
2315 __ LoadRoot(t2, Heap::kHeapNumberMapRootIndex); 2319 __ LoadRoot(t2, Heap::kHeapNumberMapRootIndex);
2316 __ AllocateHeapNumber(v0, t0, t1, t2, &slow); 2320 __ AllocateHeapNumber(v0, t0, t1, t2, &slow);
2317 __ sw(a1, FieldMemOperand(v0, HeapNumber::kExponentOffset)); 2321 __ sw(a1, FieldMemOperand(v0, HeapNumber::kExponentOffset));
2318 __ sw(a3, FieldMemOperand(v0, HeapNumber::kMantissaOffset)); 2322 __ sw(a3, FieldMemOperand(v0, HeapNumber::kMantissaOffset));
2319 __ Drop(argc + 1); 2323 __ Drop(argc + 1);
2320 __ Ret(); 2324 __ Ret();
2321 2325
2322 // Tail call the full function. We do not have to patch the receiver 2326 // Tail call the full function. We do not have to patch the receiver
2323 // because the function makes no use of it. 2327 // because the function makes no use of it.
2324 __ bind(&slow); 2328 __ bind(&slow);
2325 __ InvokeFunction( 2329 ParameterCount expected(function);
2326 function, arguments(), JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); 2330 __ InvokeFunction(function, expected, arguments(),
2331 JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD);
2327 2332
2328 __ bind(&miss); 2333 __ bind(&miss);
2329 // a2: function name. 2334 // a2: function name.
2330 GenerateMissBranch(); 2335 GenerateMissBranch();
2331 2336
2332 // Return the generated code. 2337 // Return the generated code.
2333 return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name); 2338 return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name);
2334 } 2339 }
2335 2340
2336 2341
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
2491 __ bind(&miss); 2496 __ bind(&miss);
2492 2497
2493 GenerateMissBranch(); 2498 GenerateMissBranch();
2494 } 2499 }
2495 2500
2496 2501
2497 void CallStubCompiler::CompileHandlerBackend(Handle<JSFunction> function) { 2502 void CallStubCompiler::CompileHandlerBackend(Handle<JSFunction> function) {
2498 CallKind call_kind = CallICBase::Contextual::decode(extra_state_) 2503 CallKind call_kind = CallICBase::Contextual::decode(extra_state_)
2499 ? CALL_AS_FUNCTION 2504 ? CALL_AS_FUNCTION
2500 : CALL_AS_METHOD; 2505 : CALL_AS_METHOD;
2501 __ InvokeFunction( 2506 ParameterCount expected(function);
2502 function, arguments(), JUMP_FUNCTION, NullCallWrapper(), call_kind); 2507 __ InvokeFunction(function, expected, arguments(),
2508 JUMP_FUNCTION, NullCallWrapper(), call_kind);
2503 } 2509 }
2504 2510
2505 2511
2506 Handle<Code> CallStubCompiler::CompileCallConstant( 2512 Handle<Code> CallStubCompiler::CompileCallConstant(
2507 Handle<Object> object, 2513 Handle<Object> object,
2508 Handle<JSObject> holder, 2514 Handle<JSObject> holder,
2509 Handle<Name> name, 2515 Handle<Name> name,
2510 CheckType check, 2516 CheckType check,
2511 Handle<JSFunction> function) { 2517 Handle<JSFunction> function) {
2512 if (HasCustomCallGenerator(function)) { 2518 if (HasCustomCallGenerator(function)) {
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
2679 FrameScope scope(masm, StackFrame::INTERNAL); 2685 FrameScope scope(masm, StackFrame::INTERNAL);
2680 2686
2681 // Save value register, so we can restore it later. 2687 // Save value register, so we can restore it later.
2682 __ push(a0); 2688 __ push(a0);
2683 2689
2684 if (!setter.is_null()) { 2690 if (!setter.is_null()) {
2685 // Call the JavaScript setter with receiver and value on the stack. 2691 // Call the JavaScript setter with receiver and value on the stack.
2686 __ push(a1); 2692 __ push(a1);
2687 __ push(a0); 2693 __ push(a0);
2688 ParameterCount actual(1); 2694 ParameterCount actual(1);
2689 __ InvokeFunction(setter, actual, CALL_FUNCTION, NullCallWrapper(), 2695 ParameterCount expected(setter);
2690 CALL_AS_METHOD); 2696 __ InvokeFunction(setter, expected, actual,
2697 CALL_FUNCTION, NullCallWrapper(), CALL_AS_METHOD);
2691 } else { 2698 } else {
2692 // If we generate a global code snippet for deoptimization only, remember 2699 // If we generate a global code snippet for deoptimization only, remember
2693 // the place to continue after deoptimization. 2700 // the place to continue after deoptimization.
2694 masm->isolate()->heap()->SetSetterStubDeoptPCOffset(masm->pc_offset()); 2701 masm->isolate()->heap()->SetSetterStubDeoptPCOffset(masm->pc_offset());
2695 } 2702 }
2696 2703
2697 // We have to return the passed value, not the return value of the setter. 2704 // We have to return the passed value, not the return value of the setter.
2698 __ pop(v0); 2705 __ pop(v0);
2699 2706
2700 // Restore context register. 2707 // Restore context register.
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
2860 // -- a2 : name 2867 // -- a2 : name
2861 // -- ra : return address 2868 // -- ra : return address
2862 // ----------------------------------- 2869 // -----------------------------------
2863 { 2870 {
2864 FrameScope scope(masm, StackFrame::INTERNAL); 2871 FrameScope scope(masm, StackFrame::INTERNAL);
2865 2872
2866 if (!getter.is_null()) { 2873 if (!getter.is_null()) {
2867 // Call the JavaScript getter with the receiver on the stack. 2874 // Call the JavaScript getter with the receiver on the stack.
2868 __ push(a0); 2875 __ push(a0);
2869 ParameterCount actual(0); 2876 ParameterCount actual(0);
2870 __ InvokeFunction(getter, actual, CALL_FUNCTION, NullCallWrapper(), 2877 ParameterCount expected(getter);
2871 CALL_AS_METHOD); 2878 __ InvokeFunction(getter, expected, actual,
2879 CALL_FUNCTION, NullCallWrapper(), CALL_AS_METHOD);
2872 } else { 2880 } else {
2873 // If we generate a global code snippet for deoptimization only, remember 2881 // If we generate a global code snippet for deoptimization only, remember
2874 // the place to continue after deoptimization. 2882 // the place to continue after deoptimization.
2875 masm->isolate()->heap()->SetGetterStubDeoptPCOffset(masm->pc_offset()); 2883 masm->isolate()->heap()->SetGetterStubDeoptPCOffset(masm->pc_offset());
2876 } 2884 }
2877 2885
2878 // Restore context register. 2886 // Restore context register.
2879 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 2887 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
2880 } 2888 }
2881 __ Ret(); 2889 __ Ret();
(...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after
3745 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); 3753 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow);
3746 } 3754 }
3747 } 3755 }
3748 3756
3749 3757
3750 #undef __ 3758 #undef __
3751 3759
3752 } } // namespace v8::internal 3760 } } // namespace v8::internal
3753 3761
3754 #endif // V8_TARGET_ARCH_MIPS 3762 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/macro-assembler-mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698