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_X64 | 7 #if V8_TARGET_ARCH_X64 |
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 2849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2860 __ Push(Smi::FromInt(strict_mode())); | 2860 __ Push(Smi::FromInt(strict_mode())); |
2861 | 2861 |
2862 // Push the start position of the scope the calls resides in. | 2862 // Push the start position of the scope the calls resides in. |
2863 __ Push(Smi::FromInt(scope()->start_position())); | 2863 __ Push(Smi::FromInt(scope()->start_position())); |
2864 | 2864 |
2865 // Do the runtime call. | 2865 // Do the runtime call. |
2866 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 5); | 2866 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 5); |
2867 } | 2867 } |
2868 | 2868 |
2869 | 2869 |
2870 void FullCodeGenerator::EmitLoadSuperConstructor(SuperReference* expr) { | |
2871 DCHECK(super_ref != NULL); | |
2872 __ Push(Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); | |
2873 __ CallRuntime(Runtime::kGetPrototype, 1); | |
2874 } | |
2875 | |
2876 | |
2870 void FullCodeGenerator::VisitCall(Call* expr) { | 2877 void FullCodeGenerator::VisitCall(Call* expr) { |
2871 #ifdef DEBUG | 2878 #ifdef DEBUG |
2872 // We want to verify that RecordJSReturnSite gets called on all paths | 2879 // We want to verify that RecordJSReturnSite gets called on all paths |
2873 // through this function. Avoid early returns. | 2880 // through this function. Avoid early returns. |
2874 expr->return_is_recorded_ = false; | 2881 expr->return_is_recorded_ = false; |
2875 #endif | 2882 #endif |
2876 | 2883 |
2877 Comment cmnt(masm_, "[ Call"); | 2884 Comment cmnt(masm_, "[ Call"); |
2878 Expression* callee = expr->expression(); | 2885 Expression* callee = expr->expression(); |
2879 Call::CallType call_type = expr->GetCallType(isolate()); | 2886 Call::CallType call_type = expr->GetCallType(isolate()); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2969 VisitForStackValue(property->obj()); | 2976 VisitForStackValue(property->obj()); |
2970 } | 2977 } |
2971 if (is_named_call) { | 2978 if (is_named_call) { |
2972 EmitCallWithLoadIC(expr); | 2979 EmitCallWithLoadIC(expr); |
2973 } else { | 2980 } else { |
2974 EmitKeyedCallWithLoadIC(expr, property->key()); | 2981 EmitKeyedCallWithLoadIC(expr, property->key()); |
2975 } | 2982 } |
2976 } | 2983 } |
2977 } else if (call_type == Call::SUPER_CALL) { | 2984 } else if (call_type == Call::SUPER_CALL) { |
2978 SuperReference* super_ref = callee->AsSuperReference(); | 2985 SuperReference* super_ref = callee->AsSuperReference(); |
2979 DCHECK(super_ref != NULL); | 2986 DCHECK(super_ref != NULL); |
Igor Sheludko
2014/10/23 07:37:23
We have this DCHECK inside EmitLoadSuperConstructo
Dmitry Lomov (no reviews)
2014/10/23 07:55:19
Done.
| |
2980 __ Push(Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); | 2987 EmitLoadSuperConstructor(super_ref); |
2981 __ CallRuntime(Runtime::kGetPrototype, 1); | |
2982 __ Push(result_register()); | 2988 __ Push(result_register()); |
2983 VisitForStackValue(super_ref->this_var()); | 2989 VisitForStackValue(super_ref->this_var()); |
2984 EmitCall(expr, CallICState::METHOD); | 2990 EmitCall(expr, CallICState::METHOD); |
2985 } else { | 2991 } else { |
2986 DCHECK(call_type == Call::OTHER_CALL); | 2992 DCHECK(call_type == Call::OTHER_CALL); |
2987 // Call to an arbitrary expression not handled specially above. | 2993 // Call to an arbitrary expression not handled specially above. |
2988 { PreservePositionScope scope(masm()->positions_recorder()); | 2994 { PreservePositionScope scope(masm()->positions_recorder()); |
2989 VisitForStackValue(callee); | 2995 VisitForStackValue(callee); |
2990 } | 2996 } |
2991 __ PushRoot(Heap::kUndefinedValueRootIndex); | 2997 __ PushRoot(Heap::kUndefinedValueRootIndex); |
(...skipping 10 matching lines...) Expand all Loading... | |
3002 | 3008 |
3003 void FullCodeGenerator::VisitCallNew(CallNew* expr) { | 3009 void FullCodeGenerator::VisitCallNew(CallNew* expr) { |
3004 Comment cmnt(masm_, "[ CallNew"); | 3010 Comment cmnt(masm_, "[ CallNew"); |
3005 // According to ECMA-262, section 11.2.2, page 44, the function | 3011 // According to ECMA-262, section 11.2.2, page 44, the function |
3006 // expression in new calls must be evaluated before the | 3012 // expression in new calls must be evaluated before the |
3007 // arguments. | 3013 // arguments. |
3008 | 3014 |
3009 // Push constructor on the stack. If it's not a function it's used as | 3015 // Push constructor on the stack. If it's not a function it's used as |
3010 // receiver for CALL_NON_FUNCTION, otherwise the value on the stack is | 3016 // receiver for CALL_NON_FUNCTION, otherwise the value on the stack is |
3011 // ignored. | 3017 // ignored. |
3012 VisitForStackValue(expr->expression()); | 3018 if (expr->expression()->IsSuperReference()) { |
3019 EmitLoadSuperConstructor(expr->expression()->AsSuperReference()); | |
3020 __ Push(result_register()); | |
3021 } else { | |
3022 VisitForStackValue(expr->expression()); | |
3023 } | |
3013 | 3024 |
3014 // Push the arguments ("left-to-right") on the stack. | 3025 // Push the arguments ("left-to-right") on the stack. |
3015 ZoneList<Expression*>* args = expr->arguments(); | 3026 ZoneList<Expression*>* args = expr->arguments(); |
3016 int arg_count = args->length(); | 3027 int arg_count = args->length(); |
3017 for (int i = 0; i < arg_count; i++) { | 3028 for (int i = 0; i < arg_count; i++) { |
3018 VisitForStackValue(args->at(i)); | 3029 VisitForStackValue(args->at(i)); |
3019 } | 3030 } |
3020 | 3031 |
3021 // Call the construct call builtin that handles allocation and | 3032 // Call the construct call builtin that handles allocation and |
3022 // constructor invocation. | 3033 // constructor invocation. |
(...skipping 2138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5161 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 5172 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
5162 Assembler::target_address_at(call_target_address, | 5173 Assembler::target_address_at(call_target_address, |
5163 unoptimized_code)); | 5174 unoptimized_code)); |
5164 return OSR_AFTER_STACK_CHECK; | 5175 return OSR_AFTER_STACK_CHECK; |
5165 } | 5176 } |
5166 | 5177 |
5167 | 5178 |
5168 } } // namespace v8::internal | 5179 } } // namespace v8::internal |
5169 | 5180 |
5170 #endif // V8_TARGET_ARCH_X64 | 5181 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |