| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |