| 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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 // The stub will rewrite receiver and parameter count if the previous | 257 // The stub will rewrite receiver and parameter count if the previous |
| 258 // stack frame was an arguments adapter frame. | 258 // stack frame was an arguments adapter frame. |
| 259 ArgumentsAccessStub::Type type; | 259 ArgumentsAccessStub::Type type; |
| 260 if (is_strict(language_mode())) { | 260 if (is_strict(language_mode())) { |
| 261 type = ArgumentsAccessStub::NEW_STRICT; | 261 type = ArgumentsAccessStub::NEW_STRICT; |
| 262 } else if (function()->has_duplicate_parameters()) { | 262 } else if (function()->has_duplicate_parameters()) { |
| 263 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW; | 263 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW; |
| 264 } else { | 264 } else { |
| 265 type = ArgumentsAccessStub::NEW_SLOPPY_FAST; | 265 type = ArgumentsAccessStub::NEW_SLOPPY_FAST; |
| 266 } | 266 } |
| 267 ArgumentsAccessStub stub(isolate(), type); | 267 ArgumentsAccessStub::HasNewTarget has_new_target = |
| 268 IsSubclassConstructor(info->function()->kind()) |
| 269 ? ArgumentsAccessStub::HAS_NEW_TARGET |
| 270 : ArgumentsAccessStub::NO_NEW_TARGET; |
| 271 ArgumentsAccessStub stub(isolate(), type, has_new_target); |
| 268 __ CallStub(&stub); | 272 __ CallStub(&stub); |
| 269 | 273 |
| 270 SetVar(arguments, eax, ebx, edx); | 274 SetVar(arguments, eax, ebx, edx); |
| 271 } | 275 } |
| 272 | 276 |
| 273 if (FLAG_trace) { | 277 if (FLAG_trace) { |
| 274 __ CallRuntime(Runtime::kTraceEnter, 0); | 278 __ CallRuntime(Runtime::kTraceEnter, 0); |
| 275 } | 279 } |
| 276 | 280 |
| 277 // Visit the declarations and body unless there is an illegal | 281 // Visit the declarations and body unless there is an illegal |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 masm_->bind(&check_exit_codesize); | 410 masm_->bind(&check_exit_codesize); |
| 407 #endif | 411 #endif |
| 408 SetSourcePosition(function()->end_position() - 1); | 412 SetSourcePosition(function()->end_position() - 1); |
| 409 __ RecordJSReturn(); | 413 __ RecordJSReturn(); |
| 410 // Do not use the leave instruction here because it is too short to | 414 // Do not use the leave instruction here because it is too short to |
| 411 // patch with the code required by the debugger. | 415 // patch with the code required by the debugger. |
| 412 __ mov(esp, ebp); | 416 __ mov(esp, ebp); |
| 413 int no_frame_start = masm_->pc_offset(); | 417 int no_frame_start = masm_->pc_offset(); |
| 414 __ pop(ebp); | 418 __ pop(ebp); |
| 415 | 419 |
| 416 int arguments_bytes = (info_->scope()->num_parameters() + 1) * kPointerSize; | 420 int arg_count = info_->scope()->num_parameters() + 1; |
| 421 if (FLAG_experimental_classes && |
| 422 IsSubclassConstructor(info_->function()->kind())) { |
| 423 arg_count++; |
| 424 } |
| 425 int arguments_bytes = arg_count * kPointerSize; |
| 417 __ Ret(arguments_bytes, ecx); | 426 __ Ret(arguments_bytes, ecx); |
| 418 // Check that the size of the code used for returning is large enough | 427 // Check that the size of the code used for returning is large enough |
| 419 // for the debugger's requirements. | 428 // for the debugger's requirements. |
| 420 DCHECK(Assembler::kJSReturnSequenceLength <= | 429 DCHECK(Assembler::kJSReturnSequenceLength <= |
| 421 masm_->SizeOfCodeGeneratedSince(&check_exit_codesize)); | 430 masm_->SizeOfCodeGeneratedSince(&check_exit_codesize)); |
| 422 info_->AddNoFrameRange(no_frame_start, masm_->pc_offset()); | 431 info_->AddNoFrameRange(no_frame_start, masm_->pc_offset()); |
| 423 } | 432 } |
| 424 } | 433 } |
| 425 | 434 |
| 426 | 435 |
| (...skipping 2703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3130 __ mov(edx, Immediate(SmiFromSlot(expr->CallNewFeedbackSlot()))); | 3139 __ mov(edx, Immediate(SmiFromSlot(expr->CallNewFeedbackSlot()))); |
| 3131 | 3140 |
| 3132 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); | 3141 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); |
| 3133 __ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); | 3142 __ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); |
| 3134 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); | 3143 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); |
| 3135 context()->Plug(eax); | 3144 context()->Plug(eax); |
| 3136 } | 3145 } |
| 3137 | 3146 |
| 3138 | 3147 |
| 3139 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { | 3148 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { |
| 3149 Variable* new_target_var = scope()->DeclarationScope()->new_target_var(); |
| 3150 GetVar(eax, new_target_var); |
| 3151 __ push(eax); |
| 3152 |
| 3140 SuperReference* super_ref = expr->expression()->AsSuperReference(); | 3153 SuperReference* super_ref = expr->expression()->AsSuperReference(); |
| 3141 EmitLoadSuperConstructor(super_ref); | 3154 EmitLoadSuperConstructor(super_ref); |
| 3142 __ push(result_register()); | 3155 __ push(result_register()); |
| 3143 | 3156 |
| 3144 Variable* this_var = super_ref->this_var()->var(); | 3157 Variable* this_var = super_ref->this_var()->var(); |
| 3145 GetVar(eax, this_var); | 3158 GetVar(eax, this_var); |
| 3146 __ cmp(eax, isolate()->factory()->the_hole_value()); | 3159 __ cmp(eax, isolate()->factory()->the_hole_value()); |
| 3147 Label uninitialized_this; | 3160 Label uninitialized_this; |
| 3148 __ j(equal, &uninitialized_this); | 3161 __ j(equal, &uninitialized_this); |
| 3149 __ push(Immediate(this_var->name())); | 3162 __ push(Immediate(this_var->name())); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 3171 /* TODO(dslomov): support pretenuring. | 3184 /* TODO(dslomov): support pretenuring. |
| 3172 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); | 3185 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); |
| 3173 DCHECK(expr->AllocationSiteFeedbackSlot().ToInt() == | 3186 DCHECK(expr->AllocationSiteFeedbackSlot().ToInt() == |
| 3174 expr->CallNewFeedbackSlot().ToInt() + 1); | 3187 expr->CallNewFeedbackSlot().ToInt() + 1); |
| 3175 */ | 3188 */ |
| 3176 } | 3189 } |
| 3177 | 3190 |
| 3178 __ LoadHeapObject(ebx, FeedbackVector()); | 3191 __ LoadHeapObject(ebx, FeedbackVector()); |
| 3179 __ mov(edx, Immediate(SmiFromSlot(expr->CallFeedbackSlot()))); | 3192 __ mov(edx, Immediate(SmiFromSlot(expr->CallFeedbackSlot()))); |
| 3180 | 3193 |
| 3181 // TODO(dslomov): use a different stub and propagate new.target. | 3194 CallConstructStub stub(isolate(), SUPER_CALL_RECORD_TARGET); |
| 3182 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); | |
| 3183 __ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); | 3195 __ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); |
| 3184 | 3196 |
| 3185 RecordJSReturnSite(expr); | 3197 RecordJSReturnSite(expr); |
| 3186 | 3198 |
| 3199 __ Drop(1); |
| 3200 |
| 3187 EmitVariableAssignment(this_var, Token::INIT_CONST); | 3201 EmitVariableAssignment(this_var, Token::INIT_CONST); |
| 3188 context()->Plug(eax); | 3202 context()->Plug(eax); |
| 3189 } | 3203 } |
| 3190 | 3204 |
| 3191 | 3205 |
| 3192 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { | 3206 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { |
| 3193 ZoneList<Expression*>* args = expr->arguments(); | 3207 ZoneList<Expression*>* args = expr->arguments(); |
| 3194 DCHECK(args->length() == 1); | 3208 DCHECK(args->length() == 1); |
| 3195 | 3209 |
| 3196 VisitForAccumulatorValue(args->at(0)); | 3210 VisitForAccumulatorValue(args->at(0)); |
| (...skipping 2095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5292 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 5306 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
| 5293 Assembler::target_address_at(call_target_address, | 5307 Assembler::target_address_at(call_target_address, |
| 5294 unoptimized_code)); | 5308 unoptimized_code)); |
| 5295 return OSR_AFTER_STACK_CHECK; | 5309 return OSR_AFTER_STACK_CHECK; |
| 5296 } | 5310 } |
| 5297 | 5311 |
| 5298 | 5312 |
| 5299 } } // namespace v8::internal | 5313 } } // namespace v8::internal |
| 5300 | 5314 |
| 5301 #endif // V8_TARGET_ARCH_IA32 | 5315 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |