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

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

Issue 330053002: ARM, ARM64: Optimize array copy (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 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/arm64/lithium-arm64.cc ('k') | src/arm64/macro-assembler-arm64.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/arm64/lithium-codegen-arm64.h" 7 #include "src/arm64/lithium-codegen-arm64.h"
8 #include "src/arm64/lithium-gap-resolver-arm64.h" 8 #include "src/arm64/lithium-gap-resolver-arm64.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/stub-cache.h" 10 #include "src/stub-cache.h"
(...skipping 5146 matching lines...) Expand 10 before | Expand all | Expand 10 after
5157 DeoptimizeIfRoot( 5157 DeoptimizeIfRoot(
5158 payload, Heap::kTheHoleValueRootIndex, instr->environment()); 5158 payload, Heap::kTheHoleValueRootIndex, instr->environment());
5159 } 5159 }
5160 5160
5161 // Store the value. 5161 // Store the value.
5162 __ Str(value, FieldMemOperand(cell, Cell::kValueOffset)); 5162 __ Str(value, FieldMemOperand(cell, Cell::kValueOffset));
5163 // Cells are always rescanned, so no write barrier here. 5163 // Cells are always rescanned, so no write barrier here.
5164 } 5164 }
5165 5165
5166 5166
5167 void LCodeGen::DoFillElements(LFillElements* instr) {
5168 Register elements = ToRegister(instr->elements());
5169 UseScratchRegisterScope temps(masm());
5170 Register dst = temps.AcquireX();
5171 CPURegister value;
5172 if (instr->value()->IsDoubleRegister()) {
5173 value = ToDoubleRegister(instr->value());
5174 } else {
5175 value = ToRegister(instr->value());
5176 }
5177 Register remain;
5178 if (instr->from()->IsConstantOperand()) {
5179 int64_t from = ToInteger32(LConstantOperand::cast(instr->from()));
5180 int start_offset =
5181 FixedDoubleArray::kHeaderSize -
5182 kHeapObjectTag + (from << kPointerSizeLog2);
5183 if (instr->to()->IsConstantOperand()) {
5184 int64_t to = ToInteger32(LConstantOperand::cast(instr->to()));
5185 int64_t fill_size = to - from;
5186 ASSERT(fill_size >= 0);
5187 __ Add(dst, elements, start_offset);
5188 int even_fill_size = fill_size & ~1;
5189 if (even_fill_size <= LFillElements::kMaxUnrolledSize) {
5190 for (int count = 0; count < even_fill_size; count += 2) {
5191 __ Stp(value, value, MemOperand(dst, count * kDoubleSize));
5192 }
5193 if ((fill_size & 1) != 0) {
5194 __ Str(value, MemOperand(dst, (fill_size - 1) * kDoubleSize));
5195 }
5196 } else {
5197 remain = temps.AcquireW();
5198 __ Mov(remain, even_fill_size);
5199 Label loop;
5200 __ Bind(&loop);
5201 __ Subs(remain, remain, 2);
5202 __ Stp(value, value, MemOperand(dst, 2 * kRegisterSize, PostIndex));
5203 __ B(ne, &loop);
5204 if ((fill_size & 1) != 0) {
5205 __ Str(value, MemOperand(dst));
5206 }
5207 }
5208 return;
5209 } else {
5210 __ Add(dst, elements, start_offset);
5211 remain = ToRegister(instr->to()).W();
5212 ASSERT(instr->hydrogen()->to()->representation().IsInteger32());
5213 if (from > 0) {
5214 __ Sub(remain, remain, from);
5215 }
5216 }
5217 } else {
5218 remain = temps.AcquireW();
5219 Register from = ToRegister(instr->from()).W();
5220 ASSERT(instr->hydrogen()->from()->representation().IsInteger32());
5221 if (instr->to()->IsConstantOperand()) {
5222 int64_t to = ToInteger32(LConstantOperand::cast(instr->to()));
5223 __ Mov(remain, to);
5224 __ Sub(remain, remain, from);
5225 } else {
5226 Register to = ToRegister(instr->to()).W();
5227 ASSERT(instr->hydrogen()->to()->representation().IsInteger32());
5228 __ Sub(remain, to, from);
5229 }
5230 __ Add(dst, elements, FixedDoubleArray::kHeaderSize - kHeapObjectTag);
5231 __ Add(dst, dst, Operand(from, SXTW, kPointerSizeLog2));
5232 }
5233
5234 Label even, loop, done;
5235 __ Tbz(remain, 0, &even);
5236 __ Sub(remain, remain, 1);
5237 __ Str(value, MemOperand(dst, kRegisterSize, PostIndex));
5238
5239 __ Bind(&even);
5240 __ Cbz(remain, &done);
5241
5242 __ Bind(&loop);
5243 __ Subs(remain, remain, 2);
5244 __ Stp(value, value, MemOperand(dst, 2 * kRegisterSize, PostIndex));
5245 __ B(ne, &loop);
5246 __ Bind(&done);
5247 }
5248
5249
5250 void LCodeGen::DoCopyElements(LCopyElements* instr) {
5251 Label even, loop, done;
5252 UseScratchRegisterScope temps(masm());
5253 Register length = ToRegister(instr->length()).W();
5254 ASSERT(instr->hydrogen()->length()->representation().IsInteger32());
5255
5256 Register dst = temps.AcquireX();
5257 Register src = temps.AcquireX();
5258 __ Add(src, ToRegister(instr->src()),
5259 FixedDoubleArray::kHeaderSize - kHeapObjectTag);
5260 __ Add(dst, ToRegister(instr->dst()),
5261 FixedDoubleArray::kHeaderSize - kHeapObjectTag);
5262
5263 FPRegister value1 = double_scratch();
5264 FPRegister value2 = temps.AcquireD();
5265
5266 __ Tbz(length, 0, &even);
5267 __ Sub(length, length, 1);
5268 __ Ldr(value1, MemOperand(src, kRegisterSize, PostIndex));
5269 __ Str(value1, MemOperand(dst, kRegisterSize, PostIndex));
5270
5271 __ Bind(&even);
5272 __ Cbz(length, &done);
5273
5274 __ Bind(&loop);
5275 __ Subs(length, length, 2);
5276 __ Ldp(value1, value2, MemOperand(src, 2 * kRegisterSize, PostIndex));
5277 __ Stp(value1, value2, MemOperand(dst, 2 * kRegisterSize, PostIndex));
5278 __ B(ne, &loop);
5279 __ Bind(&done);
5280 }
5281
5282
5167 void LCodeGen::DoStoreKeyedExternal(LStoreKeyedExternal* instr) { 5283 void LCodeGen::DoStoreKeyedExternal(LStoreKeyedExternal* instr) {
5168 Register ext_ptr = ToRegister(instr->elements()); 5284 Register ext_ptr = ToRegister(instr->elements());
5169 Register key = no_reg; 5285 Register key = no_reg;
5170 Register scratch; 5286 Register scratch;
5171 ElementsKind elements_kind = instr->elements_kind(); 5287 ElementsKind elements_kind = instr->elements_kind();
5172 5288
5173 bool key_is_smi = instr->hydrogen()->key()->representation().IsSmi(); 5289 bool key_is_smi = instr->hydrogen()->key()->representation().IsSmi();
5174 bool key_is_constant = instr->key()->IsConstantOperand(); 5290 bool key_is_constant = instr->key()->IsConstantOperand();
5175 int constant_key = 0; 5291 int constant_key = 0;
5176 if (key_is_constant) { 5292 if (key_is_constant) {
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after
6052 Handle<ScopeInfo> scope_info = instr->scope_info(); 6168 Handle<ScopeInfo> scope_info = instr->scope_info();
6053 __ Push(scope_info); 6169 __ Push(scope_info);
6054 __ Push(ToRegister(instr->function())); 6170 __ Push(ToRegister(instr->function()));
6055 CallRuntime(Runtime::kHiddenPushBlockContext, 2, instr); 6171 CallRuntime(Runtime::kHiddenPushBlockContext, 2, instr);
6056 RecordSafepoint(Safepoint::kNoLazyDeopt); 6172 RecordSafepoint(Safepoint::kNoLazyDeopt);
6057 } 6173 }
6058 6174
6059 6175
6060 6176
6061 } } // namespace v8::internal 6177 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm64/lithium-arm64.cc ('k') | src/arm64/macro-assembler-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698