| OLD | NEW | 
|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 2703 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2714 | 2714 | 
| 2715 void FullCodeGenerator::VisitCall(Call* expr) { | 2715 void FullCodeGenerator::VisitCall(Call* expr) { | 
| 2716 #ifdef DEBUG | 2716 #ifdef DEBUG | 
| 2717   // We want to verify that RecordJSReturnSite gets called on all paths | 2717   // We want to verify that RecordJSReturnSite gets called on all paths | 
| 2718   // through this function.  Avoid early returns. | 2718   // through this function.  Avoid early returns. | 
| 2719   expr->return_is_recorded_ = false; | 2719   expr->return_is_recorded_ = false; | 
| 2720 #endif | 2720 #endif | 
| 2721 | 2721 | 
| 2722   Comment cmnt(masm_, "[ Call"); | 2722   Comment cmnt(masm_, "[ Call"); | 
| 2723   Expression* callee = expr->expression(); | 2723   Expression* callee = expr->expression(); | 
| 2724   VariableProxy* proxy = callee->AsVariableProxy(); | 2724   Call::CallType call_type = expr->GetCallType(isolate()); | 
| 2725   Property* property = callee->AsProperty(); |  | 
| 2726 | 2725 | 
| 2727   if (proxy != NULL && proxy->var()->is_possibly_eval(isolate())) { | 2726   if (call_type == Call::POSSIBLY_EVAL_CALL) { | 
| 2728     // In a call to eval, we first call %ResolvePossiblyDirectEval to | 2727     // In a call to eval, we first call %ResolvePossiblyDirectEval to | 
| 2729     // resolve the function we need to call and the receiver of the | 2728     // resolve the function we need to call and the receiver of the | 
| 2730     // call.  Then we call the resolved function using the given | 2729     // call.  Then we call the resolved function using the given | 
| 2731     // arguments. | 2730     // arguments. | 
| 2732     ZoneList<Expression*>* args = expr->arguments(); | 2731     ZoneList<Expression*>* args = expr->arguments(); | 
| 2733     int arg_count = args->length(); | 2732     int arg_count = args->length(); | 
| 2734 | 2733 | 
| 2735     { PreservePositionScope pos_scope(masm()->positions_recorder()); | 2734     { PreservePositionScope pos_scope(masm()->positions_recorder()); | 
| 2736       VisitForStackValue(callee); | 2735       VisitForStackValue(callee); | 
| 2737       __ LoadRoot(r2, Heap::kUndefinedValueRootIndex); | 2736       __ LoadRoot(r2, Heap::kUndefinedValueRootIndex); | 
| (...skipping 18 matching lines...) Expand all  Loading... | 
| 2756 | 2755 | 
| 2757     // Record source position for debugger. | 2756     // Record source position for debugger. | 
| 2758     SetSourcePosition(expr->position()); | 2757     SetSourcePosition(expr->position()); | 
| 2759     CallFunctionStub stub(arg_count, NO_CALL_FUNCTION_FLAGS); | 2758     CallFunctionStub stub(arg_count, NO_CALL_FUNCTION_FLAGS); | 
| 2760     __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 2759     __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 
| 2761     __ CallStub(&stub); | 2760     __ CallStub(&stub); | 
| 2762     RecordJSReturnSite(expr); | 2761     RecordJSReturnSite(expr); | 
| 2763     // Restore context register. | 2762     // Restore context register. | 
| 2764     __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2763     __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 
| 2765     context()->DropAndPlug(1, r0); | 2764     context()->DropAndPlug(1, r0); | 
| 2766   } else if (proxy != NULL && proxy->var()->IsUnallocated()) { | 2765   } else if (call_type == Call::GLOBAL_CALL) { | 
| 2767     // Push global object as receiver for the call IC. | 2766     // Push global object as receiver for the call IC. | 
| 2768     __ ldr(r0, GlobalObjectOperand()); | 2767     __ ldr(r0, GlobalObjectOperand()); | 
| 2769     __ push(r0); | 2768     __ push(r0); | 
|  | 2769     VariableProxy* proxy = callee->AsVariableProxy(); | 
| 2770     EmitCallWithIC(expr, proxy->name(), CONTEXTUAL); | 2770     EmitCallWithIC(expr, proxy->name(), CONTEXTUAL); | 
| 2771   } else if (proxy != NULL && proxy->var()->IsLookupSlot()) { | 2771   } else if (call_type == Call::LOOKUP_SLOT_CALL) { | 
| 2772     // Call to a lookup slot (dynamically introduced variable). | 2772     // Call to a lookup slot (dynamically introduced variable). | 
|  | 2773     VariableProxy* proxy = callee->AsVariableProxy(); | 
| 2773     Label slow, done; | 2774     Label slow, done; | 
| 2774 | 2775 | 
| 2775     { PreservePositionScope scope(masm()->positions_recorder()); | 2776     { PreservePositionScope scope(masm()->positions_recorder()); | 
| 2776       // Generate code for loading from variables potentially shadowed | 2777       // Generate code for loading from variables potentially shadowed | 
| 2777       // by eval-introduced variables. | 2778       // by eval-introduced variables. | 
| 2778       EmitDynamicLookupFastCase(proxy->var(), NOT_INSIDE_TYPEOF, &slow, &done); | 2779       EmitDynamicLookupFastCase(proxy->var(), NOT_INSIDE_TYPEOF, &slow, &done); | 
| 2779     } | 2780     } | 
| 2780 | 2781 | 
| 2781     __ bind(&slow); | 2782     __ bind(&slow); | 
| 2782     // Call the runtime to find the function to call (returned in r0) | 2783     // Call the runtime to find the function to call (returned in r0) | 
| (...skipping 16 matching lines...) Expand all  Loading... | 
| 2799       // The receiver is implicitly the global receiver. Indicate this | 2800       // The receiver is implicitly the global receiver. Indicate this | 
| 2800       // by passing the hole to the call function stub. | 2801       // by passing the hole to the call function stub. | 
| 2801       __ LoadRoot(r1, Heap::kUndefinedValueRootIndex); | 2802       __ LoadRoot(r1, Heap::kUndefinedValueRootIndex); | 
| 2802       __ push(r1); | 2803       __ push(r1); | 
| 2803       __ bind(&call); | 2804       __ bind(&call); | 
| 2804     } | 2805     } | 
| 2805 | 2806 | 
| 2806     // The receiver is either the global receiver or an object found | 2807     // The receiver is either the global receiver or an object found | 
| 2807     // by LoadContextSlot. | 2808     // by LoadContextSlot. | 
| 2808     EmitCallWithStub(expr); | 2809     EmitCallWithStub(expr); | 
| 2809   } else if (property != NULL) { | 2810   } else if (call_type == Call::PROPERTY_CALL) { | 
|  | 2811     Property* property = callee->AsProperty(); | 
| 2810     { PreservePositionScope scope(masm()->positions_recorder()); | 2812     { PreservePositionScope scope(masm()->positions_recorder()); | 
| 2811       VisitForStackValue(property->obj()); | 2813       VisitForStackValue(property->obj()); | 
| 2812     } | 2814     } | 
| 2813     if (property->key()->IsPropertyName()) { | 2815     if (property->key()->IsPropertyName()) { | 
| 2814       EmitCallWithIC(expr, | 2816       EmitCallWithIC(expr, | 
| 2815                      property->key()->AsLiteral()->value(), | 2817                      property->key()->AsLiteral()->value(), | 
| 2816                      NOT_CONTEXTUAL); | 2818                      NOT_CONTEXTUAL); | 
| 2817     } else { | 2819     } else { | 
| 2818       EmitKeyedCallWithIC(expr, property->key()); | 2820       EmitKeyedCallWithIC(expr, property->key()); | 
| 2819     } | 2821     } | 
| 2820   } else { | 2822   } else { | 
|  | 2823     ASSERT(call_type == Call::OTHER_CALL); | 
| 2821     // Call to an arbitrary expression not handled specially above. | 2824     // Call to an arbitrary expression not handled specially above. | 
| 2822     { PreservePositionScope scope(masm()->positions_recorder()); | 2825     { PreservePositionScope scope(masm()->positions_recorder()); | 
| 2823       VisitForStackValue(callee); | 2826       VisitForStackValue(callee); | 
| 2824     } | 2827     } | 
| 2825     __ LoadRoot(r1, Heap::kUndefinedValueRootIndex); | 2828     __ LoadRoot(r1, Heap::kUndefinedValueRootIndex); | 
| 2826     __ push(r1); | 2829     __ push(r1); | 
| 2827     // Emit function call. | 2830     // Emit function call. | 
| 2828     EmitCallWithStub(expr); | 2831     EmitCallWithStub(expr); | 
| 2829   } | 2832   } | 
| 2830 | 2833 | 
| (...skipping 2078 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 4909   ASSERT(Memory::uint32_at(interrupt_address_pointer) == | 4912   ASSERT(Memory::uint32_at(interrupt_address_pointer) == | 
| 4910          reinterpret_cast<uint32_t>( | 4913          reinterpret_cast<uint32_t>( | 
| 4911              isolate->builtins()->OsrAfterStackCheck()->entry())); | 4914              isolate->builtins()->OsrAfterStackCheck()->entry())); | 
| 4912   return OSR_AFTER_STACK_CHECK; | 4915   return OSR_AFTER_STACK_CHECK; | 
| 4913 } | 4916 } | 
| 4914 | 4917 | 
| 4915 | 4918 | 
| 4916 } }  // namespace v8::internal | 4919 } }  // namespace v8::internal | 
| 4917 | 4920 | 
| 4918 #endif  // V8_TARGET_ARCH_ARM | 4921 #endif  // V8_TARGET_ARCH_ARM | 
| OLD | NEW | 
|---|