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_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
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 3044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3055 PreservePositionScope scope(masm()->positions_recorder()); | 3055 PreservePositionScope scope(masm()->positions_recorder()); |
3056 VisitForStackValue(property->obj()); | 3056 VisitForStackValue(property->obj()); |
3057 } | 3057 } |
3058 if (is_named_call) { | 3058 if (is_named_call) { |
3059 EmitCallWithLoadIC(expr); | 3059 EmitCallWithLoadIC(expr); |
3060 } else { | 3060 } else { |
3061 EmitKeyedCallWithLoadIC(expr, property->key()); | 3061 EmitKeyedCallWithLoadIC(expr, property->key()); |
3062 } | 3062 } |
3063 } | 3063 } |
3064 } else if (call_type == Call::SUPER_CALL) { | 3064 } else if (call_type == Call::SUPER_CALL) { |
3065 SuperReference* super_ref = callee->AsSuperReference(); | 3065 if (FLAG_experimental_classes) { |
3066 EmitLoadSuperConstructor(super_ref); | 3066 EmitSuperConstructorCall(expr); |
3067 __ push(result_register()); | 3067 } else { |
3068 VisitForStackValue(super_ref->this_var()); | 3068 SuperReference* super_ref = callee->AsSuperReference(); |
3069 EmitCall(expr, CallICState::METHOD); | 3069 EmitLoadSuperConstructor(super_ref); |
3070 __ push(result_register()); | |
3071 VisitForStackValue(super_ref->this_var()); | |
3072 EmitCall(expr, CallICState::METHOD); | |
3073 } | |
3070 } else { | 3074 } else { |
3071 DCHECK(call_type == Call::OTHER_CALL); | 3075 DCHECK(call_type == Call::OTHER_CALL); |
3072 // Call to an arbitrary expression not handled specially above. | 3076 // Call to an arbitrary expression not handled specially above. |
3073 { PreservePositionScope scope(masm()->positions_recorder()); | 3077 { PreservePositionScope scope(masm()->positions_recorder()); |
3074 VisitForStackValue(callee); | 3078 VisitForStackValue(callee); |
3075 } | 3079 } |
3076 __ push(Immediate(isolate()->factory()->undefined_value())); | 3080 __ push(Immediate(isolate()->factory()->undefined_value())); |
3077 // Emit function call. | 3081 // Emit function call. |
3078 EmitCall(expr); | 3082 EmitCall(expr); |
3079 } | 3083 } |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3126 __ LoadHeapObject(ebx, FeedbackVector()); | 3130 __ LoadHeapObject(ebx, FeedbackVector()); |
3127 __ mov(edx, Immediate(SmiFromSlot(expr->CallNewFeedbackSlot()))); | 3131 __ mov(edx, Immediate(SmiFromSlot(expr->CallNewFeedbackSlot()))); |
3128 | 3132 |
3129 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); | 3133 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); |
3130 __ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); | 3134 __ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); |
3131 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); | 3135 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); |
3132 context()->Plug(eax); | 3136 context()->Plug(eax); |
3133 } | 3137 } |
3134 | 3138 |
3135 | 3139 |
3140 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { | |
3141 SuperReference* super_ref = expr->expression()->AsSuperReference(); | |
3142 EmitLoadSuperConstructor(super_ref); | |
3143 __ push(result_register()); | |
3144 | |
arv (Not doing code reviews)
2015/01/21 19:18:55
remove one empty line
Dmitry Lomov (no reviews)
2015/01/22 11:59:00
Done.
| |
3145 | |
3146 // Push the arguments ("left-to-right") on the stack. | |
3147 ZoneList<Expression*>* args = expr->arguments(); | |
3148 int arg_count = args->length(); | |
3149 for (int i = 0; i < arg_count; i++) { | |
3150 VisitForStackValue(args->at(i)); | |
3151 } | |
3152 | |
3153 // Call the construct call builtin that handles allocation and | |
3154 // constructor invocation. | |
3155 SetSourcePosition(expr->position()); | |
3156 | |
3157 // Load function and argument count into edi and eax. | |
3158 __ Move(eax, Immediate(arg_count)); | |
3159 __ mov(edi, Operand(esp, arg_count * kPointerSize)); | |
3160 | |
3161 // Record call targets in unoptimized code. | |
3162 if (FLAG_pretenuring_call_new) { | |
3163 CHECK(false); | |
arv (Not doing code reviews)
2015/01/21 19:18:56
UNREACHABLE()
Dmitry Lomov (no reviews)
2015/01/22 11:59:00
Done.
| |
3164 /* | |
3165 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); | |
arv (Not doing code reviews)
2015/01/21 19:18:56
TODO
Dmitry Lomov (no reviews)
2015/01/22 11:59:00
Done.
| |
3166 DCHECK(expr->AllocationSiteFeedbackSlot().ToInt() == | |
3167 expr->CallNewFeedbackSlot().ToInt() + 1); | |
3168 */ | |
3169 } | |
3170 | |
3171 __ LoadHeapObject(ebx, FeedbackVector()); | |
3172 __ mov(edx, Immediate(SmiFromSlot(expr->CallFeedbackSlot()))); | |
3173 | |
3174 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); | |
arv (Not doing code reviews)
2015/01/21 19:18:55
It is not clear to me where NewTarget is pushed on
Dmitry Lomov (no reviews)
2015/01/22 11:59:00
Not yet, added a todo.
| |
3175 __ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); | |
3176 | |
3177 RecordJSReturnSite(expr); | |
3178 | |
3179 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); | |
3180 EmitVariableAssignment(super_ref->this_var()->var(), Token::INIT_LET); | |
arv (Not doing code reviews)
2015/01/21 19:18:56
Or INIT_CONST?
Dmitry Lomov (no reviews)
2015/01/22 11:59:00
Added a TODO to revisit this after TDZ is implemen
| |
3181 context()->Plug(eax); | |
3182 } | |
3183 | |
3184 | |
3136 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { | 3185 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { |
3137 ZoneList<Expression*>* args = expr->arguments(); | 3186 ZoneList<Expression*>* args = expr->arguments(); |
3138 DCHECK(args->length() == 1); | 3187 DCHECK(args->length() == 1); |
3139 | 3188 |
3140 VisitForAccumulatorValue(args->at(0)); | 3189 VisitForAccumulatorValue(args->at(0)); |
3141 | 3190 |
3142 Label materialize_true, materialize_false; | 3191 Label materialize_true, materialize_false; |
3143 Label* if_true = NULL; | 3192 Label* if_true = NULL; |
3144 Label* if_false = NULL; | 3193 Label* if_false = NULL; |
3145 Label* fall_through = NULL; | 3194 Label* fall_through = NULL; |
(...skipping 2090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5236 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 5285 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
5237 Assembler::target_address_at(call_target_address, | 5286 Assembler::target_address_at(call_target_address, |
5238 unoptimized_code)); | 5287 unoptimized_code)); |
5239 return OSR_AFTER_STACK_CHECK; | 5288 return OSR_AFTER_STACK_CHECK; |
5240 } | 5289 } |
5241 | 5290 |
5242 | 5291 |
5243 } } // namespace v8::internal | 5292 } } // namespace v8::internal |
5244 | 5293 |
5245 #endif // V8_TARGET_ARCH_IA32 | 5294 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |