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 2024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2035 int arg_count = args->length(); | 2035 int arg_count = args->length(); |
2036 { PreservePositionScope scope(masm()->positions_recorder()); | 2036 { PreservePositionScope scope(masm()->positions_recorder()); |
2037 for (int i = 0; i < arg_count; i++) { | 2037 for (int i = 0; i < arg_count; i++) { |
2038 VisitForStackValue(args->at(i)); | 2038 VisitForStackValue(args->at(i)); |
2039 } | 2039 } |
2040 __ li(a2, Operand(name)); | 2040 __ li(a2, Operand(name)); |
2041 } | 2041 } |
2042 // Record source position for debugger. | 2042 // Record source position for debugger. |
2043 SetSourcePosition(expr->position()); | 2043 SetSourcePosition(expr->position()); |
2044 // Call the IC initialization code. | 2044 // Call the IC initialization code. |
| 2045 InLoopFlag in_loop = (loop_depth() > 0) ? IN_LOOP : NOT_IN_LOOP; |
2045 Handle<Code> ic = | 2046 Handle<Code> ic = |
2046 isolate()->stub_cache()->ComputeCallInitialize(arg_count, mode); | 2047 isolate()->stub_cache()->ComputeCallInitialize(arg_count, in_loop, mode); |
2047 __ Call(ic, mode, expr->id()); | 2048 __ Call(ic, mode, expr->id()); |
2048 RecordJSReturnSite(expr); | 2049 RecordJSReturnSite(expr); |
2049 // Restore context register. | 2050 // Restore context register. |
2050 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2051 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
2051 context()->Plug(v0); | 2052 context()->Plug(v0); |
2052 } | 2053 } |
2053 | 2054 |
2054 | 2055 |
2055 void FullCodeGenerator::EmitKeyedCallWithIC(Call* expr, | 2056 void FullCodeGenerator::EmitKeyedCallWithIC(Call* expr, |
2056 Expression* key) { | 2057 Expression* key) { |
(...skipping 10 matching lines...) Expand all Loading... |
2067 ZoneList<Expression*>* args = expr->arguments(); | 2068 ZoneList<Expression*>* args = expr->arguments(); |
2068 int arg_count = args->length(); | 2069 int arg_count = args->length(); |
2069 { PreservePositionScope scope(masm()->positions_recorder()); | 2070 { PreservePositionScope scope(masm()->positions_recorder()); |
2070 for (int i = 0; i < arg_count; i++) { | 2071 for (int i = 0; i < arg_count; i++) { |
2071 VisitForStackValue(args->at(i)); | 2072 VisitForStackValue(args->at(i)); |
2072 } | 2073 } |
2073 } | 2074 } |
2074 // Record source position for debugger. | 2075 // Record source position for debugger. |
2075 SetSourcePosition(expr->position()); | 2076 SetSourcePosition(expr->position()); |
2076 // Call the IC initialization code. | 2077 // Call the IC initialization code. |
| 2078 InLoopFlag in_loop = (loop_depth() > 0) ? IN_LOOP : NOT_IN_LOOP; |
2077 Handle<Code> ic = | 2079 Handle<Code> ic = |
2078 isolate()->stub_cache()->ComputeKeyedCallInitialize(arg_count); | 2080 isolate()->stub_cache()->ComputeKeyedCallInitialize(arg_count, in_loop); |
2079 __ lw(a2, MemOperand(sp, (arg_count + 1) * kPointerSize)); // Key. | 2081 __ lw(a2, MemOperand(sp, (arg_count + 1) * kPointerSize)); // Key. |
2080 __ Call(ic, RelocInfo::CODE_TARGET, expr->id()); | 2082 __ Call(ic, RelocInfo::CODE_TARGET, expr->id()); |
2081 RecordJSReturnSite(expr); | 2083 RecordJSReturnSite(expr); |
2082 // Restore context register. | 2084 // Restore context register. |
2083 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2085 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
2084 context()->DropAndPlug(1, v0); // Drop the key still on the stack. | 2086 context()->DropAndPlug(1, v0); // Drop the key still on the stack. |
2085 } | 2087 } |
2086 | 2088 |
2087 | 2089 |
2088 void FullCodeGenerator::EmitCallWithStub(Call* expr, CallFunctionFlags flags) { | 2090 void FullCodeGenerator::EmitCallWithStub(Call* expr, CallFunctionFlags flags) { |
2089 // Code common for calls using the call stub. | 2091 // Code common for calls using the call stub. |
2090 ZoneList<Expression*>* args = expr->arguments(); | 2092 ZoneList<Expression*>* args = expr->arguments(); |
2091 int arg_count = args->length(); | 2093 int arg_count = args->length(); |
2092 { PreservePositionScope scope(masm()->positions_recorder()); | 2094 { PreservePositionScope scope(masm()->positions_recorder()); |
2093 for (int i = 0; i < arg_count; i++) { | 2095 for (int i = 0; i < arg_count; i++) { |
2094 VisitForStackValue(args->at(i)); | 2096 VisitForStackValue(args->at(i)); |
2095 } | 2097 } |
2096 } | 2098 } |
2097 // Record source position for debugger. | 2099 // Record source position for debugger. |
2098 SetSourcePosition(expr->position()); | 2100 SetSourcePosition(expr->position()); |
2099 CallFunctionStub stub(arg_count, flags); | 2101 InLoopFlag in_loop = (loop_depth() > 0) ? IN_LOOP : NOT_IN_LOOP; |
| 2102 CallFunctionStub stub(arg_count, in_loop, flags); |
2100 __ CallStub(&stub); | 2103 __ CallStub(&stub); |
2101 RecordJSReturnSite(expr); | 2104 RecordJSReturnSite(expr); |
2102 // Restore context register. | 2105 // Restore context register. |
2103 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2106 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
2104 context()->DropAndPlug(1, v0); | 2107 context()->DropAndPlug(1, v0); |
2105 } | 2108 } |
2106 | 2109 |
2107 | 2110 |
2108 void FullCodeGenerator::EmitResolvePossiblyDirectEval(ResolveEvalFlag flag, | 2111 void FullCodeGenerator::EmitResolvePossiblyDirectEval(ResolveEvalFlag flag, |
2109 int arg_count) { | 2112 int arg_count) { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2187 EmitResolvePossiblyDirectEval(PERFORM_CONTEXT_LOOKUP, arg_count); | 2190 EmitResolvePossiblyDirectEval(PERFORM_CONTEXT_LOOKUP, arg_count); |
2188 __ bind(&done); | 2191 __ bind(&done); |
2189 | 2192 |
2190 // The runtime call returns a pair of values in v0 (function) and | 2193 // The runtime call returns a pair of values in v0 (function) and |
2191 // v1 (receiver). Touch up the stack with the right values. | 2194 // v1 (receiver). Touch up the stack with the right values. |
2192 __ sw(v0, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 2195 __ sw(v0, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
2193 __ sw(v1, MemOperand(sp, arg_count * kPointerSize)); | 2196 __ sw(v1, MemOperand(sp, arg_count * kPointerSize)); |
2194 } | 2197 } |
2195 // Record source position for debugger. | 2198 // Record source position for debugger. |
2196 SetSourcePosition(expr->position()); | 2199 SetSourcePosition(expr->position()); |
2197 CallFunctionStub stub(arg_count, RECEIVER_MIGHT_BE_IMPLICIT); | 2200 InLoopFlag in_loop = (loop_depth() > 0) ? IN_LOOP : NOT_IN_LOOP; |
| 2201 CallFunctionStub stub(arg_count, in_loop, RECEIVER_MIGHT_BE_IMPLICIT); |
2198 __ CallStub(&stub); | 2202 __ CallStub(&stub); |
2199 RecordJSReturnSite(expr); | 2203 RecordJSReturnSite(expr); |
2200 // Restore context register. | 2204 // Restore context register. |
2201 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2205 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
2202 context()->DropAndPlug(1, v0); | 2206 context()->DropAndPlug(1, v0); |
2203 } else if (proxy != NULL && proxy->var()->IsUnallocated()) { | 2207 } else if (proxy != NULL && proxy->var()->IsUnallocated()) { |
2204 // Push global object as receiver for the call IC. | 2208 // Push global object as receiver for the call IC. |
2205 __ lw(a0, GlobalObjectOperand()); | 2209 __ lw(a0, GlobalObjectOperand()); |
2206 __ push(a0); | 2210 __ push(a0); |
2207 EmitCallWithIC(expr, proxy->name(), RelocInfo::CODE_TARGET_CONTEXT); | 2211 EmitCallWithIC(expr, proxy->name(), RelocInfo::CODE_TARGET_CONTEXT); |
(...skipping 1355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3563 int arg_count = args->length(); | 3567 int arg_count = args->length(); |
3564 for (int i = 0; i < arg_count; i++) { | 3568 for (int i = 0; i < arg_count; i++) { |
3565 VisitForStackValue(args->at(i)); | 3569 VisitForStackValue(args->at(i)); |
3566 } | 3570 } |
3567 | 3571 |
3568 if (expr->is_jsruntime()) { | 3572 if (expr->is_jsruntime()) { |
3569 // Call the JS runtime function. | 3573 // Call the JS runtime function. |
3570 __ li(a2, Operand(expr->name())); | 3574 __ li(a2, Operand(expr->name())); |
3571 RelocInfo::Mode mode = RelocInfo::CODE_TARGET; | 3575 RelocInfo::Mode mode = RelocInfo::CODE_TARGET; |
3572 Handle<Code> ic = | 3576 Handle<Code> ic = |
3573 isolate()->stub_cache()->ComputeCallInitialize(arg_count, mode); | 3577 isolate()->stub_cache()->ComputeCallInitialize(arg_count, |
| 3578 NOT_IN_LOOP, |
| 3579 mode); |
3574 __ Call(ic, mode, expr->id()); | 3580 __ Call(ic, mode, expr->id()); |
3575 // Restore context register. | 3581 // Restore context register. |
3576 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 3582 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
3577 } else { | 3583 } else { |
3578 // Call the C runtime function. | 3584 // Call the C runtime function. |
3579 __ CallRuntime(expr->function(), arg_count); | 3585 __ CallRuntime(expr->function(), arg_count); |
3580 } | 3586 } |
3581 context()->Plug(v0); | 3587 context()->Plug(v0); |
3582 } | 3588 } |
3583 | 3589 |
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4243 *context_length = 0; | 4249 *context_length = 0; |
4244 return previous_; | 4250 return previous_; |
4245 } | 4251 } |
4246 | 4252 |
4247 | 4253 |
4248 #undef __ | 4254 #undef __ |
4249 | 4255 |
4250 } } // namespace v8::internal | 4256 } } // namespace v8::internal |
4251 | 4257 |
4252 #endif // V8_TARGET_ARCH_MIPS | 4258 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |