OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 2010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2021 int arg_count = args->length(); | 2021 int arg_count = args->length(); |
2022 { PreservePositionScope scope(masm()->positions_recorder()); | 2022 { PreservePositionScope scope(masm()->positions_recorder()); |
2023 for (int i = 0; i < arg_count; i++) { | 2023 for (int i = 0; i < arg_count; i++) { |
2024 VisitForStackValue(args->at(i)); | 2024 VisitForStackValue(args->at(i)); |
2025 } | 2025 } |
2026 __ mov(r2, Operand(name)); | 2026 __ mov(r2, Operand(name)); |
2027 } | 2027 } |
2028 // Record source position for debugger. | 2028 // Record source position for debugger. |
2029 SetSourcePosition(expr->position()); | 2029 SetSourcePosition(expr->position()); |
2030 // Call the IC initialization code. | 2030 // Call the IC initialization code. |
2031 InLoopFlag in_loop = (loop_depth() > 0) ? IN_LOOP : NOT_IN_LOOP; | |
2032 Handle<Code> ic = | 2031 Handle<Code> ic = |
2033 isolate()->stub_cache()->ComputeCallInitialize(arg_count, in_loop, mode); | 2032 isolate()->stub_cache()->ComputeCallInitialize(arg_count, mode); |
2034 __ Call(ic, mode, expr->id()); | 2033 __ Call(ic, mode, expr->id()); |
2035 RecordJSReturnSite(expr); | 2034 RecordJSReturnSite(expr); |
2036 // Restore context register. | 2035 // Restore context register. |
2037 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2036 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
2038 context()->Plug(r0); | 2037 context()->Plug(r0); |
2039 } | 2038 } |
2040 | 2039 |
2041 | 2040 |
2042 void FullCodeGenerator::EmitKeyedCallWithIC(Call* expr, | 2041 void FullCodeGenerator::EmitKeyedCallWithIC(Call* expr, |
2043 Expression* key) { | 2042 Expression* key) { |
(...skipping 10 matching lines...) Expand all Loading... |
2054 ZoneList<Expression*>* args = expr->arguments(); | 2053 ZoneList<Expression*>* args = expr->arguments(); |
2055 int arg_count = args->length(); | 2054 int arg_count = args->length(); |
2056 { PreservePositionScope scope(masm()->positions_recorder()); | 2055 { PreservePositionScope scope(masm()->positions_recorder()); |
2057 for (int i = 0; i < arg_count; i++) { | 2056 for (int i = 0; i < arg_count; i++) { |
2058 VisitForStackValue(args->at(i)); | 2057 VisitForStackValue(args->at(i)); |
2059 } | 2058 } |
2060 } | 2059 } |
2061 // Record source position for debugger. | 2060 // Record source position for debugger. |
2062 SetSourcePosition(expr->position()); | 2061 SetSourcePosition(expr->position()); |
2063 // Call the IC initialization code. | 2062 // Call the IC initialization code. |
2064 InLoopFlag in_loop = (loop_depth() > 0) ? IN_LOOP : NOT_IN_LOOP; | |
2065 Handle<Code> ic = | 2063 Handle<Code> ic = |
2066 isolate()->stub_cache()->ComputeKeyedCallInitialize(arg_count, in_loop); | 2064 isolate()->stub_cache()->ComputeKeyedCallInitialize(arg_count); |
2067 __ ldr(r2, MemOperand(sp, (arg_count + 1) * kPointerSize)); // Key. | 2065 __ ldr(r2, MemOperand(sp, (arg_count + 1) * kPointerSize)); // Key. |
2068 __ Call(ic, RelocInfo::CODE_TARGET, expr->id()); | 2066 __ Call(ic, RelocInfo::CODE_TARGET, expr->id()); |
2069 RecordJSReturnSite(expr); | 2067 RecordJSReturnSite(expr); |
2070 // Restore context register. | 2068 // Restore context register. |
2071 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2069 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
2072 context()->DropAndPlug(1, r0); // Drop the key still on the stack. | 2070 context()->DropAndPlug(1, r0); // Drop the key still on the stack. |
2073 } | 2071 } |
2074 | 2072 |
2075 | 2073 |
2076 void FullCodeGenerator::EmitCallWithStub(Call* expr, CallFunctionFlags flags) { | 2074 void FullCodeGenerator::EmitCallWithStub(Call* expr, CallFunctionFlags flags) { |
2077 // Code common for calls using the call stub. | 2075 // Code common for calls using the call stub. |
2078 ZoneList<Expression*>* args = expr->arguments(); | 2076 ZoneList<Expression*>* args = expr->arguments(); |
2079 int arg_count = args->length(); | 2077 int arg_count = args->length(); |
2080 { PreservePositionScope scope(masm()->positions_recorder()); | 2078 { PreservePositionScope scope(masm()->positions_recorder()); |
2081 for (int i = 0; i < arg_count; i++) { | 2079 for (int i = 0; i < arg_count; i++) { |
2082 VisitForStackValue(args->at(i)); | 2080 VisitForStackValue(args->at(i)); |
2083 } | 2081 } |
2084 } | 2082 } |
2085 // Record source position for debugger. | 2083 // Record source position for debugger. |
2086 SetSourcePosition(expr->position()); | 2084 SetSourcePosition(expr->position()); |
2087 InLoopFlag in_loop = (loop_depth() > 0) ? IN_LOOP : NOT_IN_LOOP; | 2085 CallFunctionStub stub(arg_count, flags); |
2088 CallFunctionStub stub(arg_count, in_loop, flags); | |
2089 __ CallStub(&stub); | 2086 __ CallStub(&stub); |
2090 RecordJSReturnSite(expr); | 2087 RecordJSReturnSite(expr); |
2091 // Restore context register. | 2088 // Restore context register. |
2092 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2089 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
2093 context()->DropAndPlug(1, r0); | 2090 context()->DropAndPlug(1, r0); |
2094 } | 2091 } |
2095 | 2092 |
2096 | 2093 |
2097 void FullCodeGenerator::EmitResolvePossiblyDirectEval(ResolveEvalFlag flag, | 2094 void FullCodeGenerator::EmitResolvePossiblyDirectEval(ResolveEvalFlag flag, |
2098 int arg_count) { | 2095 int arg_count) { |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2177 __ bind(&done); | 2174 __ bind(&done); |
2178 | 2175 |
2179 // The runtime call returns a pair of values in r0 (function) and | 2176 // The runtime call returns a pair of values in r0 (function) and |
2180 // r1 (receiver). Touch up the stack with the right values. | 2177 // r1 (receiver). Touch up the stack with the right values. |
2181 __ str(r0, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 2178 __ str(r0, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
2182 __ str(r1, MemOperand(sp, arg_count * kPointerSize)); | 2179 __ str(r1, MemOperand(sp, arg_count * kPointerSize)); |
2183 } | 2180 } |
2184 | 2181 |
2185 // Record source position for debugger. | 2182 // Record source position for debugger. |
2186 SetSourcePosition(expr->position()); | 2183 SetSourcePosition(expr->position()); |
2187 InLoopFlag in_loop = (loop_depth() > 0) ? IN_LOOP : NOT_IN_LOOP; | 2184 CallFunctionStub stub(arg_count, RECEIVER_MIGHT_BE_IMPLICIT); |
2188 CallFunctionStub stub(arg_count, in_loop, RECEIVER_MIGHT_BE_IMPLICIT); | |
2189 __ CallStub(&stub); | 2185 __ CallStub(&stub); |
2190 RecordJSReturnSite(expr); | 2186 RecordJSReturnSite(expr); |
2191 // Restore context register. | 2187 // Restore context register. |
2192 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2188 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
2193 context()->DropAndPlug(1, r0); | 2189 context()->DropAndPlug(1, r0); |
2194 } else if (proxy != NULL && proxy->var()->IsUnallocated()) { | 2190 } else if (proxy != NULL && proxy->var()->IsUnallocated()) { |
2195 // Push global object as receiver for the call IC. | 2191 // Push global object as receiver for the call IC. |
2196 __ ldr(r0, GlobalObjectOperand()); | 2192 __ ldr(r0, GlobalObjectOperand()); |
2197 __ push(r0); | 2193 __ push(r0); |
2198 EmitCallWithIC(expr, proxy->name(), RelocInfo::CODE_TARGET_CONTEXT); | 2194 EmitCallWithIC(expr, proxy->name(), RelocInfo::CODE_TARGET_CONTEXT); |
(...skipping 1347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3546 int arg_count = args->length(); | 3542 int arg_count = args->length(); |
3547 for (int i = 0; i < arg_count; i++) { | 3543 for (int i = 0; i < arg_count; i++) { |
3548 VisitForStackValue(args->at(i)); | 3544 VisitForStackValue(args->at(i)); |
3549 } | 3545 } |
3550 | 3546 |
3551 if (expr->is_jsruntime()) { | 3547 if (expr->is_jsruntime()) { |
3552 // Call the JS runtime function. | 3548 // Call the JS runtime function. |
3553 __ mov(r2, Operand(expr->name())); | 3549 __ mov(r2, Operand(expr->name())); |
3554 RelocInfo::Mode mode = RelocInfo::CODE_TARGET; | 3550 RelocInfo::Mode mode = RelocInfo::CODE_TARGET; |
3555 Handle<Code> ic = | 3551 Handle<Code> ic = |
3556 isolate()->stub_cache()->ComputeCallInitialize(arg_count, | 3552 isolate()->stub_cache()->ComputeCallInitialize(arg_count, mode); |
3557 NOT_IN_LOOP, | |
3558 mode); | |
3559 __ Call(ic, mode, expr->id()); | 3553 __ Call(ic, mode, expr->id()); |
3560 // Restore context register. | 3554 // Restore context register. |
3561 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 3555 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
3562 } else { | 3556 } else { |
3563 // Call the C runtime function. | 3557 // Call the C runtime function. |
3564 __ CallRuntime(expr->function(), arg_count); | 3558 __ CallRuntime(expr->function(), arg_count); |
3565 } | 3559 } |
3566 context()->Plug(r0); | 3560 context()->Plug(r0); |
3567 } | 3561 } |
3568 | 3562 |
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4225 *context_length = 0; | 4219 *context_length = 0; |
4226 return previous_; | 4220 return previous_; |
4227 } | 4221 } |
4228 | 4222 |
4229 | 4223 |
4230 #undef __ | 4224 #undef __ |
4231 | 4225 |
4232 } } // namespace v8::internal | 4226 } } // namespace v8::internal |
4233 | 4227 |
4234 #endif // V8_TARGET_ARCH_ARM | 4228 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |