OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_PPC | 7 #if V8_TARGET_ARCH_PPC |
8 | 8 |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/debug.h" | 10 #include "src/debug.h" |
(...skipping 1402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1413 __ LoadP(ip, FieldMemOperand(r4, JSFunction::kCodeEntryOffset)); | 1413 __ LoadP(ip, FieldMemOperand(r4, JSFunction::kCodeEntryOffset)); |
1414 ParameterCount expected(0); | 1414 ParameterCount expected(0); |
1415 __ InvokeCode(ip, expected, expected, JUMP_FUNCTION, NullCallWrapper()); | 1415 __ InvokeCode(ip, expected, expected, JUMP_FUNCTION, NullCallWrapper()); |
1416 } | 1416 } |
1417 | 1417 |
1418 | 1418 |
1419 static void Generate_PushAppliedArguments(MacroAssembler* masm, | 1419 static void Generate_PushAppliedArguments(MacroAssembler* masm, |
1420 const int argumentsOffset, | 1420 const int argumentsOffset, |
1421 const int indexOffset, | 1421 const int indexOffset, |
1422 const int limitOffset) { | 1422 const int limitOffset) { |
| 1423 Register receiver = LoadDescriptor::ReceiverRegister(); |
| 1424 Register key = LoadDescriptor::NameRegister(); |
| 1425 |
| 1426 // Copy all arguments from the array to the stack. |
1423 Label entry, loop; | 1427 Label entry, loop; |
1424 __ LoadP(r3, MemOperand(fp, indexOffset)); | 1428 __ LoadP(key, MemOperand(fp, indexOffset)); |
1425 __ b(&entry); | 1429 __ b(&entry); |
| 1430 __ bind(&loop); |
| 1431 __ LoadP(receiver, MemOperand(fp, argumentsOffset)); |
1426 | 1432 |
1427 // Load the current argument from the arguments array and push it to the | 1433 // Use inline caching to speed up access to arguments. |
1428 // stack. | 1434 Handle<Code> ic = masm->isolate()->builtins()->KeyedLoadIC_Megamorphic(); |
1429 // r3: current argument index | 1435 __ Call(ic, RelocInfo::CODE_TARGET); |
1430 __ bind(&loop); | |
1431 __ LoadP(r4, MemOperand(fp, argumentsOffset)); | |
1432 __ Push(r4, r3); | |
1433 | 1436 |
1434 // Call the runtime to access the property in the arguments array. | 1437 // Push the nth argument. |
1435 __ CallRuntime(Runtime::kGetProperty, 2); | |
1436 __ push(r3); | 1438 __ push(r3); |
1437 | 1439 |
1438 // Use inline caching to access the arguments. | 1440 // Update the index on the stack and in register key. |
1439 __ LoadP(r3, MemOperand(fp, indexOffset)); | 1441 __ LoadP(key, MemOperand(fp, indexOffset)); |
1440 __ AddSmiLiteral(r3, r3, Smi::FromInt(1), r0); | 1442 __ AddSmiLiteral(key, key, Smi::FromInt(1), r0); |
1441 __ StoreP(r3, MemOperand(fp, indexOffset)); | 1443 __ StoreP(key, MemOperand(fp, indexOffset)); |
1442 | 1444 |
1443 // Test if the copy loop has finished copying all the elements from the | 1445 // Test if the copy loop has finished copying all the elements from the |
1444 // arguments object. | 1446 // arguments object. |
1445 __ bind(&entry); | 1447 __ bind(&entry); |
1446 __ LoadP(r4, MemOperand(fp, limitOffset)); | 1448 __ LoadP(r0, MemOperand(fp, limitOffset)); |
1447 __ cmp(r3, r4); | 1449 __ cmp(key, r0); |
1448 __ bne(&loop); | 1450 __ bne(&loop); |
1449 | 1451 |
1450 // On exit, the pushed arguments count is in r0, untagged | 1452 // On exit, the pushed arguments count is in r3, untagged |
1451 __ SmiUntag(r3); | 1453 __ SmiUntag(r3, key); |
1452 } | 1454 } |
1453 | 1455 |
1454 | 1456 |
1455 // Used by FunctionApply and ReflectApply | 1457 // Used by FunctionApply and ReflectApply |
1456 static void Generate_ApplyHelper(MacroAssembler* masm, bool targetIsArgument) { | 1458 static void Generate_ApplyHelper(MacroAssembler* masm, bool targetIsArgument) { |
1457 const int kFormalParameters = targetIsArgument ? 3 : 2; | 1459 const int kFormalParameters = targetIsArgument ? 3 : 2; |
1458 const int kStackSize = kFormalParameters + 1; | 1460 const int kStackSize = kFormalParameters + 1; |
1459 | 1461 |
1460 { | 1462 { |
1461 FrameScope frame_scope(masm, StackFrame::INTERNAL); | 1463 FrameScope frame_scope(masm, StackFrame::INTERNAL); |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1829 __ bkpt(0); | 1831 __ bkpt(0); |
1830 } | 1832 } |
1831 } | 1833 } |
1832 | 1834 |
1833 | 1835 |
1834 #undef __ | 1836 #undef __ |
1835 } | 1837 } |
1836 } // namespace v8::internal | 1838 } // namespace v8::internal |
1837 | 1839 |
1838 #endif // V8_TARGET_ARCH_PPC | 1840 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |