OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 18 matching lines...) Expand all Loading... |
29 | 29 |
30 #if defined(V8_TARGET_ARCH_ARM) | 30 #if defined(V8_TARGET_ARCH_ARM) |
31 | 31 |
32 #include "code-stubs.h" | 32 #include "code-stubs.h" |
33 #include "codegen-inl.h" | 33 #include "codegen-inl.h" |
34 #include "compiler.h" | 34 #include "compiler.h" |
35 #include "debug.h" | 35 #include "debug.h" |
36 #include "full-codegen.h" | 36 #include "full-codegen.h" |
37 #include "parser.h" | 37 #include "parser.h" |
38 #include "scopes.h" | 38 #include "scopes.h" |
| 39 #include "stub-cache.h" |
39 | 40 |
40 namespace v8 { | 41 namespace v8 { |
41 namespace internal { | 42 namespace internal { |
42 | 43 |
43 #define __ ACCESS_MASM(masm_) | 44 #define __ ACCESS_MASM(masm_) |
44 | 45 |
45 // Generate code for a JS function. On entry to the function the receiver | 46 // Generate code for a JS function. On entry to the function the receiver |
46 // and arguments have been pushed on the stack left to right. The actual | 47 // and arguments have been pushed on the stack left to right. The actual |
47 // argument count matches the formal parameter count expected by the | 48 // argument count matches the formal parameter count expected by the |
48 // function. | 49 // function. |
(...skipping 1642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1691 { PreserveStatementPositionScope scope(masm()->positions_recorder()); | 1692 { PreserveStatementPositionScope scope(masm()->positions_recorder()); |
1692 for (int i = 0; i < arg_count; i++) { | 1693 for (int i = 0; i < arg_count; i++) { |
1693 VisitForStackValue(args->at(i)); | 1694 VisitForStackValue(args->at(i)); |
1694 } | 1695 } |
1695 __ mov(r2, Operand(name)); | 1696 __ mov(r2, Operand(name)); |
1696 } | 1697 } |
1697 // Record source position for debugger. | 1698 // Record source position for debugger. |
1698 SetSourcePosition(expr->position(), FORCED_POSITION); | 1699 SetSourcePosition(expr->position(), FORCED_POSITION); |
1699 // Call the IC initialization code. | 1700 // Call the IC initialization code. |
1700 InLoopFlag in_loop = (loop_depth() > 0) ? IN_LOOP : NOT_IN_LOOP; | 1701 InLoopFlag in_loop = (loop_depth() > 0) ? IN_LOOP : NOT_IN_LOOP; |
1701 Handle<Code> ic = CodeGenerator::ComputeCallInitialize(arg_count, in_loop); | 1702 Handle<Code> ic = StubCache::ComputeCallInitialize(arg_count, in_loop); |
1702 EmitCallIC(ic, mode); | 1703 EmitCallIC(ic, mode); |
1703 // Restore context register. | 1704 // Restore context register. |
1704 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 1705 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
1705 context()->Plug(r0); | 1706 context()->Plug(r0); |
1706 } | 1707 } |
1707 | 1708 |
1708 | 1709 |
1709 void FullCodeGenerator::EmitKeyedCallWithIC(Call* expr, | 1710 void FullCodeGenerator::EmitKeyedCallWithIC(Call* expr, |
1710 Expression* key, | 1711 Expression* key, |
1711 RelocInfo::Mode mode) { | 1712 RelocInfo::Mode mode) { |
1712 // Code common for calls using the IC. | 1713 // Code common for calls using the IC. |
1713 ZoneList<Expression*>* args = expr->arguments(); | 1714 ZoneList<Expression*>* args = expr->arguments(); |
1714 int arg_count = args->length(); | 1715 int arg_count = args->length(); |
1715 { PreserveStatementPositionScope scope(masm()->positions_recorder()); | 1716 { PreserveStatementPositionScope scope(masm()->positions_recorder()); |
1716 for (int i = 0; i < arg_count; i++) { | 1717 for (int i = 0; i < arg_count; i++) { |
1717 VisitForStackValue(args->at(i)); | 1718 VisitForStackValue(args->at(i)); |
1718 } | 1719 } |
1719 VisitForAccumulatorValue(key); | 1720 VisitForAccumulatorValue(key); |
1720 __ mov(r2, r0); | 1721 __ mov(r2, r0); |
1721 } | 1722 } |
1722 // Record source position for debugger. | 1723 // Record source position for debugger. |
1723 SetSourcePosition(expr->position(), FORCED_POSITION); | 1724 SetSourcePosition(expr->position(), FORCED_POSITION); |
1724 // Call the IC initialization code. | 1725 // Call the IC initialization code. |
1725 InLoopFlag in_loop = (loop_depth() > 0) ? IN_LOOP : NOT_IN_LOOP; | 1726 InLoopFlag in_loop = (loop_depth() > 0) ? IN_LOOP : NOT_IN_LOOP; |
1726 Handle<Code> ic = CodeGenerator::ComputeKeyedCallInitialize(arg_count, | 1727 Handle<Code> ic = StubCache::ComputeKeyedCallInitialize(arg_count, in_loop); |
1727 in_loop); | |
1728 EmitCallIC(ic, mode); | 1728 EmitCallIC(ic, mode); |
1729 // Restore context register. | 1729 // Restore context register. |
1730 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 1730 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
1731 context()->Plug(r0); | 1731 context()->Plug(r0); |
1732 } | 1732 } |
1733 | 1733 |
1734 | 1734 |
1735 void FullCodeGenerator::EmitCallWithStub(Call* expr) { | 1735 void FullCodeGenerator::EmitCallWithStub(Call* expr) { |
1736 // Code common for calls using the call stub. | 1736 // Code common for calls using the call stub. |
1737 ZoneList<Expression*>* args = expr->arguments(); | 1737 ZoneList<Expression*>* args = expr->arguments(); |
(...skipping 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2787 | 2787 |
2788 // Push the arguments ("left-to-right"). | 2788 // Push the arguments ("left-to-right"). |
2789 int arg_count = args->length(); | 2789 int arg_count = args->length(); |
2790 for (int i = 0; i < arg_count; i++) { | 2790 for (int i = 0; i < arg_count; i++) { |
2791 VisitForStackValue(args->at(i)); | 2791 VisitForStackValue(args->at(i)); |
2792 } | 2792 } |
2793 | 2793 |
2794 if (expr->is_jsruntime()) { | 2794 if (expr->is_jsruntime()) { |
2795 // Call the JS runtime function. | 2795 // Call the JS runtime function. |
2796 __ mov(r2, Operand(expr->name())); | 2796 __ mov(r2, Operand(expr->name())); |
2797 Handle<Code> ic = CodeGenerator::ComputeCallInitialize(arg_count, | 2797 Handle<Code> ic = StubCache::ComputeCallInitialize(arg_count, NOT_IN_LOOP); |
2798 NOT_IN_LOOP); | |
2799 EmitCallIC(ic, RelocInfo::CODE_TARGET); | 2798 EmitCallIC(ic, RelocInfo::CODE_TARGET); |
2800 // Restore context register. | 2799 // Restore context register. |
2801 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2800 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
2802 } else { | 2801 } else { |
2803 // Call the C runtime function. | 2802 // Call the C runtime function. |
2804 __ CallRuntime(expr->function(), arg_count); | 2803 __ CallRuntime(expr->function(), arg_count); |
2805 } | 2804 } |
2806 context()->Plug(r0); | 2805 context()->Plug(r0); |
2807 } | 2806 } |
2808 | 2807 |
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3422 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. | 3421 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. |
3423 __ add(pc, r1, Operand(masm_->CodeObject())); | 3422 __ add(pc, r1, Operand(masm_->CodeObject())); |
3424 } | 3423 } |
3425 | 3424 |
3426 | 3425 |
3427 #undef __ | 3426 #undef __ |
3428 | 3427 |
3429 } } // namespace v8::internal | 3428 } } // namespace v8::internal |
3430 | 3429 |
3431 #endif // V8_TARGET_ARCH_ARM | 3430 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |