| 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 3115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3126 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); | 3126 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); |
| 3127 context()->Plug(eax); | 3127 context()->Plug(eax); |
| 3128 } | 3128 } |
| 3129 | 3129 |
| 3130 | 3130 |
| 3131 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { | 3131 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { |
| 3132 Variable* new_target_var = scope()->DeclarationScope()->new_target_var(); | 3132 Variable* new_target_var = scope()->DeclarationScope()->new_target_var(); |
| 3133 GetVar(eax, new_target_var); | 3133 GetVar(eax, new_target_var); |
| 3134 __ push(eax); | 3134 __ push(eax); |
| 3135 | 3135 |
| 3136 SuperReference* super_ref = expr->expression()->AsSuperReference(); | |
| 3137 EmitLoadSuperConstructor(); | 3136 EmitLoadSuperConstructor(); |
| 3138 __ push(result_register()); | 3137 __ push(result_register()); |
| 3139 | 3138 |
| 3140 Variable* this_var = super_ref->this_var()->var(); | |
| 3141 GetVar(eax, this_var); | |
| 3142 __ cmp(eax, isolate()->factory()->the_hole_value()); | |
| 3143 Label uninitialized_this; | |
| 3144 __ j(equal, &uninitialized_this); | |
| 3145 __ push(Immediate(this_var->name())); | |
| 3146 __ CallRuntime(Runtime::kThrowReferenceError, 1); | |
| 3147 __ bind(&uninitialized_this); | |
| 3148 | |
| 3149 // Push the arguments ("left-to-right") on the stack. | 3139 // Push the arguments ("left-to-right") on the stack. |
| 3150 ZoneList<Expression*>* args = expr->arguments(); | 3140 ZoneList<Expression*>* args = expr->arguments(); |
| 3151 int arg_count = args->length(); | 3141 int arg_count = args->length(); |
| 3152 for (int i = 0; i < arg_count; i++) { | 3142 for (int i = 0; i < arg_count; i++) { |
| 3153 VisitForStackValue(args->at(i)); | 3143 VisitForStackValue(args->at(i)); |
| 3154 } | 3144 } |
| 3155 | 3145 |
| 3156 // Call the construct call builtin that handles allocation and | 3146 // Call the construct call builtin that handles allocation and |
| 3157 // constructor invocation. | 3147 // constructor invocation. |
| 3158 SetSourcePosition(expr->position()); | 3148 SetSourcePosition(expr->position()); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 3174 __ LoadHeapObject(ebx, FeedbackVector()); | 3164 __ LoadHeapObject(ebx, FeedbackVector()); |
| 3175 __ mov(edx, Immediate(SmiFromSlot(expr->CallFeedbackSlot()))); | 3165 __ mov(edx, Immediate(SmiFromSlot(expr->CallFeedbackSlot()))); |
| 3176 | 3166 |
| 3177 CallConstructStub stub(isolate(), SUPER_CALL_RECORD_TARGET); | 3167 CallConstructStub stub(isolate(), SUPER_CALL_RECORD_TARGET); |
| 3178 __ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); | 3168 __ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); |
| 3179 | 3169 |
| 3180 __ Drop(1); | 3170 __ Drop(1); |
| 3181 | 3171 |
| 3182 RecordJSReturnSite(expr); | 3172 RecordJSReturnSite(expr); |
| 3183 | 3173 |
| 3174 SuperReference* super_ref = expr->expression()->AsSuperReference(); |
| 3175 Variable* this_var = super_ref->this_var()->var(); |
| 3176 GetVar(ecx, this_var); |
| 3177 __ cmp(ecx, isolate()->factory()->the_hole_value()); |
| 3178 Label uninitialized_this; |
| 3179 __ j(equal, &uninitialized_this); |
| 3180 __ push(Immediate(this_var->name())); |
| 3181 __ CallRuntime(Runtime::kThrowReferenceError, 1); |
| 3182 __ bind(&uninitialized_this); |
| 3183 |
| 3184 EmitVariableAssignment(this_var, Token::INIT_CONST); | 3184 EmitVariableAssignment(this_var, Token::INIT_CONST); |
| 3185 context()->Plug(eax); | 3185 context()->Plug(eax); |
| 3186 } | 3186 } |
| 3187 | 3187 |
| 3188 | 3188 |
| 3189 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { | 3189 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { |
| 3190 ZoneList<Expression*>* args = expr->arguments(); | 3190 ZoneList<Expression*>* args = expr->arguments(); |
| 3191 DCHECK(args->length() == 1); | 3191 DCHECK(args->length() == 1); |
| 3192 | 3192 |
| 3193 VisitForAccumulatorValue(args->at(0)); | 3193 VisitForAccumulatorValue(args->at(0)); |
| (...skipping 2143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5337 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 5337 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
| 5338 Assembler::target_address_at(call_target_address, | 5338 Assembler::target_address_at(call_target_address, |
| 5339 unoptimized_code)); | 5339 unoptimized_code)); |
| 5340 return OSR_AFTER_STACK_CHECK; | 5340 return OSR_AFTER_STACK_CHECK; |
| 5341 } | 5341 } |
| 5342 | 5342 |
| 5343 | 5343 |
| 5344 } } // namespace v8::internal | 5344 } } // namespace v8::internal |
| 5345 | 5345 |
| 5346 #endif // V8_TARGET_ARCH_X87 | 5346 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |