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

Side by Side Diff: src/ia32/lithium-codegen-ia32.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, 4 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/arm/lithium-codegen-arm.cc ('k') | src/mips/lithium-codegen-mips.cc » ('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 2995 matching lines...) Expand 10 before | Expand all | Expand 10 after
3006 function->shared()->formal_parameter_count() == arity; 3006 function->shared()->formal_parameter_count() == arity;
3007 3007
3008 LPointerMap* pointers = instr->pointer_map(); 3008 LPointerMap* pointers = instr->pointer_map();
3009 RecordPosition(pointers->position()); 3009 RecordPosition(pointers->position());
3010 3010
3011 if (can_invoke_directly) { 3011 if (can_invoke_directly) {
3012 if (edi_state == EDI_UNINITIALIZED) { 3012 if (edi_state == EDI_UNINITIALIZED) {
3013 __ LoadHeapObject(edi, function); 3013 __ LoadHeapObject(edi, function);
3014 } 3014 }
3015 3015
3016 // Change context if needed. 3016 // Change context.
3017 bool change_context = 3017 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset));
3018 (info()->closure()->context() != function->context()) ||
3019 scope()->contains_with() ||
3020 (scope()->num_heap_slots() > 0);
3021
3022 if (change_context) {
3023 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset));
3024 } else {
3025 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
3026 }
3027 3018
3028 // Set eax to arguments count if adaption is not needed. Assumes that eax 3019 // Set eax to arguments count if adaption is not needed. Assumes that eax
3029 // is available to write to at this point. 3020 // is available to write to at this point.
3030 if (!function->NeedsArgumentsAdaption()) { 3021 if (!function->NeedsArgumentsAdaption()) {
3031 __ mov(eax, arity); 3022 __ mov(eax, arity);
3032 } 3023 }
3033 3024
3034 // Invoke function directly. 3025 // Invoke function directly.
3035 __ SetCallKind(ecx, call_kind); 3026 __ SetCallKind(ecx, call_kind);
3036 if (*function == *info()->closure()) { 3027 if (*function == *info()->closure()) {
(...skipping 2322 matching lines...) Expand 10 before | Expand all | Expand 10 after
5359 FixedArray::kHeaderSize - kPointerSize)); 5350 FixedArray::kHeaderSize - kPointerSize));
5360 __ bind(&done); 5351 __ bind(&done);
5361 } 5352 }
5362 5353
5363 5354
5364 #undef __ 5355 #undef __
5365 5356
5366 } } // namespace v8::internal 5357 } } // namespace v8::internal
5367 5358
5368 #endif // V8_TARGET_ARCH_IA32 5359 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/arm/lithium-codegen-arm.cc ('k') | src/mips/lithium-codegen-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698