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

Side by Side Diff: src/x64/lithium-codegen-x64.cc

Issue 6368097: X64 Crankshaft: Port TaggedToI to X64. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 10 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/x64/disasm-x64.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 1936 matching lines...) Expand 10 before | Expand all | Expand 10 after
1947 __ jmp(&done); 1947 __ jmp(&done);
1948 1948
1949 // Smi to XMM conversion 1949 // Smi to XMM conversion
1950 __ bind(&load_smi); 1950 __ bind(&load_smi);
1951 __ SmiToInteger32(kScratchRegister, input_reg); // Untag smi first. 1951 __ SmiToInteger32(kScratchRegister, input_reg); // Untag smi first.
1952 __ cvtlsi2sd(result_reg, kScratchRegister); 1952 __ cvtlsi2sd(result_reg, kScratchRegister);
1953 __ bind(&done); 1953 __ bind(&done);
1954 } 1954 }
1955 1955
1956 1956
1957 class DeferredTaggedToI: public LDeferredCode {
1958 public:
1959 DeferredTaggedToI(LCodeGen* codegen, LTaggedToI* instr)
1960 : LDeferredCode(codegen), instr_(instr) { }
1961 virtual void Generate() { codegen()->DoDeferredTaggedToI(instr_); }
1962 private:
1963 LTaggedToI* instr_;
1964 };
1965
1966
1957 void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr) { 1967 void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr) {
1958 Abort("Unimplemented: %s", "DoDeferredTaggedToI"); 1968 NearLabel done, heap_number;
1969 Register input_reg = ToRegister(instr->InputAt(0));
1970
1971 // Heap number map check.
1972 __ CompareRoot(FieldOperand(input_reg, HeapObject::kMapOffset),
1973 Heap::kHeapNumberMapRootIndex);
1974
1975 if (instr->truncating()) {
1976 __ j(equal, &heap_number);
1977 // Check for undefined. Undefined is converted to zero for truncating
1978 // conversions.
1979 __ CompareRoot(input_reg, Heap::kUndefinedValueRootIndex);
1980 DeoptimizeIf(not_equal, instr->environment());
1981 __ movl(input_reg, Immediate(0));
1982 __ jmp(&done);
1983
1984 __ bind(&heap_number);
1985
1986 __ movsd(xmm0, FieldOperand(input_reg, HeapNumber::kValueOffset));
1987 __ cvttsd2siq(input_reg, xmm0);
1988 __ Set(kScratchRegister, V8_UINT64_C(0x8000000000000000));
1989 __ cmpl(input_reg, kScratchRegister);
1990 DeoptimizeIf(equal, instr->environment());
1991 } else {
1992 // Deoptimize if we don't have a heap number.
1993 DeoptimizeIf(not_equal, instr->environment());
1994
1995 XMMRegister xmm_temp = ToDoubleRegister(instr->TempAt(0));
1996 __ movsd(xmm0, FieldOperand(input_reg, HeapNumber::kValueOffset));
1997 __ cvttsd2si(input_reg, xmm0);
1998 __ cvtlsi2sd(xmm_temp, input_reg);
1999 __ ucomisd(xmm0, xmm_temp);
2000 DeoptimizeIf(not_equal, instr->environment());
2001 DeoptimizeIf(parity_even, instr->environment()); // NaN.
2002 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
2003 __ testl(input_reg, input_reg);
2004 __ j(not_zero, &done);
2005 __ movmskpd(input_reg, xmm0);
2006 __ andl(input_reg, Immediate(1));
2007 DeoptimizeIf(not_zero, instr->environment());
2008 }
2009 }
2010 __ bind(&done);
1959 } 2011 }
1960 2012
1961 2013
1962 void LCodeGen::DoTaggedToI(LTaggedToI* instr) { 2014 void LCodeGen::DoTaggedToI(LTaggedToI* instr) {
1963 Abort("Unimplemented: %s", "DoTaggedToI"); 2015 LOperand* input = instr->InputAt(0);
2016 ASSERT(input->IsRegister());
2017 ASSERT(input->Equals(instr->result()));
2018
2019 Register input_reg = ToRegister(input);
2020 DeferredTaggedToI* deferred = new DeferredTaggedToI(this, instr);
2021 __ JumpIfNotSmi(input_reg, deferred->entry());
2022 __ SmiToInteger32(input_reg, input_reg);
2023 __ bind(deferred->exit());
1964 } 2024 }
1965 2025
1966 2026
1967 void LCodeGen::DoNumberUntagD(LNumberUntagD* instr) { 2027 void LCodeGen::DoNumberUntagD(LNumberUntagD* instr) {
1968 Abort("Unimplemented: %s", "DoNumberUntagD"); 2028 Abort("Unimplemented: %s", "DoNumberUntagD");
1969 } 2029 }
1970 2030
1971 2031
1972 void LCodeGen::DoDoubleToI(LDoubleToI* instr) { 2032 void LCodeGen::DoDoubleToI(LDoubleToI* instr) {
1973 Abort("Unimplemented: %s", "DoDoubleToI"); 2033 Abort("Unimplemented: %s", "DoDoubleToI");
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
2210 2270
2211 2271
2212 void LCodeGen::DoDeleteProperty(LDeleteProperty* instr) { 2272 void LCodeGen::DoDeleteProperty(LDeleteProperty* instr) {
2213 Abort("Unimplemented: %s", "DoDeleteProperty"); 2273 Abort("Unimplemented: %s", "DoDeleteProperty");
2214 } 2274 }
2215 2275
2216 2276
2217 void LCodeGen::DoStackCheck(LStackCheck* instr) { 2277 void LCodeGen::DoStackCheck(LStackCheck* instr) {
2218 // Perform stack overflow check. 2278 // Perform stack overflow check.
2219 NearLabel done; 2279 NearLabel done;
2220 ExternalReference stack_limit = ExternalReference::address_of_stack_limit();
2221 __ CompareRoot(rsp, Heap::kStackLimitRootIndex); 2280 __ CompareRoot(rsp, Heap::kStackLimitRootIndex);
2222 __ j(above_equal, &done); 2281 __ j(above_equal, &done);
2223 2282
2224 StackCheckStub stub; 2283 StackCheckStub stub;
2225 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); 2284 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
2226 __ bind(&done); 2285 __ bind(&done);
2227 } 2286 }
2228 2287
2229 2288
2230 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { 2289 void LCodeGen::DoOsrEntry(LOsrEntry* instr) {
2231 Abort("Unimplemented: %s", "DoOsrEntry"); 2290 Abort("Unimplemented: %s", "DoOsrEntry");
2232 } 2291 }
2233 2292
2234 #undef __ 2293 #undef __
2235 2294
2236 } } // namespace v8::internal 2295 } } // namespace v8::internal
2237 2296
2238 #endif // V8_TARGET_ARCH_X64 2297 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/disasm-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698