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

Side by Side Diff: runtime/vm/intermediate_language_ia32.cc

Issue 265443002: VM: Explicitly load function and context before calling a closure. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 7 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 | « runtime/vm/intermediate_language_arm.cc ('k') | runtime/vm/intermediate_language_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 (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 5882 matching lines...) Expand 10 before | Expand all | Expand 10 after
5893 __ andl(EDX, Immediate( 5893 __ andl(EDX, Immediate(
5894 Smi::RawValue(true_value) - Smi::RawValue(false_value))); 5894 Smi::RawValue(true_value) - Smi::RawValue(false_value)));
5895 if (false_value != 0) { 5895 if (false_value != 0) {
5896 __ addl(EDX, Immediate(Smi::RawValue(false_value))); 5896 __ addl(EDX, Immediate(Smi::RawValue(false_value)));
5897 } 5897 }
5898 } 5898 }
5899 } 5899 }
5900 5900
5901 5901
5902 LocationSummary* ClosureCallInstr::MakeLocationSummary(bool opt) const { 5902 LocationSummary* ClosureCallInstr::MakeLocationSummary(bool opt) const {
5903 return MakeCallSummary(); 5903 const intptr_t kNumInputs = 1;
5904 const intptr_t kNumTemps = 0;
5905 LocationSummary* summary =
5906 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall);
5907 summary->set_in(0, Location::RegisterLocation(EAX)); // Function.
5908 summary->set_out(0, Location::RegisterLocation(EAX));
5909 return summary;
5904 } 5910 }
5905 5911
5906 5912
5907 void ClosureCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5913 void ClosureCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5908 // Load closure object (first argument) in EDI. 5914 // Load arguments descriptors.
5909 intptr_t argument_count = ArgumentCount(); 5915 intptr_t argument_count = ArgumentCount();
5910 __ movl(EDI, Address(ESP, (argument_count - 1) * kWordSize));
5911
5912 // Load arguments descriptors.
5913 const Array& arguments_descriptor = 5916 const Array& arguments_descriptor =
5914 Array::ZoneHandle(ArgumentsDescriptor::New(argument_count, 5917 Array::ZoneHandle(ArgumentsDescriptor::New(argument_count,
5915 argument_names())); 5918 argument_names()));
5916 __ LoadObject(EDX, arguments_descriptor); 5919 __ LoadObject(EDX, arguments_descriptor);
5917 5920
5918 // Load the closure function into EAX.
5919 __ movl(EAX, FieldAddress(EDI, Closure::function_offset()));
5920
5921 // Load closure context in CTX; note that CTX has already been preserved.
5922 __ movl(CTX, FieldAddress(EDI, Closure::context_offset()));
5923
5924 // EBX: Code (compiled code or lazy compile stub). 5921 // EBX: Code (compiled code or lazy compile stub).
5922 ASSERT(locs()->in(0).reg() == EAX);
5925 __ movl(EBX, FieldAddress(EAX, Function::code_offset())); 5923 __ movl(EBX, FieldAddress(EAX, Function::code_offset()));
5926 5924
5927 // EAX: Function. 5925 // EAX: Function.
5928 // EDX: Arguments descriptor array. 5926 // EDX: Arguments descriptor array.
5929 // ECX: Smi 0 (no IC data; the lazy-compile stub expects a GC-safe value). 5927 // ECX: Smi 0 (no IC data; the lazy-compile stub expects a GC-safe value).
5930 __ xorl(ECX, ECX); 5928 __ xorl(ECX, ECX);
5931 __ movl(EBX, FieldAddress(EBX, Code::instructions_offset())); 5929 __ movl(EBX, FieldAddress(EBX, Code::instructions_offset()));
5932 __ addl(EBX, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); 5930 __ addl(EBX, Immediate(Instructions::HeaderSize() - kHeapObjectTag));
5933 __ call(EBX); 5931 __ call(EBX);
5934 compiler->AddCurrentDescriptor(PcDescriptors::kClosureCall, 5932 compiler->AddCurrentDescriptor(PcDescriptors::kClosureCall,
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
5984 PcDescriptors::kOther, 5982 PcDescriptors::kOther,
5985 locs()); 5983 locs());
5986 __ Drop(ArgumentCount()); // Discard arguments. 5984 __ Drop(ArgumentCount()); // Discard arguments.
5987 } 5985 }
5988 5986
5989 } // namespace dart 5987 } // namespace dart
5990 5988
5991 #undef __ 5989 #undef __
5992 5990
5993 #endif // defined TARGET_ARCH_IA32 5991 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_arm.cc ('k') | runtime/vm/intermediate_language_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698