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

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

Issue 132373011: A64: Synchronize with r17635. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 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/ia32/macro-assembler-ia32.h ('k') | src/ia32/stub-cache-ia32.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 allow_stub_calls_(true), 49 allow_stub_calls_(true),
50 has_frame_(false) { 50 has_frame_(false) {
51 if (isolate() != NULL) { 51 if (isolate() != NULL) {
52 // TODO(titzer): should we just use a null handle here instead? 52 // TODO(titzer): should we just use a null handle here instead?
53 code_object_ = Handle<Object>(isolate()->heap()->undefined_value(), 53 code_object_ = Handle<Object>(isolate()->heap()->undefined_value(),
54 isolate()); 54 isolate());
55 } 55 }
56 } 56 }
57 57
58 58
59 void MacroAssembler::Load(Register dst, const Operand& src, Representation r) {
60 ASSERT(!r.IsDouble());
61 if (r.IsInteger8()) {
62 movsx_b(dst, src);
63 } else if (r.IsUInteger8()) {
64 movzx_b(dst, src);
65 } else if (r.IsInteger16()) {
66 movsx_w(dst, src);
67 } else if (r.IsUInteger16()) {
68 movzx_w(dst, src);
69 } else {
70 mov(dst, src);
71 }
72 }
73
74
75 void MacroAssembler::Store(Register src, const Operand& dst, Representation r) {
76 ASSERT(!r.IsDouble());
77 if (r.IsInteger8() || r.IsUInteger8()) {
78 mov_b(dst, src);
79 } else if (r.IsInteger16() || r.IsUInteger16()) {
80 mov_w(dst, src);
81 } else {
82 mov(dst, src);
83 }
84 }
85
86
59 void MacroAssembler::LoadRoot(Register destination, Heap::RootListIndex index) { 87 void MacroAssembler::LoadRoot(Register destination, Heap::RootListIndex index) {
60 if (isolate()->heap()->RootCanBeTreatedAsConstant(index)) { 88 if (isolate()->heap()->RootCanBeTreatedAsConstant(index)) {
61 Handle<Object> value(&isolate()->heap()->roots_array_start()[index]); 89 Handle<Object> value(&isolate()->heap()->roots_array_start()[index]);
62 mov(destination, value); 90 mov(destination, value);
63 return; 91 return;
64 } 92 }
65 ExternalReference roots_array_start = 93 ExternalReference roots_array_start =
66 ExternalReference::roots_array_start(isolate()); 94 ExternalReference::roots_array_start(isolate());
67 mov(destination, Immediate(index)); 95 mov(destination, Immediate(index));
68 mov(destination, Operand::StaticArray(destination, 96 mov(destination, Operand::StaticArray(destination,
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after
860 push(scratch1); 888 push(scratch1);
861 fild_s(Operand(esp, 0)); 889 fild_s(Operand(esp, 0));
862 pop(scratch1); 890 pop(scratch1);
863 fstp_d(FieldOperand(elements, key, times_4, 891 fstp_d(FieldOperand(elements, key, times_4,
864 FixedDoubleArray::kHeaderSize - elements_offset)); 892 FixedDoubleArray::kHeaderSize - elements_offset));
865 } 893 }
866 bind(&done); 894 bind(&done);
867 } 895 }
868 896
869 897
870 void MacroAssembler::CompareMap(Register obj, 898 void MacroAssembler::CompareMap(Register obj, Handle<Map> map) {
871 Handle<Map> map,
872 Label* early_success) {
873 cmp(FieldOperand(obj, HeapObject::kMapOffset), map); 899 cmp(FieldOperand(obj, HeapObject::kMapOffset), map);
874 } 900 }
875 901
876 902
877 void MacroAssembler::CheckMap(Register obj, 903 void MacroAssembler::CheckMap(Register obj,
878 Handle<Map> map, 904 Handle<Map> map,
879 Label* fail, 905 Label* fail,
880 SmiCheckType smi_check_type) { 906 SmiCheckType smi_check_type) {
881 if (smi_check_type == DO_SMI_CHECK) { 907 if (smi_check_type == DO_SMI_CHECK) {
882 JumpIfSmi(obj, fail); 908 JumpIfSmi(obj, fail);
883 } 909 }
884 910
885 Label success; 911 CompareMap(obj, map);
886 CompareMap(obj, map, &success);
887 j(not_equal, fail); 912 j(not_equal, fail);
888 bind(&success);
889 } 913 }
890 914
891 915
892 void MacroAssembler::DispatchMap(Register obj, 916 void MacroAssembler::DispatchMap(Register obj,
893 Register unused, 917 Register unused,
894 Handle<Map> map, 918 Handle<Map> map,
895 Handle<Code> success, 919 Handle<Code> success,
896 SmiCheckType smi_check_type) { 920 SmiCheckType smi_check_type) {
897 Label fail; 921 Label fail;
898 if (smi_check_type == DO_SMI_CHECK) { 922 if (smi_check_type == DO_SMI_CHECK) {
(...skipping 1080 matching lines...) Expand 10 before | Expand all | Expand 10 after
1979 // Source and destination are incremented by length. 2003 // Source and destination are incremented by length.
1980 // Many variants of movsb, loop unrolling, word moves, and indexed operands 2004 // Many variants of movsb, loop unrolling, word moves, and indexed operands
1981 // have been tried here already, and this is fastest. 2005 // have been tried here already, and this is fastest.
1982 // A simpler loop is faster on small copies, but 30% slower on large ones. 2006 // A simpler loop is faster on small copies, but 30% slower on large ones.
1983 // The cld() instruction must have been emitted, to set the direction flag(), 2007 // The cld() instruction must have been emitted, to set the direction flag(),
1984 // before calling this function. 2008 // before calling this function.
1985 void MacroAssembler::CopyBytes(Register source, 2009 void MacroAssembler::CopyBytes(Register source,
1986 Register destination, 2010 Register destination,
1987 Register length, 2011 Register length,
1988 Register scratch) { 2012 Register scratch) {
1989 Label loop, done, short_string, short_loop; 2013 Label short_loop, len4, len8, len12, done, short_string;
1990 // Experimentation shows that the short string loop is faster if length < 10.
1991 cmp(length, Immediate(10));
1992 j(less_equal, &short_string);
1993
1994 ASSERT(source.is(esi)); 2014 ASSERT(source.is(esi));
1995 ASSERT(destination.is(edi)); 2015 ASSERT(destination.is(edi));
1996 ASSERT(length.is(ecx)); 2016 ASSERT(length.is(ecx));
2017 cmp(length, Immediate(4));
2018 j(below, &short_string, Label::kNear);
1997 2019
1998 // Because source is 4-byte aligned in our uses of this function, 2020 // Because source is 4-byte aligned in our uses of this function,
1999 // we keep source aligned for the rep_movs call by copying the odd bytes 2021 // we keep source aligned for the rep_movs call by copying the odd bytes
2000 // at the end of the ranges. 2022 // at the end of the ranges.
2001 mov(scratch, Operand(source, length, times_1, -4)); 2023 mov(scratch, Operand(source, length, times_1, -4));
2002 mov(Operand(destination, length, times_1, -4), scratch); 2024 mov(Operand(destination, length, times_1, -4), scratch);
2025
2026 cmp(length, Immediate(8));
2027 j(below_equal, &len4, Label::kNear);
2028 cmp(length, Immediate(12));
2029 j(below_equal, &len8, Label::kNear);
2030 cmp(length, Immediate(16));
2031 j(below_equal, &len12, Label::kNear);
2032
2003 mov(scratch, ecx); 2033 mov(scratch, ecx);
2004 shr(ecx, 2); 2034 shr(ecx, 2);
2005 rep_movs(); 2035 rep_movs();
2006 and_(scratch, Immediate(0x3)); 2036 and_(scratch, Immediate(0x3));
2007 add(destination, scratch); 2037 add(destination, scratch);
2008 jmp(&done); 2038 jmp(&done, Label::kNear);
2039
2040 bind(&len12);
2041 mov(scratch, Operand(source, 8));
2042 mov(Operand(destination, 8), scratch);
2043 bind(&len8);
2044 mov(scratch, Operand(source, 4));
2045 mov(Operand(destination, 4), scratch);
2046 bind(&len4);
2047 mov(scratch, Operand(source, 0));
2048 mov(Operand(destination, 0), scratch);
2049 add(destination, length);
2050 jmp(&done, Label::kNear);
2009 2051
2010 bind(&short_string); 2052 bind(&short_string);
2011 test(length, length); 2053 test(length, length);
2012 j(zero, &done); 2054 j(zero, &done, Label::kNear);
2013 2055
2014 bind(&short_loop); 2056 bind(&short_loop);
2015 mov_b(scratch, Operand(source, 0)); 2057 mov_b(scratch, Operand(source, 0));
2016 mov_b(Operand(destination, 0), scratch); 2058 mov_b(Operand(destination, 0), scratch);
2017 inc(source); 2059 inc(source);
2018 inc(destination); 2060 inc(destination);
2019 dec(length); 2061 dec(length);
2020 j(not_zero, &short_loop); 2062 j(not_zero, &short_loop);
2021 2063
2022 bind(&done); 2064 bind(&done);
(...skipping 1550 matching lines...) Expand 10 before | Expand all | Expand 10 after
3573 cmp(scratch1, Immediate(DICTIONARY_ELEMENTS)); 3615 cmp(scratch1, Immediate(DICTIONARY_ELEMENTS));
3574 j(equal, found); 3616 j(equal, found);
3575 mov(current, FieldOperand(current, Map::kPrototypeOffset)); 3617 mov(current, FieldOperand(current, Map::kPrototypeOffset));
3576 cmp(current, Immediate(factory->null_value())); 3618 cmp(current, Immediate(factory->null_value()));
3577 j(not_equal, &loop_again); 3619 j(not_equal, &loop_again);
3578 } 3620 }
3579 3621
3580 } } // namespace v8::internal 3622 } } // namespace v8::internal
3581 3623
3582 #endif // V8_TARGET_ARCH_IA32 3624 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/macro-assembler-ia32.h ('k') | src/ia32/stub-cache-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698