| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 1999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2010 EmitCallIC(ic, mode); | 2010 EmitCallIC(ic, mode); |
| 2011 // Restore context register. | 2011 // Restore context register. |
| 2012 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 2012 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
| 2013 context()->Plug(eax); | 2013 context()->Plug(eax); |
| 2014 } | 2014 } |
| 2015 | 2015 |
| 2016 | 2016 |
| 2017 void FullCodeGenerator::EmitKeyedCallWithIC(Call* expr, | 2017 void FullCodeGenerator::EmitKeyedCallWithIC(Call* expr, |
| 2018 Expression* key, | 2018 Expression* key, |
| 2019 RelocInfo::Mode mode) { | 2019 RelocInfo::Mode mode) { |
| 2020 // Code common for calls using the IC. | 2020 // Load the key. |
| 2021 VisitForAccumulatorValue(key); |
| 2022 |
| 2023 // Swap the name of the function and the receiver on the stack to follow |
| 2024 // the calling convention for call ICs. |
| 2025 __ pop(ecx); |
| 2026 __ push(eax); |
| 2027 __ push(ecx); |
| 2028 |
| 2029 // Load the arguments. |
| 2021 ZoneList<Expression*>* args = expr->arguments(); | 2030 ZoneList<Expression*>* args = expr->arguments(); |
| 2022 int arg_count = args->length(); | 2031 int arg_count = args->length(); |
| 2023 { PreserveStatementPositionScope scope(masm()->positions_recorder()); | 2032 { PreserveStatementPositionScope scope(masm()->positions_recorder()); |
| 2024 for (int i = 0; i < arg_count; i++) { | 2033 for (int i = 0; i < arg_count; i++) { |
| 2025 VisitForStackValue(args->at(i)); | 2034 VisitForStackValue(args->at(i)); |
| 2026 } | 2035 } |
| 2027 VisitForAccumulatorValue(key); | |
| 2028 __ mov(ecx, eax); | |
| 2029 } | 2036 } |
| 2030 // Record source position of the IC call. | 2037 // Record source position of the IC call. |
| 2031 SetSourcePosition(expr->position(), FORCED_POSITION); | 2038 SetSourcePosition(expr->position(), FORCED_POSITION); |
| 2032 InLoopFlag in_loop = (loop_depth() > 0) ? IN_LOOP : NOT_IN_LOOP; | 2039 InLoopFlag in_loop = (loop_depth() > 0) ? IN_LOOP : NOT_IN_LOOP; |
| 2033 Handle<Code> ic = StubCache::ComputeKeyedCallInitialize(arg_count, in_loop); | 2040 Handle<Code> ic = StubCache::ComputeKeyedCallInitialize(arg_count, in_loop); |
| 2041 __ mov(ecx, Operand(esp, (arg_count + 1) * kPointerSize)); // Key. |
| 2034 EmitCallIC(ic, mode); | 2042 EmitCallIC(ic, mode); |
| 2035 // Restore context register. | 2043 // Restore context register. |
| 2036 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 2044 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
| 2037 context()->Plug(eax); | 2045 context()->DropAndPlug(1, eax); // Drop the key still on the stack. |
| 2038 } | 2046 } |
| 2039 | 2047 |
| 2040 | 2048 |
| 2041 void FullCodeGenerator::EmitCallWithStub(Call* expr) { | 2049 void FullCodeGenerator::EmitCallWithStub(Call* expr) { |
| 2042 // Code common for calls using the call stub. | 2050 // Code common for calls using the call stub. |
| 2043 ZoneList<Expression*>* args = expr->arguments(); | 2051 ZoneList<Expression*>* args = expr->arguments(); |
| 2044 int arg_count = args->length(); | 2052 int arg_count = args->length(); |
| 2045 { PreserveStatementPositionScope scope(masm()->positions_recorder()); | 2053 { PreserveStatementPositionScope scope(masm()->positions_recorder()); |
| 2046 for (int i = 0; i < arg_count; i++) { | 2054 for (int i = 0; i < arg_count; i++) { |
| 2047 VisitForStackValue(args->at(i)); | 2055 VisitForStackValue(args->at(i)); |
| (...skipping 1702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3750 // And return. | 3758 // And return. |
| 3751 __ ret(0); | 3759 __ ret(0); |
| 3752 } | 3760 } |
| 3753 | 3761 |
| 3754 | 3762 |
| 3755 #undef __ | 3763 #undef __ |
| 3756 | 3764 |
| 3757 } } // namespace v8::internal | 3765 } } // namespace v8::internal |
| 3758 | 3766 |
| 3759 #endif // V8_TARGET_ARCH_IA32 | 3767 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |