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