| 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_X87 | 7 #if V8_TARGET_ARCH_X87 |
| 8 | 8 |
| 9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 2836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2847 __ push(Immediate(Smi::FromInt(strict_mode()))); | 2847 __ push(Immediate(Smi::FromInt(strict_mode()))); |
| 2848 | 2848 |
| 2849 // Push the start position of the scope the calls resides in. | 2849 // Push the start position of the scope the calls resides in. |
| 2850 __ push(Immediate(Smi::FromInt(scope()->start_position()))); | 2850 __ push(Immediate(Smi::FromInt(scope()->start_position()))); |
| 2851 | 2851 |
| 2852 // Do the runtime call. | 2852 // Do the runtime call. |
| 2853 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 5); | 2853 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 5); |
| 2854 } | 2854 } |
| 2855 | 2855 |
| 2856 | 2856 |
| 2857 void FullCodeGenerator::EmitLoadSuperConstructor(SuperReference* super_ref) { |
| 2858 DCHECK(super_ref != NULL); |
| 2859 __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
| 2860 __ CallRuntime(Runtime::kGetPrototype, 1); |
| 2861 } |
| 2862 |
| 2863 |
| 2857 void FullCodeGenerator::VisitCall(Call* expr) { | 2864 void FullCodeGenerator::VisitCall(Call* expr) { |
| 2858 #ifdef DEBUG | 2865 #ifdef DEBUG |
| 2859 // We want to verify that RecordJSReturnSite gets called on all paths | 2866 // We want to verify that RecordJSReturnSite gets called on all paths |
| 2860 // through this function. Avoid early returns. | 2867 // through this function. Avoid early returns. |
| 2861 expr->return_is_recorded_ = false; | 2868 expr->return_is_recorded_ = false; |
| 2862 #endif | 2869 #endif |
| 2863 | 2870 |
| 2864 Comment cmnt(masm_, "[ Call"); | 2871 Comment cmnt(masm_, "[ Call"); |
| 2865 Expression* callee = expr->expression(); | 2872 Expression* callee = expr->expression(); |
| 2866 Call::CallType call_type = expr->GetCallType(isolate()); | 2873 Call::CallType call_type = expr->GetCallType(isolate()); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2957 VisitForStackValue(property->obj()); | 2964 VisitForStackValue(property->obj()); |
| 2958 } | 2965 } |
| 2959 if (is_named_call) { | 2966 if (is_named_call) { |
| 2960 EmitCallWithLoadIC(expr); | 2967 EmitCallWithLoadIC(expr); |
| 2961 } else { | 2968 } else { |
| 2962 EmitKeyedCallWithLoadIC(expr, property->key()); | 2969 EmitKeyedCallWithLoadIC(expr, property->key()); |
| 2963 } | 2970 } |
| 2964 } | 2971 } |
| 2965 } else if (call_type == Call::SUPER_CALL) { | 2972 } else if (call_type == Call::SUPER_CALL) { |
| 2966 SuperReference* super_ref = callee->AsSuperReference(); | 2973 SuperReference* super_ref = callee->AsSuperReference(); |
| 2967 DCHECK(super_ref != NULL); | 2974 EmitLoadSuperConstructor(super_ref); |
| 2968 __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | |
| 2969 __ CallRuntime(Runtime::kGetPrototype, 1); | |
| 2970 __ push(result_register()); | 2975 __ push(result_register()); |
| 2971 VisitForStackValue(super_ref->this_var()); | 2976 VisitForStackValue(super_ref->this_var()); |
| 2972 EmitCall(expr, CallICState::METHOD); | 2977 EmitCall(expr, CallICState::METHOD); |
| 2973 } else { | 2978 } else { |
| 2974 DCHECK(call_type == Call::OTHER_CALL); | 2979 DCHECK(call_type == Call::OTHER_CALL); |
| 2975 // Call to an arbitrary expression not handled specially above. | 2980 // Call to an arbitrary expression not handled specially above. |
| 2976 { PreservePositionScope scope(masm()->positions_recorder()); | 2981 { PreservePositionScope scope(masm()->positions_recorder()); |
| 2977 VisitForStackValue(callee); | 2982 VisitForStackValue(callee); |
| 2978 } | 2983 } |
| 2979 __ push(Immediate(isolate()->factory()->undefined_value())); | 2984 __ push(Immediate(isolate()->factory()->undefined_value())); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 2990 | 2995 |
| 2991 void FullCodeGenerator::VisitCallNew(CallNew* expr) { | 2996 void FullCodeGenerator::VisitCallNew(CallNew* expr) { |
| 2992 Comment cmnt(masm_, "[ CallNew"); | 2997 Comment cmnt(masm_, "[ CallNew"); |
| 2993 // According to ECMA-262, section 11.2.2, page 44, the function | 2998 // According to ECMA-262, section 11.2.2, page 44, the function |
| 2994 // expression in new calls must be evaluated before the | 2999 // expression in new calls must be evaluated before the |
| 2995 // arguments. | 3000 // arguments. |
| 2996 | 3001 |
| 2997 // Push constructor on the stack. If it's not a function it's used as | 3002 // Push constructor on the stack. If it's not a function it's used as |
| 2998 // receiver for CALL_NON_FUNCTION, otherwise the value on the stack is | 3003 // receiver for CALL_NON_FUNCTION, otherwise the value on the stack is |
| 2999 // ignored. | 3004 // ignored. |
| 3000 VisitForStackValue(expr->expression()); | 3005 if (expr->expression()->IsSuperReference()) { |
| 3006 EmitLoadSuperConstructor(expr->expression()->AsSuperReference()); |
| 3007 __ push(result_register()); |
| 3008 } else { |
| 3009 VisitForStackValue(expr->expression()); |
| 3010 } |
| 3001 | 3011 |
| 3002 // Push the arguments ("left-to-right") on the stack. | 3012 // Push the arguments ("left-to-right") on the stack. |
| 3003 ZoneList<Expression*>* args = expr->arguments(); | 3013 ZoneList<Expression*>* args = expr->arguments(); |
| 3004 int arg_count = args->length(); | 3014 int arg_count = args->length(); |
| 3005 for (int i = 0; i < arg_count; i++) { | 3015 for (int i = 0; i < arg_count; i++) { |
| 3006 VisitForStackValue(args->at(i)); | 3016 VisitForStackValue(args->at(i)); |
| 3007 } | 3017 } |
| 3008 | 3018 |
| 3009 // Call the construct call builtin that handles allocation and | 3019 // Call the construct call builtin that handles allocation and |
| 3010 // constructor invocation. | 3020 // constructor invocation. |
| (...skipping 2121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5132 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 5142 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
| 5133 Assembler::target_address_at(call_target_address, | 5143 Assembler::target_address_at(call_target_address, |
| 5134 unoptimized_code)); | 5144 unoptimized_code)); |
| 5135 return OSR_AFTER_STACK_CHECK; | 5145 return OSR_AFTER_STACK_CHECK; |
| 5136 } | 5146 } |
| 5137 | 5147 |
| 5138 | 5148 |
| 5139 } } // namespace v8::internal | 5149 } } // namespace v8::internal |
| 5140 | 5150 |
| 5141 #endif // V8_TARGET_ARCH_X87 | 5151 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |