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

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

Issue 2627783006: Version 5.7.442.2 (cherry-pick) (Closed)
Patch Set: Created 3 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
« no previous file with comments | « src/x64/code-stubs-x64.cc ('k') | src/x64/macro-assembler-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 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 #include "src/x64/codegen-x64.h" 5 #include "src/x64/codegen-x64.h"
6 6
7 #if V8_TARGET_ARCH_X64 7 #if V8_TARGET_ARCH_X64
8 8
9 #include "src/codegen.h" 9 #include "src/codegen.h"
10 #include "src/macro-assembler.h" 10 #include "src/macro-assembler.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 // ------------------------------------------------------------------------- 60 // -------------------------------------------------------------------------
61 // Code generators 61 // Code generators
62 62
63 #define __ ACCESS_MASM(masm) 63 #define __ ACCESS_MASM(masm)
64 64
65 void StringCharLoadGenerator::Generate(MacroAssembler* masm, 65 void StringCharLoadGenerator::Generate(MacroAssembler* masm,
66 Register string, 66 Register string,
67 Register index, 67 Register index,
68 Register result, 68 Register result,
69 Label* call_runtime) { 69 Label* call_runtime) {
70 Label indirect_string_loaded;
71 __ bind(&indirect_string_loaded);
72
73 // Fetch the instance type of the receiver into result register. 70 // Fetch the instance type of the receiver into result register.
74 __ movp(result, FieldOperand(string, HeapObject::kMapOffset)); 71 __ movp(result, FieldOperand(string, HeapObject::kMapOffset));
75 __ movzxbl(result, FieldOperand(result, Map::kInstanceTypeOffset)); 72 __ movzxbl(result, FieldOperand(result, Map::kInstanceTypeOffset));
76 73
77 // We need special handling for indirect strings. 74 // We need special handling for indirect strings.
78 Label check_sequential; 75 Label check_sequential;
79 __ testb(result, Immediate(kIsIndirectStringMask)); 76 __ testb(result, Immediate(kIsIndirectStringMask));
80 __ j(zero, &check_sequential, Label::kNear); 77 __ j(zero, &check_sequential, Label::kNear);
81 78
82 // Dispatch on the indirect string shape: slice or cons. 79 // Dispatch on the indirect string shape: slice or cons.
83 Label cons_string, thin_string; 80 Label cons_string;
84 __ andl(result, Immediate(kStringRepresentationMask)); 81 __ testb(result, Immediate(kSlicedNotConsMask));
85 __ cmpl(result, Immediate(kConsStringTag)); 82 __ j(zero, &cons_string, Label::kNear);
86 __ j(equal, &cons_string, Label::kNear);
87 __ cmpl(result, Immediate(kThinStringTag));
88 __ j(equal, &thin_string, Label::kNear);
89 83
90 // Handle slices. 84 // Handle slices.
85 Label indirect_string_loaded;
91 __ SmiToInteger32(result, FieldOperand(string, SlicedString::kOffsetOffset)); 86 __ SmiToInteger32(result, FieldOperand(string, SlicedString::kOffsetOffset));
92 __ addp(index, result); 87 __ addp(index, result);
93 __ movp(string, FieldOperand(string, SlicedString::kParentOffset)); 88 __ movp(string, FieldOperand(string, SlicedString::kParentOffset));
94 __ jmp(&indirect_string_loaded); 89 __ jmp(&indirect_string_loaded, Label::kNear);
95
96 // Handle thin strings.
97 __ bind(&thin_string);
98 __ movp(string, FieldOperand(string, ThinString::kActualOffset));
99 __ jmp(&indirect_string_loaded);
100 90
101 // Handle cons strings. 91 // Handle cons strings.
102 // Check whether the right hand side is the empty string (i.e. if 92 // Check whether the right hand side is the empty string (i.e. if
103 // this is really a flat string in a cons string). If that is not 93 // this is really a flat string in a cons string). If that is not
104 // the case we would rather go to the runtime system now to flatten 94 // the case we would rather go to the runtime system now to flatten
105 // the string. 95 // the string.
106 __ bind(&cons_string); 96 __ bind(&cons_string);
107 __ CompareRoot(FieldOperand(string, ConsString::kSecondOffset), 97 __ CompareRoot(FieldOperand(string, ConsString::kSecondOffset),
108 Heap::kempty_stringRootIndex); 98 Heap::kempty_stringRootIndex);
109 __ j(not_equal, call_runtime); 99 __ j(not_equal, call_runtime);
110 __ movp(string, FieldOperand(string, ConsString::kFirstOffset)); 100 __ movp(string, FieldOperand(string, ConsString::kFirstOffset));
111 __ jmp(&indirect_string_loaded); 101
102 __ bind(&indirect_string_loaded);
103 __ movp(result, FieldOperand(string, HeapObject::kMapOffset));
104 __ movzxbl(result, FieldOperand(result, Map::kInstanceTypeOffset));
112 105
113 // Distinguish sequential and external strings. Only these two string 106 // Distinguish sequential and external strings. Only these two string
114 // representations can reach here (slices and flat cons strings have been 107 // representations can reach here (slices and flat cons strings have been
115 // reduced to the underlying sequential or external string). 108 // reduced to the underlying sequential or external string).
116 Label seq_string; 109 Label seq_string;
117 __ bind(&check_sequential); 110 __ bind(&check_sequential);
118 STATIC_ASSERT(kSeqStringTag == 0); 111 STATIC_ASSERT(kSeqStringTag == 0);
119 __ testb(result, Immediate(kStringRepresentationMask)); 112 __ testb(result, Immediate(kStringRepresentationMask));
120 __ j(zero, &seq_string, Label::kNear); 113 __ j(zero, &seq_string, Label::kNear);
121 114
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 return Operand(base_reg_, argument_count_reg_, times_pointer_size, 239 return Operand(base_reg_, argument_count_reg_, times_pointer_size,
247 displacement_to_last_argument + (receiver - 1 - index) * kPointerSize); 240 displacement_to_last_argument + (receiver - 1 - index) * kPointerSize);
248 } 241 }
249 } 242 }
250 243
251 244
252 } // namespace internal 245 } // namespace internal
253 } // namespace v8 246 } // namespace v8
254 247
255 #endif // V8_TARGET_ARCH_X64 248 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/code-stubs-x64.cc ('k') | src/x64/macro-assembler-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698