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

Side by Side Diff: src/ia32/macro-assembler-ia32.cc

Issue 1455293004: Simplify MacroAssembler::InvokePrologue a bit. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix MIPS64 compilation. Created 5 years, 1 month 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
« no previous file with comments | « src/ia32/macro-assembler-ia32.h ('k') | src/mips/macro-assembler-mips.h » ('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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if V8_TARGET_ARCH_IA32 5 #if V8_TARGET_ARCH_IA32
6 6
7 #include "src/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/base/division-by-constant.h" 8 #include "src/base/division-by-constant.h"
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 1903 matching lines...) Expand 10 before | Expand all | Expand 10 after
1914 void MacroAssembler::JumpToExternalReference(const ExternalReference& ext) { 1914 void MacroAssembler::JumpToExternalReference(const ExternalReference& ext) {
1915 // Set the entry point and jump to the C entry runtime stub. 1915 // Set the entry point and jump to the C entry runtime stub.
1916 mov(ebx, Immediate(ext)); 1916 mov(ebx, Immediate(ext));
1917 CEntryStub ces(isolate(), 1); 1917 CEntryStub ces(isolate(), 1);
1918 jmp(ces.GetCode(), RelocInfo::CODE_TARGET); 1918 jmp(ces.GetCode(), RelocInfo::CODE_TARGET);
1919 } 1919 }
1920 1920
1921 1921
1922 void MacroAssembler::InvokePrologue(const ParameterCount& expected, 1922 void MacroAssembler::InvokePrologue(const ParameterCount& expected,
1923 const ParameterCount& actual, 1923 const ParameterCount& actual,
1924 Handle<Code> code_constant,
1925 const Operand& code_operand,
1926 Label* done, 1924 Label* done,
1927 bool* definitely_mismatches, 1925 bool* definitely_mismatches,
1928 InvokeFlag flag, 1926 InvokeFlag flag,
1929 Label::Distance done_near, 1927 Label::Distance done_near,
1930 const CallWrapper& call_wrapper) { 1928 const CallWrapper& call_wrapper) {
1931 bool definitely_matches = false; 1929 bool definitely_matches = false;
1932 *definitely_mismatches = false; 1930 *definitely_mismatches = false;
1933 Label invoke; 1931 Label invoke;
1934 if (expected.is_immediate()) { 1932 if (expected.is_immediate()) {
1935 DCHECK(actual.is_immediate()); 1933 DCHECK(actual.is_immediate());
(...skipping 30 matching lines...) Expand all
1966 DCHECK(actual.reg().is(eax)); 1964 DCHECK(actual.reg().is(eax));
1967 DCHECK(expected.reg().is(ebx)); 1965 DCHECK(expected.reg().is(ebx));
1968 } else { 1966 } else {
1969 Move(eax, actual.reg()); 1967 Move(eax, actual.reg());
1970 } 1968 }
1971 } 1969 }
1972 1970
1973 if (!definitely_matches) { 1971 if (!definitely_matches) {
1974 Handle<Code> adaptor = 1972 Handle<Code> adaptor =
1975 isolate()->builtins()->ArgumentsAdaptorTrampoline(); 1973 isolate()->builtins()->ArgumentsAdaptorTrampoline();
1976 if (!code_constant.is_null()) {
1977 mov(edx, Immediate(code_constant));
1978 add(edx, Immediate(Code::kHeaderSize - kHeapObjectTag));
1979 } else if (!code_operand.is_reg(edx)) {
1980 mov(edx, code_operand);
1981 }
1982
1983 if (flag == CALL_FUNCTION) { 1974 if (flag == CALL_FUNCTION) {
1984 call_wrapper.BeforeCall(CallSize(adaptor, RelocInfo::CODE_TARGET)); 1975 call_wrapper.BeforeCall(CallSize(adaptor, RelocInfo::CODE_TARGET));
1985 call(adaptor, RelocInfo::CODE_TARGET); 1976 call(adaptor, RelocInfo::CODE_TARGET);
1986 call_wrapper.AfterCall(); 1977 call_wrapper.AfterCall();
1987 if (!*definitely_mismatches) { 1978 if (!*definitely_mismatches) {
1988 jmp(done, done_near); 1979 jmp(done, done_near);
1989 } 1980 }
1990 } else { 1981 } else {
1991 jmp(adaptor, RelocInfo::CODE_TARGET); 1982 jmp(adaptor, RelocInfo::CODE_TARGET);
1992 } 1983 }
1993 bind(&invoke); 1984 bind(&invoke);
1994 } 1985 }
1995 } 1986 }
1996 1987
1997 1988
1998 void MacroAssembler::InvokeCode(const Operand& code, 1989 void MacroAssembler::InvokeCode(const Operand& code,
1999 const ParameterCount& expected, 1990 const ParameterCount& expected,
2000 const ParameterCount& actual, 1991 const ParameterCount& actual,
2001 InvokeFlag flag, 1992 InvokeFlag flag,
2002 const CallWrapper& call_wrapper) { 1993 const CallWrapper& call_wrapper) {
2003 // You can't call a function without a valid frame. 1994 // You can't call a function without a valid frame.
2004 DCHECK(flag == JUMP_FUNCTION || has_frame()); 1995 DCHECK(flag == JUMP_FUNCTION || has_frame());
2005 1996
2006 Label done; 1997 Label done;
2007 bool definitely_mismatches = false; 1998 bool definitely_mismatches = false;
2008 InvokePrologue(expected, actual, Handle<Code>::null(), code, 1999 InvokePrologue(expected, actual, &done, &definitely_mismatches, flag,
2009 &done, &definitely_mismatches, flag, Label::kNear, 2000 Label::kNear, call_wrapper);
2010 call_wrapper);
2011 if (!definitely_mismatches) { 2001 if (!definitely_mismatches) {
2012 if (flag == CALL_FUNCTION) { 2002 if (flag == CALL_FUNCTION) {
2013 call_wrapper.BeforeCall(CallSize(code)); 2003 call_wrapper.BeforeCall(CallSize(code));
2014 call(code); 2004 call(code);
2015 call_wrapper.AfterCall(); 2005 call_wrapper.AfterCall();
2016 } else { 2006 } else {
2017 DCHECK(flag == JUMP_FUNCTION); 2007 DCHECK(flag == JUMP_FUNCTION);
2018 jmp(code); 2008 jmp(code);
2019 } 2009 }
2020 bind(&done); 2010 bind(&done);
(...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after
3147 mov(eax, dividend); 3137 mov(eax, dividend);
3148 shr(eax, 31); 3138 shr(eax, 31);
3149 add(edx, eax); 3139 add(edx, eax);
3150 } 3140 }
3151 3141
3152 3142
3153 } // namespace internal 3143 } // namespace internal
3154 } // namespace v8 3144 } // namespace v8
3155 3145
3156 #endif // V8_TARGET_ARCH_IA32 3146 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/macro-assembler-ia32.h ('k') | src/mips/macro-assembler-mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698