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

Side by Side Diff: vm/stub_code_ia32.cc

Issue 10664004: Fix issue 1968, replace usage of inline 'asm' constructs in 'stack alignment', 'jump to exception h… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
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 | « vm/stub_code_arm.cc ('k') | 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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/code_generator.h" 10 #include "vm/code_generator.h"
(...skipping 1888 matching lines...) Expand 10 before | Expand all | Expand 10 after
1899 // Used to check class and type arguments. Arguments passed on stack: 1899 // Used to check class and type arguments. Arguments passed on stack:
1900 // TOS + 0: return address. 1900 // TOS + 0: return address.
1901 // TOS + 1: instantiator type arguments. 1901 // TOS + 1: instantiator type arguments.
1902 // TOS + 2: instance. 1902 // TOS + 2: instance.
1903 // TOS + 3: cache array. 1903 // TOS + 3: cache array.
1904 // Result in ECX: null -> not found, otherwise result (true or false). 1904 // Result in ECX: null -> not found, otherwise result (true or false).
1905 void StubCode::GenerateSubtype3TestCacheStub(Assembler* assembler) { 1905 void StubCode::GenerateSubtype3TestCacheStub(Assembler* assembler) {
1906 GenerateSubtypeNTestCacheStub(assembler, 3); 1906 GenerateSubtypeNTestCacheStub(assembler, 3);
1907 } 1907 }
1908 1908
1909
1910 // Return the current stack pointer address, used to stack alignment
1911 // checks.
1912 // TOS + 0: return address
1913 // Result in EAX.
1914 void StubCode::GenerateGetStackPointerStub(Assembler* assembler) {
1915 __ leal(EAX, Address(ESP, kWordSize));
1916 __ ret();
1917 }
1918
1919
1920 // Jump to the exception handler.
1921 // TOS + 0: return address
1922 // TOS + 1: program_counter
1923 // TOS + 2: stack_pointer
1924 // TOS + 3: frame_pointer
1925 // TOS + 4: exception object
1926 // TOS + 5: stacktrace object
1927 // No Result.
1928 void StubCode::GenerateJumpToExceptionHandlerStub(Assembler* assembler) {
1929 ASSERT(kExceptionObjectReg == EAX);
1930 ASSERT(kStackTraceObjectReg == EDX);
1931 __ movl(kStackTraceObjectReg, Address(ESP, 5 * kWordSize));
1932 __ movl(kExceptionObjectReg, Address(ESP, 4 * kWordSize));
1933 __ movl(EBP, Address(ESP, 3 * kWordSize)); // Load target frame_pointer.
1934 __ movl(EBX, Address(ESP, 1 * kWordSize)); // Load target PC into EBX.
1935 __ movl(ESP, Address(ESP, 2 * kWordSize)); // Load target stack_pointer.
1936 __ jmp(EBX); // Jump to the exception handler code.
1937 }
1938
1939
1940 // Jump to the error handler.
1941 // TOS + 0: return address
1942 // TOS + 1: program_counter
1943 // TOS + 2: stack_pointer
1944 // TOS + 3: frame_pointer
1945 // TOS + 4: error object
1946 // No Result.
1947 void StubCode::GenerateJumpToErrorHandlerStub(Assembler* assembler) {
1948 __ movl(EAX, Address(ESP, 4 * kWordSize)); // Load error object.
1949 __ movl(EBP, Address(ESP, 3 * kWordSize)); // Load target frame_pointer.
1950 __ movl(EBX, Address(ESP, 1 * kWordSize)); // Load target PC into EBX.
1951 __ movl(ESP, Address(ESP, 2 * kWordSize)); // Load target stack_pointer.
1952 __ jmp(EBX); // Jump to the exception handler code.
1953 }
1954
1909 } // namespace dart 1955 } // namespace dart
1910 1956
1911 #endif // defined TARGET_ARCH_IA32 1957 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « vm/stub_code_arm.cc ('k') | vm/stub_code_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698