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

Side by Side Diff: src/arm64/builtins-arm64.cc

Issue 1116943002: Function apply(): make all architectures use an IC for performance. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Oops, fixed arm64 failure to push argument. Created 5 years, 7 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/arm/builtins-arm.cc ('k') | src/mips/builtins-mips.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 #if V8_TARGET_ARCH_ARM64 7 #if V8_TARGET_ARCH_ARM64
8 8
9 #include "src/codegen.h" 9 #include "src/codegen.h"
10 #include "src/debug.h" 10 #include "src/debug.h"
(...skipping 1368 matching lines...) Expand 10 before | Expand all | Expand 10 after
1379 ParameterCount expected(0); 1379 ParameterCount expected(0);
1380 __ InvokeCode(x3, expected, expected, JUMP_FUNCTION, NullCallWrapper()); 1380 __ InvokeCode(x3, expected, expected, JUMP_FUNCTION, NullCallWrapper());
1381 } 1381 }
1382 1382
1383 1383
1384 static void Generate_PushAppliedArguments(MacroAssembler* masm, 1384 static void Generate_PushAppliedArguments(MacroAssembler* masm,
1385 const int argumentsOffset, 1385 const int argumentsOffset,
1386 const int indexOffset, 1386 const int indexOffset,
1387 const int limitOffset) { 1387 const int limitOffset) {
1388 Label entry, loop; 1388 Label entry, loop;
1389 Register current = x0; 1389 Register receiver = LoadDescriptor::ReceiverRegister();
1390 __ Ldr(current, MemOperand(fp, indexOffset)); 1390 Register key = LoadDescriptor::NameRegister();
1391
1392 __ Ldr(key, MemOperand(fp, indexOffset));
1391 __ B(&entry); 1393 __ B(&entry);
1392 1394
1395 // Load the current argument from the arguments array.
1393 __ Bind(&loop); 1396 __ Bind(&loop);
1394 // Load the current argument from the arguments array and push it. 1397 __ Ldr(receiver, MemOperand(fp, argumentsOffset));
1395 // TODO(all): Couldn't we optimize this for JS arrays?
1396 1398
1397 __ Ldr(x1, MemOperand(fp, argumentsOffset)); 1399 // Use inline caching to speed up access to arguments.
1398 __ Push(x1, current); 1400 Handle<Code> ic = masm->isolate()->builtins()->KeyedLoadIC_Megamorphic();
1401 __ Call(ic, RelocInfo::CODE_TARGET);
1399 1402
1400 // Call the runtime to access the property in the arguments array. 1403 // Push the nth argument.
1401 __ CallRuntime(Runtime::kGetProperty, 2);
1402 __ Push(x0); 1404 __ Push(x0);
1403 1405
1404 // Use inline caching to access the arguments. 1406 __ Ldr(key, MemOperand(fp, indexOffset));
1405 __ Ldr(current, MemOperand(fp, indexOffset)); 1407 __ Add(key, key, Smi::FromInt(1));
1406 __ Add(current, current, Smi::FromInt(1)); 1408 __ Str(key, MemOperand(fp, indexOffset));
1407 __ Str(current, MemOperand(fp, indexOffset));
1408 1409
1409 // Test if the copy loop has finished copying all the elements from the 1410 // Test if the copy loop has finished copying all the elements from the
1410 // arguments object. 1411 // arguments object.
1411 __ Bind(&entry); 1412 __ Bind(&entry);
1412 __ Ldr(x1, MemOperand(fp, limitOffset)); 1413 __ Ldr(x1, MemOperand(fp, limitOffset));
1413 __ Cmp(current, x1); 1414 __ Cmp(key, x1);
1414 __ B(ne, &loop); 1415 __ B(ne, &loop);
1415 1416
1416 // On exit, the pushed arguments count is in x0, untagged 1417 // On exit, the pushed arguments count is in x0, untagged
1417 __ SmiUntag(current); 1418 __ Mov(x0, key);
1419 __ SmiUntag(x0);
1418 } 1420 }
1419 1421
1420 1422
1421 static void Generate_ApplyHelper(MacroAssembler* masm, bool targetIsArgument) { 1423 static void Generate_ApplyHelper(MacroAssembler* masm, bool targetIsArgument) {
1422 const int kFormalParameters = targetIsArgument ? 3 : 2; 1424 const int kFormalParameters = targetIsArgument ? 3 : 2;
1423 const int kStackSize = kFormalParameters + 1; 1425 const int kStackSize = kFormalParameters + 1;
1424 1426
1425 { 1427 {
1426 FrameScope frame_scope(masm, StackFrame::INTERNAL); 1428 FrameScope frame_scope(masm, StackFrame::INTERNAL);
1427 1429
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
1804 __ Unreachable(); 1806 __ Unreachable();
1805 } 1807 }
1806 } 1808 }
1807 1809
1808 1810
1809 #undef __ 1811 #undef __
1810 1812
1811 } } // namespace v8::internal 1813 } } // namespace v8::internal
1812 1814
1813 #endif // V8_TARGET_ARCH_ARM 1815 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/builtins-arm.cc ('k') | src/mips/builtins-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698