OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_MIPS64 | 7 #if V8_TARGET_ARCH_MIPS64 |
8 | 8 |
9 // Note on Mips implementation: | 9 // Note on Mips implementation: |
10 // | 10 // |
(...skipping 2920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2931 | 2931 |
2932 // a1: the start position of the scope the calls resides in. | 2932 // a1: the start position of the scope the calls resides in. |
2933 __ li(a1, Operand(Smi::FromInt(scope()->start_position()))); | 2933 __ li(a1, Operand(Smi::FromInt(scope()->start_position()))); |
2934 | 2934 |
2935 // Do the runtime call. | 2935 // Do the runtime call. |
2936 __ Push(a6, a5, a4, a1); | 2936 __ Push(a6, a5, a4, a1); |
2937 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 5); | 2937 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 5); |
2938 } | 2938 } |
2939 | 2939 |
2940 | 2940 |
| 2941 void FullCodeGenerator::EmitLoadSuperConstructor(SuperReference* super_ref) { |
| 2942 DCHECK(super_ref != NULL); |
| 2943 __ ld(a0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
| 2944 __ Push(a0); |
| 2945 __ CallRuntime(Runtime::kGetPrototype, 1); |
| 2946 } |
| 2947 |
| 2948 |
2941 void FullCodeGenerator::VisitCall(Call* expr) { | 2949 void FullCodeGenerator::VisitCall(Call* expr) { |
2942 #ifdef DEBUG | 2950 #ifdef DEBUG |
2943 // We want to verify that RecordJSReturnSite gets called on all paths | 2951 // We want to verify that RecordJSReturnSite gets called on all paths |
2944 // through this function. Avoid early returns. | 2952 // through this function. Avoid early returns. |
2945 expr->return_is_recorded_ = false; | 2953 expr->return_is_recorded_ = false; |
2946 #endif | 2954 #endif |
2947 | 2955 |
2948 Comment cmnt(masm_, "[ Call"); | 2956 Comment cmnt(masm_, "[ Call"); |
2949 Expression* callee = expr->expression(); | 2957 Expression* callee = expr->expression(); |
2950 Call::CallType call_type = expr->GetCallType(isolate()); | 2958 Call::CallType call_type = expr->GetCallType(isolate()); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3046 VisitForStackValue(property->obj()); | 3054 VisitForStackValue(property->obj()); |
3047 } | 3055 } |
3048 if (is_named_call) { | 3056 if (is_named_call) { |
3049 EmitCallWithLoadIC(expr); | 3057 EmitCallWithLoadIC(expr); |
3050 } else { | 3058 } else { |
3051 EmitKeyedCallWithLoadIC(expr, property->key()); | 3059 EmitKeyedCallWithLoadIC(expr, property->key()); |
3052 } | 3060 } |
3053 } | 3061 } |
3054 } else if (call_type == Call::SUPER_CALL) { | 3062 } else if (call_type == Call::SUPER_CALL) { |
3055 SuperReference* super_ref = callee->AsSuperReference(); | 3063 SuperReference* super_ref = callee->AsSuperReference(); |
3056 DCHECK(super_ref != NULL); | 3064 EmitLoadSuperConstructor(super_ref); |
3057 __ ld(a0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | |
3058 __ Push(a0); | |
3059 __ CallRuntime(Runtime::kGetPrototype, 1); | |
3060 __ Push(result_register()); | 3065 __ Push(result_register()); |
3061 VisitForStackValue(super_ref->this_var()); | 3066 VisitForStackValue(super_ref->this_var()); |
3062 EmitCall(expr, CallICState::METHOD); | 3067 EmitCall(expr, CallICState::METHOD); |
3063 } else { | 3068 } else { |
3064 DCHECK(call_type == Call::OTHER_CALL); | 3069 DCHECK(call_type == Call::OTHER_CALL); |
3065 // Call to an arbitrary expression not handled specially above. | 3070 // Call to an arbitrary expression not handled specially above. |
3066 { PreservePositionScope scope(masm()->positions_recorder()); | 3071 { PreservePositionScope scope(masm()->positions_recorder()); |
3067 VisitForStackValue(callee); | 3072 VisitForStackValue(callee); |
3068 } | 3073 } |
3069 __ LoadRoot(a1, Heap::kUndefinedValueRootIndex); | 3074 __ LoadRoot(a1, Heap::kUndefinedValueRootIndex); |
(...skipping 11 matching lines...) Expand all Loading... |
3081 | 3086 |
3082 void FullCodeGenerator::VisitCallNew(CallNew* expr) { | 3087 void FullCodeGenerator::VisitCallNew(CallNew* expr) { |
3083 Comment cmnt(masm_, "[ CallNew"); | 3088 Comment cmnt(masm_, "[ CallNew"); |
3084 // According to ECMA-262, section 11.2.2, page 44, the function | 3089 // According to ECMA-262, section 11.2.2, page 44, the function |
3085 // expression in new calls must be evaluated before the | 3090 // expression in new calls must be evaluated before the |
3086 // arguments. | 3091 // arguments. |
3087 | 3092 |
3088 // Push constructor on the stack. If it's not a function it's used as | 3093 // Push constructor on the stack. If it's not a function it's used as |
3089 // receiver for CALL_NON_FUNCTION, otherwise the value on the stack is | 3094 // receiver for CALL_NON_FUNCTION, otherwise the value on the stack is |
3090 // ignored. | 3095 // ignored. |
3091 VisitForStackValue(expr->expression()); | 3096 if (expr->expression()->IsSuperReference()) { |
| 3097 EmitLoadSuperConstructor(expr->expression()->AsSuperReference()); |
| 3098 __ Push(result_register()); |
| 3099 } else { |
| 3100 VisitForStackValue(expr->expression()); |
| 3101 } |
3092 | 3102 |
3093 // Push the arguments ("left-to-right") on the stack. | 3103 // Push the arguments ("left-to-right") on the stack. |
3094 ZoneList<Expression*>* args = expr->arguments(); | 3104 ZoneList<Expression*>* args = expr->arguments(); |
3095 int arg_count = args->length(); | 3105 int arg_count = args->length(); |
3096 for (int i = 0; i < arg_count; i++) { | 3106 for (int i = 0; i < arg_count; i++) { |
3097 VisitForStackValue(args->at(i)); | 3107 VisitForStackValue(args->at(i)); |
3098 } | 3108 } |
3099 // Call the construct call builtin that handles allocation and | 3109 // Call the construct call builtin that handles allocation and |
3100 // constructor invocation. | 3110 // constructor invocation. |
3101 SetSourcePosition(expr->position()); | 3111 SetSourcePosition(expr->position()); |
(...skipping 2105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5207 Assembler::target_address_at(pc_immediate_load_address)) == | 5217 Assembler::target_address_at(pc_immediate_load_address)) == |
5208 reinterpret_cast<uint64_t>( | 5218 reinterpret_cast<uint64_t>( |
5209 isolate->builtins()->OsrAfterStackCheck()->entry())); | 5219 isolate->builtins()->OsrAfterStackCheck()->entry())); |
5210 return OSR_AFTER_STACK_CHECK; | 5220 return OSR_AFTER_STACK_CHECK; |
5211 } | 5221 } |
5212 | 5222 |
5213 | 5223 |
5214 } } // namespace v8::internal | 5224 } } // namespace v8::internal |
5215 | 5225 |
5216 #endif // V8_TARGET_ARCH_MIPS64 | 5226 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |