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

Side by Side Diff: src/x64/lithium-codegen-x64.cc

Issue 10834031: Always set the callee's context when calling a function from optimized code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 5 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/lithium-codegen-mips.cc ('k') | test/mjsunit/regress/regress-crbug-138887.js » ('j') | 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 2874 matching lines...) Expand 10 before | Expand all | Expand 10 after
2885 function->shared()->formal_parameter_count() == arity; 2885 function->shared()->formal_parameter_count() == arity;
2886 2886
2887 LPointerMap* pointers = instr->pointer_map(); 2887 LPointerMap* pointers = instr->pointer_map();
2888 RecordPosition(pointers->position()); 2888 RecordPosition(pointers->position());
2889 2889
2890 if (can_invoke_directly) { 2890 if (can_invoke_directly) {
2891 if (rdi_state == RDI_UNINITIALIZED) { 2891 if (rdi_state == RDI_UNINITIALIZED) {
2892 __ LoadHeapObject(rdi, function); 2892 __ LoadHeapObject(rdi, function);
2893 } 2893 }
2894 2894
2895 // Change context if needed. 2895 // Change context.
2896 bool change_context = 2896 __ movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset));
2897 (info()->closure()->context() != function->context()) ||
2898 scope()->contains_with() ||
2899 (scope()->num_heap_slots() > 0);
2900 if (change_context) {
2901 __ movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset));
2902 }
2903 2897
2904 // Set rax to arguments count if adaption is not needed. Assumes that rax 2898 // Set rax to arguments count if adaption is not needed. Assumes that rax
2905 // is available to write to at this point. 2899 // is available to write to at this point.
2906 if (!function->NeedsArgumentsAdaption()) { 2900 if (!function->NeedsArgumentsAdaption()) {
2907 __ Set(rax, arity); 2901 __ Set(rax, arity);
2908 } 2902 }
2909 2903
2910 // Invoke function. 2904 // Invoke function.
2911 __ SetCallKind(rcx, call_kind); 2905 __ SetCallKind(rcx, call_kind);
2912 if (*function == *info()->closure()) { 2906 if (*function == *info()->closure()) {
(...skipping 2164 matching lines...) Expand 10 before | Expand all | Expand 10 after
5077 FixedArray::kHeaderSize - kPointerSize)); 5071 FixedArray::kHeaderSize - kPointerSize));
5078 __ bind(&done); 5072 __ bind(&done);
5079 } 5073 }
5080 5074
5081 5075
5082 #undef __ 5076 #undef __
5083 5077
5084 } } // namespace v8::internal 5078 } } // namespace v8::internal
5085 5079
5086 #endif // V8_TARGET_ARCH_X64 5080 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/mips/lithium-codegen-mips.cc ('k') | test/mjsunit/regress/regress-crbug-138887.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698