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

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

Issue 14403015: Disallow dereferencing deferred handles when generating optimized code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments 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/x64/macro-assembler-x64.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 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 ASSERT(depth2 == kInvalidProtoDepth); 614 ASSERT(depth2 == kInvalidProtoDepth);
615 } 615 }
616 616
617 // Invoke function. 617 // Invoke function.
618 if (can_do_fast_api_call) { 618 if (can_do_fast_api_call) {
619 GenerateFastApiCall(masm, optimization, arguments_.immediate()); 619 GenerateFastApiCall(masm, optimization, arguments_.immediate());
620 } else { 620 } else {
621 CallKind call_kind = CallICBase::Contextual::decode(extra_ic_state_) 621 CallKind call_kind = CallICBase::Contextual::decode(extra_ic_state_)
622 ? CALL_AS_FUNCTION 622 ? CALL_AS_FUNCTION
623 : CALL_AS_METHOD; 623 : CALL_AS_METHOD;
624 __ InvokeFunction(optimization.constant_function(), arguments_, 624 Handle<JSFunction> fun = optimization.constant_function();
625 __ InvokeFunction(fun, ParameterCount(fun), arguments_,
625 JUMP_FUNCTION, NullCallWrapper(), call_kind); 626 JUMP_FUNCTION, NullCallWrapper(), call_kind);
626 } 627 }
627 628
628 // Deferred code for fast API call case---clean preallocated space. 629 // Deferred code for fast API call case---clean preallocated space.
629 if (can_do_fast_api_call) { 630 if (can_do_fast_api_call) {
630 __ bind(&miss_cleanup); 631 __ bind(&miss_cleanup);
631 FreeSpaceForFastApiCall(masm, scratch1); 632 FreeSpaceForFastApiCall(masm, scratch1);
632 __ jmp(miss_label); 633 __ jmp(miss_label);
633 } 634 }
634 635
(...skipping 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after
1984 1985
1985 StubRuntimeCallHelper call_helper; 1986 StubRuntimeCallHelper call_helper;
1986 generator.GenerateSlow(masm(), call_helper); 1987 generator.GenerateSlow(masm(), call_helper);
1987 1988
1988 // Tail call the full function. We do not have to patch the receiver 1989 // Tail call the full function. We do not have to patch the receiver
1989 // because the function makes no use of it. 1990 // because the function makes no use of it.
1990 __ bind(&slow); 1991 __ bind(&slow);
1991 CallKind call_kind = CallICBase::Contextual::decode(extra_state_) 1992 CallKind call_kind = CallICBase::Contextual::decode(extra_state_)
1992 ? CALL_AS_FUNCTION 1993 ? CALL_AS_FUNCTION
1993 : CALL_AS_METHOD; 1994 : CALL_AS_METHOD;
1994 __ InvokeFunction(function, arguments(), JUMP_FUNCTION, 1995 __ InvokeFunction(function, ParameterCount(function), arguments(),
1995 NullCallWrapper(), call_kind); 1996 JUMP_FUNCTION, NullCallWrapper(), call_kind);
1996 1997
1997 __ bind(&miss); 1998 __ bind(&miss);
1998 // rcx: function name. 1999 // rcx: function name.
1999 GenerateMissBranch(); 2000 GenerateMissBranch();
2000 2001
2001 // Return the generated code. 2002 // Return the generated code.
2002 return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name); 2003 return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name);
2003 } 2004 }
2004 2005
2005 2006
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
2099 __ AllocateHeapNumber(rax, rdx, &slow); 2100 __ AllocateHeapNumber(rax, rdx, &slow);
2100 __ movq(FieldOperand(rax, HeapNumber::kValueOffset), rbx); 2101 __ movq(FieldOperand(rax, HeapNumber::kValueOffset), rbx);
2101 __ ret(2 * kPointerSize); 2102 __ ret(2 * kPointerSize);
2102 2103
2103 // Tail call the full function. We do not have to patch the receiver 2104 // Tail call the full function. We do not have to patch the receiver
2104 // because the function makes no use of it. 2105 // because the function makes no use of it.
2105 __ bind(&slow); 2106 __ bind(&slow);
2106 CallKind call_kind = CallICBase::Contextual::decode(extra_state_) 2107 CallKind call_kind = CallICBase::Contextual::decode(extra_state_)
2107 ? CALL_AS_FUNCTION 2108 ? CALL_AS_FUNCTION
2108 : CALL_AS_METHOD; 2109 : CALL_AS_METHOD;
2109 __ InvokeFunction(function, arguments(), JUMP_FUNCTION, 2110 __ InvokeFunction(function, ParameterCount(function), arguments(),
2110 NullCallWrapper(), call_kind); 2111 JUMP_FUNCTION, NullCallWrapper(), call_kind);
2111 2112
2112 __ bind(&miss); 2113 __ bind(&miss);
2113 // rcx: function name. 2114 // rcx: function name.
2114 GenerateMissBranch(); 2115 GenerateMissBranch();
2115 2116
2116 // Return the generated code. 2117 // Return the generated code.
2117 return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name); 2118 return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name);
2118 } 2119 }
2119 2120
2120 2121
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
2283 // Handle call cache miss. 2284 // Handle call cache miss.
2284 __ bind(&miss); 2285 __ bind(&miss);
2285 GenerateMissBranch(); 2286 GenerateMissBranch();
2286 } 2287 }
2287 2288
2288 2289
2289 void CallStubCompiler::CompileHandlerBackend(Handle<JSFunction> function) { 2290 void CallStubCompiler::CompileHandlerBackend(Handle<JSFunction> function) {
2290 CallKind call_kind = CallICBase::Contextual::decode(extra_state_) 2291 CallKind call_kind = CallICBase::Contextual::decode(extra_state_)
2291 ? CALL_AS_FUNCTION 2292 ? CALL_AS_FUNCTION
2292 : CALL_AS_METHOD; 2293 : CALL_AS_METHOD;
2293 __ InvokeFunction(function, arguments(), JUMP_FUNCTION, 2294 __ InvokeFunction(function, ParameterCount(function), arguments(),
2294 NullCallWrapper(), call_kind); 2295 JUMP_FUNCTION, NullCallWrapper(), call_kind);
2295 } 2296 }
2296 2297
2297 2298
2298 Handle<Code> CallStubCompiler::CompileCallConstant( 2299 Handle<Code> CallStubCompiler::CompileCallConstant(
2299 Handle<Object> object, 2300 Handle<Object> object,
2300 Handle<JSObject> holder, 2301 Handle<JSObject> holder,
2301 Handle<Name> name, 2302 Handle<Name> name,
2302 CheckType check, 2303 CheckType check,
2303 Handle<JSFunction> function) { 2304 Handle<JSFunction> function) {
2304 if (HasCustomCallGenerator(function)) { 2305 if (HasCustomCallGenerator(function)) {
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
2496 FrameScope scope(masm, StackFrame::INTERNAL); 2497 FrameScope scope(masm, StackFrame::INTERNAL);
2497 2498
2498 // Save value register, so we can restore it later. 2499 // Save value register, so we can restore it later.
2499 __ push(rax); 2500 __ push(rax);
2500 2501
2501 if (!setter.is_null()) { 2502 if (!setter.is_null()) {
2502 // Call the JavaScript setter with receiver and value on the stack. 2503 // Call the JavaScript setter with receiver and value on the stack.
2503 __ push(rdx); 2504 __ push(rdx);
2504 __ push(rax); 2505 __ push(rax);
2505 ParameterCount actual(1); 2506 ParameterCount actual(1);
2506 __ InvokeFunction(setter, actual, CALL_FUNCTION, NullCallWrapper(), 2507 ParameterCount expected(setter);
2507 CALL_AS_METHOD); 2508 __ InvokeFunction(setter, expected, actual,
2509 CALL_FUNCTION, NullCallWrapper(), CALL_AS_METHOD);
2508 } else { 2510 } else {
2509 // If we generate a global code snippet for deoptimization only, remember 2511 // If we generate a global code snippet for deoptimization only, remember
2510 // the place to continue after deoptimization. 2512 // the place to continue after deoptimization.
2511 masm->isolate()->heap()->SetSetterStubDeoptPCOffset(masm->pc_offset()); 2513 masm->isolate()->heap()->SetSetterStubDeoptPCOffset(masm->pc_offset());
2512 } 2514 }
2513 2515
2514 // We have to return the passed value, not the return value of the setter. 2516 // We have to return the passed value, not the return value of the setter.
2515 __ pop(rax); 2517 __ pop(rax);
2516 2518
2517 // Restore context register. 2519 // Restore context register.
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
2716 // -- rcx : name 2718 // -- rcx : name
2717 // -- rsp[0] : return address 2719 // -- rsp[0] : return address
2718 // ----------------------------------- 2720 // -----------------------------------
2719 { 2721 {
2720 FrameScope scope(masm, StackFrame::INTERNAL); 2722 FrameScope scope(masm, StackFrame::INTERNAL);
2721 2723
2722 if (!getter.is_null()) { 2724 if (!getter.is_null()) {
2723 // Call the JavaScript getter with the receiver on the stack. 2725 // Call the JavaScript getter with the receiver on the stack.
2724 __ push(rax); 2726 __ push(rax);
2725 ParameterCount actual(0); 2727 ParameterCount actual(0);
2726 __ InvokeFunction(getter, actual, CALL_FUNCTION, NullCallWrapper(), 2728 ParameterCount expected(getter);
2727 CALL_AS_METHOD); 2729 __ InvokeFunction(getter, expected, actual,
2730 CALL_FUNCTION, NullCallWrapper(), CALL_AS_METHOD);
2728 } else { 2731 } else {
2729 // If we generate a global code snippet for deoptimization only, remember 2732 // If we generate a global code snippet for deoptimization only, remember
2730 // the place to continue after deoptimization. 2733 // the place to continue after deoptimization.
2731 masm->isolate()->heap()->SetGetterStubDeoptPCOffset(masm->pc_offset()); 2734 masm->isolate()->heap()->SetGetterStubDeoptPCOffset(masm->pc_offset());
2732 } 2735 }
2733 2736
2734 // Restore context register. 2737 // Restore context register.
2735 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); 2738 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
2736 } 2739 }
2737 __ ret(0); 2740 __ ret(0);
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after
3470 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); 3473 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow);
3471 } 3474 }
3472 } 3475 }
3473 3476
3474 3477
3475 #undef __ 3478 #undef __
3476 3479
3477 } } // namespace v8::internal 3480 } } // namespace v8::internal
3478 3481
3479 #endif // V8_TARGET_ARCH_X64 3482 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/macro-assembler-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698