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

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

Issue 11783066: Optimize function at its entry instead of at exit. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 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/object.cc ('k') | runtime/vm/stub_code_x64.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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" 5 #include "vm/globals.h"
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/assembler_macros.h" 9 #include "vm/assembler_macros.h"
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 2002 matching lines...) Expand 10 before | Expand all | Expand 10 after
2013 __ pushl(ECX); // ICData 2013 __ pushl(ECX); // ICData
2014 __ CallRuntime(kUpdateICDataTwoArgsRuntimeEntry); 2014 __ CallRuntime(kUpdateICDataTwoArgsRuntimeEntry);
2015 __ Drop(4); 2015 __ Drop(4);
2016 __ LeaveFrame(); 2016 __ LeaveFrame();
2017 2017
2018 __ jmp(&compute_result, Assembler::kNearJump); 2018 __ jmp(&compute_result, Assembler::kNearJump);
2019 } 2019 }
2020 2020
2021 2021
2022 // Calls to runtime to ooptimized give function 2022 // Calls to runtime to ooptimized give function
2023 // EDX: function to be reoptimized. 2023 // EDI: function to be reoptimized.
2024 // EAX: result of function being optimized (preserved). 2024 // EDX: argument descriptor (preserved).
2025 void StubCode::GenerateOptimizeFunctionStub(Assembler* assembler) { 2025 void StubCode::GenerateOptimizeFunctionStub(Assembler* assembler) {
2026 const Immediate raw_null =
2027 Immediate(reinterpret_cast<intptr_t>(Object::null()));
2026 AssemblerMacros::EnterStubFrame(assembler); 2028 AssemblerMacros::EnterStubFrame(assembler);
2027 __ pushl(EAX);
2028 __ pushl(EDX); 2029 __ pushl(EDX);
2030 __ pushl(raw_null); // Setup space on stack for return value.
2031 __ pushl(EDI);
2029 __ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry); 2032 __ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry);
2030 __ popl(EDX); 2033 __ popl(EAX); // Discard argument.
2031 __ popl(EAX); 2034 __ popl(EAX); // Get Code object
2035 __ popl(EDX); // Restore argument descriptor.
2036 __ movl(EAX, FieldAddress(EAX, Code::instructions_offset()));
2037 __ addl(EAX, Immediate(Instructions::HeaderSize() - kHeapObjectTag));
2032 __ LeaveFrame(); 2038 __ LeaveFrame();
2033 __ ret(); 2039 __ jmp(EAX);
2040 __ int3();
2034 } 2041 }
2035 2042
2036 2043
2037 DECLARE_LEAF_RUNTIME_ENTRY(intptr_t, 2044 DECLARE_LEAF_RUNTIME_ENTRY(intptr_t,
2038 BigintCompare, 2045 BigintCompare,
2039 RawBigint* left, 2046 RawBigint* left,
2040 RawBigint* right); 2047 RawBigint* right);
2041 2048
2042 2049
2043 // Does identical check (object references are equal or not equal) with special 2050 // Does identical check (object references are equal or not equal) with special
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
2115 __ Bind(&done); 2122 __ Bind(&done);
2116 __ popl(temp); 2123 __ popl(temp);
2117 __ popl(right); 2124 __ popl(right);
2118 __ popl(left); 2125 __ popl(left);
2119 __ ret(); 2126 __ ret();
2120 } 2127 }
2121 2128
2122 } // namespace dart 2129 } // namespace dart
2123 2130
2124 #endif // defined TARGET_ARCH_IA32 2131 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/stub_code_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698